pub struct LanguageModelPrefixLoader<'a> { /* private fields */ }Expand description
Maps Llama-shaped keys (model.*, lm_head.*) to Voxtral safetensor names.
Implementations§
Source§impl<'a> LanguageModelPrefixLoader<'a>
impl<'a> LanguageModelPrefixLoader<'a>
pub fn new(inner: &'a mut WeightMap) -> LanguageModelPrefixLoader<'a>
Trait Implementations§
Source§impl WeightLoader for LanguageModelPrefixLoader<'_>
impl WeightLoader for LanguageModelPrefixLoader<'_>
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<'a> !UnwindSafe for LanguageModelPrefixLoader<'a>
impl<'a> Freeze for LanguageModelPrefixLoader<'a>
impl<'a> RefUnwindSafe for LanguageModelPrefixLoader<'a>
impl<'a> Send for LanguageModelPrefixLoader<'a>
impl<'a> Sync for LanguageModelPrefixLoader<'a>
impl<'a> Unpin for LanguageModelPrefixLoader<'a>
impl<'a> UnsafeUnpin for LanguageModelPrefixLoader<'a>
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