Add MTP support for Nemotron VL models (#53121)

Signed-off-by: Daniel Serebrenik <daserebrenik@nvidia.com>
This commit is contained in:
danisereb
2026-08-24 00:59:56 +00:00
committed by GitHub
parent cd329413e2
commit a7195188a4
2 changed files with 10 additions and 2 deletions
+6 -2
View File
@@ -216,7 +216,7 @@ class NemotronHMultiTokenPredictor(nn.Module):
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
super().__init__()
config = vllm_config.model_config.hf_config
config = vllm_config.model_config.hf_config.get_text_config()
self.config = config
self.vocab_size = config.vocab_size
@@ -322,7 +322,7 @@ class NemotronHMTP(nn.Module, SupportsPP):
def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
super().__init__()
config = vllm_config.model_config.hf_config
config = vllm_config.model_config.hf_config.get_text_config()
self.vllm_config = vllm_config
self.config = config
self.quant_config = vllm_config.quant_config
@@ -414,6 +414,10 @@ class NemotronHMTP(nn.Module, SupportsPP):
loaded_params: set[str] = set()
for name, loaded_weight in weights:
# MTP weights are nested in "language_model."
# in Multimodal Nemotron-H checkpoints.
name = name.removeprefix("language_model.")
# Only process MTP weights - skip all non-MTP weights
if not name.startswith("mtp.") and "embeddings" not in name:
continue
+4
View File
@@ -1403,6 +1403,10 @@ class SpecDecodeBaseProposer:
self.model.config.image_token_index = (
target_model.config.media_placeholder_token_id
)
elif self.get_model_name(target_model) == "NemotronH_Nano_VL_V2":
self.model.config.image_token_index = (
target_model.config.img_context_token_id
)
else:
self.model.config.image_token_index = (
target_model.config.image_token_index