DeepSeekV4WeightLoader

Struct DeepSeekV4WeightLoader 

Source
pub struct DeepSeekV4WeightLoader;

Trait Implementations§

Source§

impl ModelWeightLoader for DeepSeekV4WeightLoader

Source§

fn supports_tp(&self) -> bool

2026-09-25: Whether this loader’s weight slicing honours config.tp_world_size / config.tp_rank. There is no default, so every loader declares it. Read more
Source§

fn load_layers( &self, store: &WeightStore, config: &ModelConfig, gpu: &dyn GpuBackend, layer_kv_dtypes: &[KvCacheDtype], ) -> Result<Vec<Box<dyn TransformerLayer>>>

2026-09-25: Load all transformer layers from the weight store. Read more
Source§

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>

2026-09-25: Load the final RMSNorm weight used before the LM head.
Source§

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>>

2026-09-25: Load single-module MTP head weights, or None.
Source§

fn prune_after_load( &self, _store: &mut WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<()>

2026-09-25: Drop store tensors this loader has finished with. factory::build calls it after every load_* reader and before the KV budget is computed, so the freed memory counts. Read more
Source§

fn precision_schedule(&self, _config: &ModelConfig) -> PrecisionSchedule

2026-09-25: Per-(layer, role) weight precision schedule. The default is 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>>

2026-09-25: Build the n-gram embedding, for an architecture that fuses hashed n-gram lookups into the input embedding (the LongCat loader). The default 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>>

2026-09-25: Load every MTP module; 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)>

2026-09-25: Per-attention-layer (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>>

2026-09-25: Load DFlash drafter weights from the drafter’s own 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>>

2026-09-25: Load startup-static PEFT LoRA adapters into the LoRA pool, through 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 binds_vision_encoder(&self) -> bool

2026-09-25: Will this loader bind a vision encoder for a multimodal checkpoint? Read more
Source§

fn reads_expert_table_plan(&self) -> bool

2026-10-02: Does this loader read the serve’s MoE expert-table decision (metrale_model_layers::layers::MoeExpertTables)? The serve plans and publishes it before load only for a loader that does.
Source§

fn defer_predicate(&self, _config: &ModelConfig) -> Option<DeferHook>

2026-09-25: Which checkpoint tensors will this loader read from the host at bind time, so the checkpoint loader records their location instead of uploading them? Read more
Source§

fn load_vision_encoder( &self, _store: &WeightStore, _config: &ModelConfig, _gpu: &dyn GpuBackend, ) -> Result<Option<VisionTower>>

2026-09-25: Load vision encoder weights; the default returns None.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,