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§
Sourcefn load_tensor(&self, name: &str) -> Result<B::Buffer>
fn load_tensor(&self, name: &str) -> Result<B::Buffer>
Load a single tensor by fully qualified name
(e.g. "model.embed_tokens.weight").
Sourcefn load_linear(&self, name: &str) -> Result<Box<dyn Linear<B>>>
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".
Sourcefn has_tensor(&self, name: &str) -> bool
fn has_tensor(&self, name: &str) -> bool
Whether a tensor with this name exists in the source.
Sourcefn quant_config(&self) -> Option<&QuantConfig>
fn quant_config(&self) -> Option<&QuantConfig>
Quantization metadata (parsed from quantize_config.json or a GGUF header).
None means the source is dense.