pub struct Qwen35DenseWeightLoader;Trait Implementations§
Source§impl ModelWeightLoader for Qwen35DenseWeightLoader
impl ModelWeightLoader for Qwen35DenseWeightLoader
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 the SSM source tensors the native-FP8 GDN arm copied and no longer reads (#915).
That arm builds a fused [QKV|Z] FP8 weight by device-to-device
appending in_proj_qkv and in_proj_z (concat_fp8_block_scaled), and
builds in_proj_ba by a D2H -> host interleave -> H2D round trip
(interleave_ba). All four store originals are dead the moment
load_layers returns — 80 MiB + ~1 MB per SSM layer, ~3.9 GB across the
48 GDN layers of Qwen3.8-27B-FP8, which is what the fused copy costs.
Keeping both is the duplicate that came straight out of the KV budget.
🪤 Narrow on purpose. out_proj.weight IS out_proj_fp8w.weight
(zero-copy from the store), conv1d, A_log, dt_bias and
norm.weight are aliased or conditionally aliased depending on their
on-disk dtype, and every attention tensor — and mlp.down_proj — is
bound zero-copy. Only the names below are freed, and only for layers
where the module-private predicate that SELECTED the corresponding
concat (gdn_fp8_arm_selected for the SSM [QKV|Z] weight,
ffn_gateup_fused_selected for the dense-FFN gate+up weight, #927)
says that arm actually ran.
Source§fn supports_tp(&self) -> bool
fn supports_tp(&self) -> bool
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>>>
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 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>>
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>>
Source§fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule
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>>
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>>
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)>
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 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>>
WeightStores (the adapter_model.safetensors tensors, already
on-device BF16) into the fixed-address rank-padded pool (one slot each). Read more