pub struct WeightLoader { /* private fields */ }Expand description
Builder for loading model weights with validation
Implementations§
Source§impl WeightLoader
impl WeightLoader
Sourcepub fn new(loader: ModelLoader) -> Self
pub fn new(loader: ModelLoader) -> Self
Create a new weight loader
Sourcepub fn model_type(self, model_type: ModelType) -> Self
pub fn model_type(self, model_type: ModelType) -> Self
Set the expected model type
Sourcepub fn strict(self, strict: bool) -> Self
pub fn strict(self, strict: bool) -> Self
Set whether to enforce strict loading (all weights must be present)
Sourcepub fn validate_weights(&self, required: &[&str]) -> ModelResult<()>
pub fn validate_weights(&self, required: &[&str]) -> ModelResult<()>
Validate that all required weights are present
Sourcepub fn loader(&self) -> &ModelLoader
pub fn loader(&self) -> &ModelLoader
Get the underlying loader
Sourcepub fn with_name_mapping(self, _mapping: HashMap<String, String>) -> Self
pub fn with_name_mapping(self, _mapping: HashMap<String, String>) -> Self
Sourcepub fn print_weights(&self)
pub fn print_weights(&self)
Print available weights and their shapes
This is useful for understanding what weights are available in the checkpoint
Sourcepub fn suggest_huggingface_mapping(&self) -> Vec<(String, String)>
pub fn suggest_huggingface_mapping(&self) -> Vec<(String, String)>
Get suggested weight mappings for HuggingFace format
Returns a list of (hf_name, kizzasi_name) pairs that can be used to convert HuggingFace checkpoints to Kizzasi format
Auto Trait Implementations§
impl Freeze for WeightLoader
impl RefUnwindSafe for WeightLoader
impl Send for WeightLoader
impl Sync for WeightLoader
impl Unpin for WeightLoader
impl UnwindSafe for WeightLoader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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