pub struct CheckpointParamLoader { /* private fields */ }Expand description
Serves checkpoint tensors by name (used to rebuild graphs without reloading safetensors).
Implementations§
Trait Implementations§
Source§impl WeightLoader for CheckpointParamLoader
impl WeightLoader for CheckpointParamLoader
Source§fn take(&mut self, key: &str) -> Result<(Vec<f32>, Vec<usize>), Error>
fn take(&mut self, key: &str) -> Result<(Vec<f32>, Vec<usize>), Error>
Take the named tensor as
(f32_data, shape). Removes from the
loader so callers can detect “weights I never used.”Source§fn take_transposed(
&mut self,
key: &str,
) -> Result<(Vec<f32>, Vec<usize>), Error>
fn take_transposed( &mut self, key: &str, ) -> Result<(Vec<f32>, Vec<usize>), Error>
Same as
take but transposed (last two dims swapped). Most
safetensors weights are stored row-major-of-PyTorch
convention, which RLX’s IR consumes column-major; this helper
is the convention-bridge.Source§fn remaining_keys(&self) -> Vec<String>
fn remaining_keys(&self) -> Vec<String>
Names that haven’t been taken yet — useful for “did the
model use every weight?” hygiene checks.
fn is_empty(&self) -> bool
Source§fn take_packed(
&mut self,
key: &str,
) -> Result<Option<(Vec<u8>, QuantScheme, Vec<usize>)>, Error>
fn take_packed( &mut self, key: &str, ) -> Result<Option<(Vec<u8>, QuantScheme, Vec<usize>)>, Error>
Take packed K-quant bytes when supported; default returns
None.Source§fn tensor_bytes_borrowed(&self, key: &str) -> Option<&[u8]>
fn tensor_bytes_borrowed(&self, key: &str) -> Option<&[u8]>
Borrow packed bytes without marking taken (GGUF mmap path).
Source§fn arch_hint(&self) -> Option<&str>
fn arch_hint(&self) -> Option<&str>
Architecture name from the underlying file (
general.architecture
for GGUF, None for safetensors). Drain-style consumers use this
to pick an arch-specific reverse name mapping when the canonical
HF name depends on the model family (e.g. Gemma 2’s 4 norms per
layer don’t share the Llama 2-norm reverse alias).Auto Trait Implementations§
impl Freeze for CheckpointParamLoader
impl RefUnwindSafe for CheckpointParamLoader
impl Send for CheckpointParamLoader
impl Sync for CheckpointParamLoader
impl Unpin for CheckpointParamLoader
impl UnsafeUnpin for CheckpointParamLoader
impl UnwindSafe for CheckpointParamLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more