Module weight_map

Module weight_map 

Source
Expand description

2026-09-25: Maps HuggingFace safetensors tensor names onto the typed per-layer weight structures, through the weight_map/ sub-modules re-exported here.

Owner: model-layers (weight loading). Invariants: none beyond the types.

Re-exports§

pub use loaders_fp8::*;
pub use model_a::*;
pub use nemotron::*;
pub use nvfp4_detect::*;
pub use quantized::*;
pub use ssm_qwen35::*;

Modules§

fp8_dequant
2026-09-25: FP8 E4M3 → BF16 dequantization for weights with one per-tensor scale: a GPU path for an FP32 scale, and a host path for an FP32 or BF16 scale.
fp8_lut
2026-09-25: Load-time weight conversions: NVFP4 and NVFP4-with-E8M0 to BF16, the E8M0 lookup, dense-FFN loading, row concatenation and the BA interleave for the GDN gate kernel.
loaders_fp8
2026-09-25: FP8 block-scaled weight loading, BF16-to-NVFP4 quantization, and the attention, SSM and MoE layer loaders.
loaders_moe
2026-09-25: MoE and MTP-head weight loaders: the mlp MoE block, the Mistral w1/w2/w3 MoE block, and the MTP head.
model_a
2026-09-25: Basic store accessors: raw pointers, scalars, KV scales, ModelOpt NVFP4, native MXFP4, and dtype-converting dense loads.
nemotron
2026-09-25: Nemotron-H weight structs and loaders for the Mamba-2 mixer, attention and MoE layers.
nvfp4_detect
2026-09-25: Detection of the on-disk weight format (Nvfp4Variant) and the variant-dispatching quantized-weight loaders.
quant_helpers
2026-09-25: FP8-to-BF16 dequantization, dtype-dispatching dense loads, and the compressed-tensors NVFP4 loader.
quantized
2026-09-25: Device-resident weight types (QuantizedWeight, DenseWeight, Fp8Weight, PackedQ2Weight) and the WeightQuantFormat tag.
ssm_qwen35
2026-09-25: Qwen3.5-family loaders: the separate-projection linear-attention weights and three MoE loaders (NVFP4, native FP8 experts, no shared expert).
ssm_qwen35_more
2026-09-25: MoE loaders for the MiniMax M2 (block_sparse_moe, w1/w2/w3) and Gemma-4 (router, moe.experts) layouts.

Structs§

AttentionWeights
2026-09-25: Full-attention layer weights.
DenseExpertWeight
2026-09-25: BF16 gate, up and down projections of one expert.
ExpertWeight
2026-09-25: One MoE expert’s NVFP4 gate/up/down projections.
Fp8ExpertWeight
2026-09-25: FP8 expert weight: gate/up/down projections as Fp8Weights.
MoeWeights
2026-09-25: Weights of one MoE block.
MtpFp8Experts
2026-09-25: Native FP8 block-scaled MTP MoE tables: experts[e] is routed expert e (all num_experts are loaded), plus the shared expert. The FP8 bytes belong to the weight store; only the FP32 block scales are owned allocations.
MtpWeights
2026-09-25: MTP (multi-token prediction) head weights: one decoder layer plus the concat projection fc.
QuantExpertWeight
2026-09-25: Per-expert weights in any supported format. ExpertWeight (NVFP4) and Fp8ExpertWeight convert into it.
SsmWeights
2026-09-25: Linear-attention (Gated DeltaNet) layer weights.

Enums§

LayerWeights
2026-09-25: All weights of one attention or linear-attention layer.
Nvfp4Variant
2026-09-25: On-disk weight format, chosen by detect_nvfp4_variant.
QuantWeight
2026-09-25: A weight in any supported format. ops::quant_gemv / ops::quant_gemm match on it to pick the kernel.

Functions§

load_fp8_weight
2026-09-25: Load an FP8 E4M3 checkpoint weight with per-row scales as an Fp8Weight tagged Fp8PerRow.
quantize_to_fp8
2026-09-25: Quantize a BF16 dense weight [n, k] to FP8 E4M3 (n*k bytes) with one FP32 scale per row. It synchronizes stream, so it belongs at load time, not in a forward pass.
quantize_to_fp8_blockscaled
2026-09-25: Quantize an [n, k] BF16 dense weight to block-scaled FP8 E4M3 on the GPU, as an Fp8Weight tagged Fp8BlockScaled with FP32 scales [ceil(n/128), ceil(k/128)].