You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three separate paths, because the checkpoint's three weight classes live in different places:
4
4
5
-
* :func:`iter_weights` -- every dense (non-expert) tensor, with the ``model.language_model.`` prefix stripped and fused where the model expects one buffer. See ``_FUSIONS``.
5
+
* :func:`iter_weights` -- every dense (non-expert) tensor, with the ``model.language_model.`` prefix stripped and fused where the model expects one buffer. See ``_DenseFuser``.
6
6
* :func:`load_ple_table` -- the 47.7 GiB FP8 n-gram table, 128 checkpoint shards concatenated into one pinned :class:`HostBank`.
7
7
* :func:`nvfp4_expert_spec` -- how the routed NVFP4 experts are named, for the offload cache's expert reader.
# The per-layer HC mix reads the low-rank down projection and the injection logits from one GEMM; vLLM pads the merged rows to a multiple of 16 for cuBLAS (hyperconnection.py pad_size).
76
+
# The top-level hyper_connection_mixer has no injection and never fuses.
"""Buffer a fusion part; return the merged ``(name, tensor)`` once all parts arrive, ``()`` while incomplete, ``None`` if ``name`` is not a fusion part."""
"""``name`` -> ``(module, kind)``; kind is "" for tensors that are neither a weight nor a block scale."""
103
+
forsuffixin_KIND_SUFFIXES:
104
+
ifname.endswith(suffix):
105
+
returnname[: -len(suffix)], suffix
106
+
returnname, ""
107
+
108
+
109
+
class_DenseFuser:
110
+
"""Concatenates checkpoint projection parts into the model's merged buffers, per kind (weight / block scale).
111
+
112
+
The part table is the family's packed_modules_mapping. The QuantConfig picks the GDN in_proj layout and validates each part against the scheme the model built its buffer from.
gate|up -> ``gate_up_proj``, and each per-layer HC's ``input_mix_weight_down`` |
156
-
``block_inject_weight`` -> a zero-padded ``input_mix_weight_down_block_inject``.
157
-
158
-
``include_moe_experts`` is accepted for the loader contract but never yields anything: the
159
-
routed experts are NVFP4 and always come from the offload cache's expert reader.
201
+
Keys keep the checkpoint's module names below the stripped prefix, so the emitted set is the model's state dict minus the routed experts.
202
+
A dense projection is bf16 or 128x128 block-fp8 (``.weight`` e4m3 + ``.weight_scale_inv``) as the checkpoint's QuantConfig says: the official releases skip everything but the routed experts, the community NVFP4-FP8 requants quantize the attention / GDN projections.
203
+
Fusions, per kind: attention q|k|v -> ``qkv_proj``; GDN ``in_proj_{qkv,z,b,a}`` -> ``in_proj``, or ``in_proj_qkvz`` + bf16 ``in_proj_ba`` when qkv|z is quantized; shared-expert gate|up -> ``gate_up_proj``; each per-layer HC's ``input_mix_weight_down`` | ``block_inject_weight`` -> a zero-padded ``input_mix_weight_down_block_inject``.
204
+
``include_moe_experts`` is accepted for the loader contract but never yields anything: the routed experts are NVFP4 and always come from the offload cache's expert reader.
"""modelopt MIXED_PRECISION with NVFP4 routed experts and FP8_PB_WO attention / GDN projections, ignore list as in lovedheart/Qwen3.8-Flash-Next-NVFP4-FP8."""
0 commit comments