Skip to main content

WeightLoader

Trait WeightLoader 

Source
pub trait WeightLoader<B: Backend>: Send + Sync {
    // Required methods
    fn load_tensor(&self, name: &str) -> Result<B::Buffer>;
    fn load_linear(&self, name: &str) -> Result<Box<dyn Linear<B>>>;
    fn has_tensor(&self, name: &str) -> bool;
    fn quant_config(&self) -> Option<&QuantConfig>;
}

Required Methods§

Source

fn load_tensor(&self, name: &str) -> Result<B::Buffer>

Load a single tensor by fully qualified name (e.g. "model.embed_tokens.weight").

Source

fn load_linear(&self, name: &str) -> Result<Box<dyn Linear<B>>>

Load a projection as a Linear<B>. The concrete implementation (DenseLinear / GptqLinear / AwqLinear / GgufLinear) depends on the loader’s file format and quant config.

name is the module path without the .weight suffix, e.g. "model.layers.0.self_attn.qkv_proj".

Source

fn has_tensor(&self, name: &str) -> bool

Whether a tensor with this name exists in the source.

Source

fn quant_config(&self) -> Option<&QuantConfig>

Quantization metadata (parsed from quantize_config.json or a GGUF header). None means the source is dense.

Implementors§