Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/auto_deploy/model_registry/models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ models:
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml']
# --- DeepSeek V3.2 (Dec 2025) ---
- name: deepseek-ai/DeepSeek-V3.2
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml']
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml', 'deepseek_v2_ep.yaml']
- name: deepseek-ai/DeepSeek-V3.2-Speciale
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml']
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml', 'deepseek_v2_ep.yaml']
- name: nvidia/DeepSeek-V3.2-NVFP4
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml']
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml', 'num_hidden_layers_5.yaml', 'deepseek_v2_ep.yaml']
# --- GLM-4.6 (Sep 2025) ---
- name: zai-org/GLM-4.6
yaml_extra: ['dashboard_default.yaml', 'world_size_8.yaml']
Expand Down
2 changes: 2 additions & 0 deletions tensorrt_llm/_torch/auto_deploy/models/custom/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .modeling_decilm import DeciLMForCausalLM
from .modeling_deepseek import DeepSeekV3ForCausalLM
from .modeling_deepseek_v2 import DeepSeekV2ForCausalLM
from .modeling_deepseek_v32 import DeepSeekV32ForCausalLM
from .modeling_glm4_moe_lite import Glm4MoeLiteForCausalLM
from .modeling_granite_moe_hybrid import GraniteMoeHybridForCausalLM
from .modeling_hunyuan_dense_v1 import HunYuanDenseV1ForCausalLM
Expand All @@ -16,6 +17,7 @@
"DeciLMForCausalLM",
"DeepSeekV2ForCausalLM",
"DeepSeekV3ForCausalLM",
"DeepSeekV32ForCausalLM",
"Glm4MoeLiteForCausalLM",
"HunYuanDenseV1ForCausalLM",
"GraniteMoeHybridForCausalLM",
Expand Down
15 changes: 11 additions & 4 deletions tensorrt_llm/_torch/auto_deploy/models/custom/mla_rope_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
"""Shared MLA RoPE utilities for auto_deploy custom models.

Contains helper functions for RoPE weight de-interleaving,
used by DeepSeek V3 and GLM4 MoE Lite model implementations.
used by DeepSeek V3, V3.2, and GLM4 MoE Lite model implementations.
"""

from typing import Dict

import torch


def _permute_with_fp8_support(tensor: torch.Tensor, perm: torch.Tensor, dim: int) -> torch.Tensor:
"""Index-select along a dimension, casting through float32 for FP8 tensors."""
if tensor.dtype in (torch.float8_e4m3fn, torch.float8_e5m2):
return tensor.to(torch.float32).index_select(dim, perm).to(tensor.dtype)
return tensor.index_select(dim, perm)


def _rope_deinterleave_load_hook(
state_dict: Dict[str, torch.Tensor],
prefix: str,
Expand Down Expand Up @@ -43,7 +50,7 @@ def _rope_deinterleave_load_hook(
w = w.view(num_heads, qk_head_dim, -1)
w_nope = w[:, :qk_nope_head_dim, :]
w_rope = w[:, qk_nope_head_dim:, :]
w_rope = w_rope[:, perm, :]
w_rope = _permute_with_fp8_support(w_rope, perm, dim=1)
w = torch.cat([w_nope, w_rope], dim=1)
state_dict[q_key] = w.view(-1, w.shape[-1])

Expand All @@ -53,7 +60,7 @@ def _rope_deinterleave_load_hook(
w = state_dict[kv_key]
w_kv = w[:kv_lora_rank, :]
w_pe = w[kv_lora_rank:, :]
w_pe = w_pe[perm, :]
w_pe = _permute_with_fp8_support(w_pe, perm, dim=0)
state_dict[kv_key] = torch.cat([w_kv, w_pe], dim=0)

# --- kv_a_proj_with_mqa.bias (if present) ---
Expand All @@ -62,5 +69,5 @@ def _rope_deinterleave_load_hook(
b = state_dict[kv_bias_key]
b_kv = b[:kv_lora_rank]
b_pe = b[kv_lora_rank:]
b_pe = b_pe[perm]
b_pe = _permute_with_fp8_support(b_pe, perm, dim=0)
state_dict[kv_bias_key] = torch.cat([b_kv, b_pe])
Loading