pub struct ModelLoader { /* private fields */ }Expand description
Model loader for GGUF files
Implementations§
Source§impl ModelLoader
impl ModelLoader
Sourcepub fn load<P: AsRef<Path>>(path: P) -> ModelResult<Self>
pub fn load<P: AsRef<Path>>(path: P) -> ModelResult<Self>
Load a model from a GGUF file path
Sourcepub fn config(&self) -> &ModelConfig
pub fn config(&self) -> &ModelConfig
Get the model configuration
Sourcepub fn config_mut(&mut self) -> &mut ModelConfig
pub fn config_mut(&mut self) -> &mut ModelConfig
Get mutable reference to model configuration (e.g., to clamp context length).
Sourcepub fn architecture(&self) -> Architecture
pub fn architecture(&self) -> Architecture
Get the detected architecture
Sourcepub fn build_model(self) -> ModelResult<LlamaModel>
pub fn build_model(self) -> ModelResult<LlamaModel>
Build the model from loaded weights.
Delegates to the format-independent build_llama_model free function
via the ModelSource trait, so that SafeTensors and other loaders can
reuse the same layer assembly logic.
Sourcepub fn build_bert_model(self) -> ModelResult<BertModel>
pub fn build_bert_model(self) -> ModelResult<BertModel>
Build a BERT encoder-only model from loaded weights
Sourcepub fn deltanet_config(&self) -> Option<DeltaNetConfig>
pub fn deltanet_config(&self) -> Option<DeltaNetConfig>
Get the DeltaNet config for creating recurrent state (Qwen3Next). Returns None if the model has no SSM layers or is Mamba.
Sourcepub fn recurrent_config(&self) -> Option<RecurrentConfig>
pub fn recurrent_config(&self) -> Option<RecurrentConfig>
Get the recurrent config (DeltaNet or Mamba) for creating inference context.
Trait Implementations§
Source§impl ModelSource for ModelLoader
impl ModelSource for ModelLoader
Source§fn config(&self) -> &ModelConfig
fn config(&self) -> &ModelConfig
Get parsed model configuration.
Source§fn config_mut(&mut self) -> &mut ModelConfig
fn config_mut(&mut self) -> &mut ModelConfig
Get mutable reference to model configuration.
Source§fn architecture(&self) -> Architecture
fn architecture(&self) -> Architecture
Get detected architecture.
Source§fn load_tensor(&self, name: &str) -> ModelResult<Tensor>
fn load_tensor(&self, name: &str) -> ModelResult<Tensor>
Load a tensor by internal name (e.g., “blk.0.attn_q.weight”).
Auto Trait Implementations§
impl Freeze for ModelLoader
impl RefUnwindSafe for ModelLoader
impl Send for ModelLoader
impl Sync for ModelLoader
impl Unpin for ModelLoader
impl UnsafeUnpin for ModelLoader
impl UnwindSafe for ModelLoader
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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