pub struct Glm5NextWeightLoader;Trait Implementations§
Source§impl ModelWeightLoader for Glm5NextWeightLoader
impl ModelWeightLoader for Glm5NextWeightLoader
Source§fn binds_vision_encoder(&self) -> bool
fn binds_vision_encoder(&self) -> bool
2026-09-25: True only when metrale_config::glm_vision_enabled()
(METRALE_GLM_VISION). The GLM-5.3 config parser reads the same function
before it parses vision_config; this method takes no config, so the
gate is the environment.
Source§fn load_vision_encoder(
&self,
store: &WeightStore,
config: &ModelConfig,
gpu: &dyn GpuBackend,
) -> Result<Option<VisionTower>>
fn load_vision_encoder( &self, store: &WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, ) -> Result<Option<VisionTower>>
2026-09-25: Bind the model.visual.* tower; see
crate::weight_loader::glm5_next_vision.
Source§fn defer_predicate(&self, config: &ModelConfig) -> Option<DeferHook>
fn defer_predicate(&self, config: &ModelConfig) -> Option<DeferHook>
2026-09-25: Keep the MTP layer’s BF16 routed-expert weights off the
device (is_full_width_mtp_expert); bind_expert quantises them from
disk. The layer is num_hidden_layers. A checkpoint whose MTP experts
are U8 defers nothing.
Source§fn supports_tp(&self) -> bool
fn supports_tp(&self) -> bool
2026-09-25: DSA, KDA and the MLP all shard under TP (see glm5_next_load.rs);
routed experts are also split by EP (local_expert_range).
Source§fn load_mtp_weights(
&self,
_store: &WeightStore,
_config: &ModelConfig,
_gpu: &dyn GpuBackend,
) -> Result<Option<MtpWeights>>
fn load_mtp_weights( &self, _store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<Option<MtpWeights>>
2026-09-25: None: the GLM-5.3 MTP layer is loaded by
glm5_next_mtp::load_glm5next_mtp_module, not as MtpWeights.
Source§fn prune_after_load(
&self,
store: &mut WeightStore,
config: &ModelConfig,
gpu: &dyn GpuBackend,
) -> Result<()>
fn prune_after_load( &self, store: &mut WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, ) -> Result<()>
2026-09-25: Free the store tensors is_reuploaded matches, then those
is_quantized_expert_weight matches.
Source§fn load_layers(
&self,
store: &WeightStore,
config: &ModelConfig,
gpu: &dyn GpuBackend,
_layer_kv_dtypes: &[KvCacheDtype],
) -> Result<Vec<Box<dyn TransformerLayer>>>
fn load_layers( &self, store: &WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, _layer_kv_dtypes: &[KvCacheDtype], ) -> Result<Vec<Box<dyn TransformerLayer>>>
fn load_embedding( &self, store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<DenseWeight>
Source§fn load_final_norm(
&self,
store: &WeightStore,
_config: &ModelConfig,
_gpu: &dyn GpuBackend,
) -> Result<DenseWeight>
fn load_final_norm( &self, store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<DenseWeight>
fn load_lm_head( &self, store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<DenseWeight>
Source§fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
PrecisionSchedule::default(), in which every role is Dtype::Inherit.Source§fn load_ngram_embedding(
&self,
_store: &WeightStore,
_config: &ModelConfig,
_gpu: &dyn GpuBackend,
_max_tokens: usize,
) -> Result<Option<NgramEmbedding>>
fn load_ngram_embedding( &self, _store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, _max_tokens: usize, ) -> Result<Option<NgramEmbedding>>
None leaves the plain embed_tokens gather in place.Source§fn load_mtp_weights_multi(
&self,
store: &WeightStore,
config: &ModelConfig,
gpu: &dyn GpuBackend,
) -> Result<Vec<MtpWeights>>
fn load_mtp_weights_multi( &self, store: &WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, ) -> Result<Vec<MtpWeights>>
factory::build calls this one.
The default wraps load_mtp_weights (zero or one module). The MiniMax
and Step3p7 loaders override it.Source§fn kv_layer_dims(&self, _config: &ModelConfig) -> Vec<(usize, usize)>
fn kv_layer_dims(&self, _config: &ModelConfig) -> Vec<(usize, usize)>
(num_kv_heads, head_dim), indexed like
layer_kv_dtypes, for models whose attention geometry differs per layer
(the Gemma-4 loader). The default is empty: every layer uses the global
dims.Source§fn load_dflash_weights(
&self,
_drafter_store: &WeightStore,
_config: &ModelConfig,
_gpu: &dyn GpuBackend,
_tp_size: usize,
) -> Result<Option<DflashWeights>>
fn load_dflash_weights( &self, _drafter_store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, _tp_size: usize, ) -> Result<Option<DflashWeights>>
WeightStore. The default returns None, and no loader overrides it:
factory::build loads the drafter with the free function
dflash_loader::load_dflash_weights.Source§fn load_lora_adapters(
&self,
adapters: &[LoraAdapterInput<'_>],
config: &ModelConfig,
gpu: &dyn GpuBackend,
max_loras: usize,
max_lora_rank: usize,
) -> Result<Option<LoraWeights>>
fn load_lora_adapters( &self, adapters: &[LoraAdapterInput<'_>], config: &ModelConfig, gpu: &dyn GpuBackend, max_loras: usize, max_lora_rank: usize, ) -> Result<Option<LoraWeights>>
metrale_model_layers::lora::load_lora_adapters_multi.
factory::build calls it before the buffer arena and the KV budget, so
the pool counts as used memory.Source§fn reads_expert_table_plan(&self) -> bool
fn reads_expert_table_plan(&self) -> bool
metrale_model_layers::layers::MoeExpertTables)? The serve plans and publishes it before
load only for a loader that does.