nemo_automodel.components.models.hy_v4_flash.state_dict_adapter
nemo_automodel.components.models.hy_v4_flash.state_dict_adapter
State-dict conversion between the released tencent/Hy4-flash checkpoint and AutoModel.
The released safetensors use the original module names (the transformers reference renames them on load). The
renamed suffixes are listed in _SUFFIXES; in addition the post-MLP norm is mlp.combine_output_norm (MoE
layers) or mlp.post_fc2_norm (dense layer) in the release, and the expert tensors are transposed
(gate_up_proj [E, 2I, latent] -> gate_and_up_projs [E, latent, 2I]; down_proj [E, latent, I] ->
down_projs [E, I, latent]). Every other language-model key is identical. model.dfly_layers.* (the
inference-only speculative drafter) is not loaded.
The Engram tables hold exactly sum(head vocab sizes) rows; the owner-sharded table pads them to a multiple of
the owner group size, so loading adds zero rows and saving exposes only the logical rows.
Module Contents
Classes
Functions
Data
API
Bases: StateDictAdapter
Bridge the released Hy4-flash language-model tensors and the AutoModel module layout.
Convert one native tensor (grouped experts [experts, in, out]; Engram tables [padded_rows, dim]).
Returns one (released key, tensor) pair, or none for keys the release has no counterpart for.
Keep fp32 parameters (hyper-connections, sinks, router, indexer pooling, head) in fp32 on export.
Convert released tensors to AutoModel names and layouts.
Parameters:
Released-name tensors. Stacked experts have shape [experts, out, in]; they are either complete CPU tensors (sliced here to this rank’s expert range) or already expert-sharded DTensors.
Expert mesh selecting this rank’s experts.
Returns: dict[str, torch.Tensor]
Native tensors; grouped experts have shape [experts, in, out].
Export native tensors under the released names and layouts.
Rename key from the released to the native spelling (released=True) or back; other keys are unchanged.