pub struct Qwen4ExpWeightLoader;Trait Implementations§
Source§impl ModelWeightLoader for Qwen4ExpWeightLoader
impl ModelWeightLoader for Qwen4ExpWeightLoader
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>
This model has no final norm tensor.
There is no model.norm.weight anywhere in the checkpoint. The
model-level hyper_connection_mixer — which collapses the hc_mult
residual streams back to a single hidden state before lm_head —
carries hc_norm [hc_mult*hidden], and that IS the final
normalization. It is the wrong width to stand in here (10240 against
2560), and applying it as though it were a plain final norm would be
inventing math.
A ones-filled buffer keeps the shape contract so the footprint can be measured at load. It is unreachable at inference because the mHC forward refuses first; if that ever stops being true, this is the first thing to fix.
Source§fn supports_tp(&self) -> bool
fn supports_tp(&self) -> bool
Whether this loader’s weight slicing is TP-aware. No default —
every loader MUST declare this explicitly so adding a new model
architecture cannot accidentally inherit a
false and silently
regress users who pass --tp-size > 1. Read moreSource§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>>>
Load all transformer layers from the weight store. Read more
fn load_embedding( &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 load_vision_encoder(
&self,
store: &WeightStore,
config: &ModelConfig,
gpu: &dyn GpuBackend,
) -> Result<Option<VisionEncoder>>
fn load_vision_encoder( &self, store: &WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, ) -> Result<Option<VisionEncoder>>
Load vision encoder weights (returns None for text-only models).
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>>
Load MTP head weights (returns None if no MTP weights in store).
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<()>
Drop store tensors this loader has finished with, after every
load_* reader has run and before the buffer arena / KV cache are sized. Read moreSource§fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
Per-(layer, role) weight precision schedule (C.3, 2026-04-25).
Default impl returns the empty schedule (every lookup yields
Dtype::Inherit), preserving the existing per-checkpoint
dtype logic byte-for-byte. Loader-specific implementations
can override to honour MODEL.toml’s [precision] block.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>>
Build the n-gram embedding, when this architecture fuses hashed
n-gram lookups into the input embedding (LongCat / Qwen3.8-Flash-Next). Read more
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>>
Load MTP weights for multi-module MTP (DeepSeek-V3 / MiniMax-M2
style: N independent transformer modules, each with its own
attention + MoE + KV cache). Returns an empty
Vec when the
checkpoint has no MTP modules, a 1-element Vec for single-module
MTP (Qwen3.5 family), or N elements for multi-module. Read moreSource§fn kv_layer_dims(&self, _config: &ModelConfig) -> Vec<(usize, usize)>
fn kv_layer_dims(&self, _config: &ModelConfig) -> Vec<(usize, usize)>
Per-layer (num_kv_heads, head_dim) overrides for heterogeneous
attention models (e.g. Gemma-4 with sliding 16×256 and full 4×512).
Default empty — homogeneous models skip per-layer dims and the KV
cache allocator uses the global (num_kv_heads, head_dim). Populated
by loaders whose models have different attention geometries per
layer. Indexed by attention layer index (same as layer_kv_dtypes).
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>>
Load DFlash drafter weights from a separate
WeightStore pointing
at the drafter checkpoint (z-lab/Qwen3.6-{27B,35B-A3B}-DFlash).
Default impl returns None so loaders that don’t yet support
DFlash silently fall through to the existing MTP path. Override in
loaders whose target models pair with a DFlash drafter (Qwen3.5/3.6
family). The same drafter format works across both 27B-dense and
35B-A3B-MoE targets — only the target_hidden_size validated
against the drafter’s fc input dimension differs.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>>
Load one or more startup-static PEFT LoRA adapters from their own
WeightStores (the adapter_model.safetensors tensors, already
on-device BF16) into the fixed-address rank-padded pool (one slot each). Read moreSource§fn binds_vision_encoder(&self) -> bool
fn binds_vision_encoder(&self) -> bool
Will this loader ever bind a vision encoder for a multimodal checkpoint? Read more
Auto Trait Implementations§
impl Freeze for Qwen4ExpWeightLoader
impl RefUnwindSafe for Qwen4ExpWeightLoader
impl Send for Qwen4ExpWeightLoader
impl Sync for Qwen4ExpWeightLoader
impl Unpin for Qwen4ExpWeightLoader
impl UnwindSafe for Qwen4ExpWeightLoader
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