Skip to content

hunyuan_v1_dense

hunyuan_v1_dense

Hunyuan dense V1 on vLLM (vllm.model_executor.models.hunyuan_v1).

Llama's names and a fused block, with a third element: it is called forward(positions, hidden_states, residual, kv_states) and returns (hidden_states, residual, kv_states), where the first two are the halves of the stream and the third the attention's keys and values, handed to the next block for cross-layer attention sharing (use_cla). The attention returns (output, (keys, values)); the output is what the block adds. It norms its queries and keys per head after the rotary embedding (use_qk_norm), and the attention layer receives them after both, as on transformers.

On a checkpoint with use_cla the blocks that reuse an earlier block's keys and values run another attention module (HunYuanCrossAttention), which this family does not map; the released dense checkpoints do not set it.

RENAME module-attribute

RENAME = {'model.embed_tokens': 'embed_tokens', 'model.layers': 'layers', 'model.norm': 'norm'}

ENVOYS module-attribute

ENVOYS = {HunYuanDecoderLayer: Layer, HunYuanAttention: Attention, HunYuanMLP: Mlp}

Layer

Layer(*args: Any, **kwargs: Any)

Bases: FusedLayer

The decoder block: forward(positions, hidden_states, residual, kv_states) -> (hidden_states, residual, kv_states).

skip_with

skip_with(hidden: Tensor) -> None

Skip this block, handing hidden ([1, tokens, hidden_size]) on as its residual stream, and no keys and values.

layer_output

layer_output(view: Tensor, raw: tuple) -> tuple