@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / faa4b76afa
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 3, 15:15 UTC

[Model] Support InternS2 Preview (#42705)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn> Co-authored-by: zxy <46674730+CUHKSZzxy@users.noreply.github.com>

Isotr0py committed May 15, 2026 at 12:30 UTC faa4b76afae3660efc8a5d48a8c7c2d37e0ffb05
6 files changed +60
docs/models/supported_models.md
+1
@@ -575,6 +575,7 @@ These models primarily accept the [`LLM.generate`](./generative_models.md#llmgen
575 | `IsaacForConditionalGeneration` | Isaac | T + I<sup>+</sup> | `PerceptronAI/Isaac-0.1` | ✅︎ | ✅︎ |
576 | `InternS1ForConditionalGeneration` | Intern-S1 | T + I<sup>E+</sup> + V<sup>E+</sup> | `internlm/Intern-S1`, `internlm/Intern-S1-mini`, etc. | ✅︎ | ✅︎ |
577 | `InternS1ProForConditionalGeneration` | Intern-S1-Pro | T + I<sup>E+</sup> + V<sup>E+</sup> | `internlm/Intern-S1-Pro`, etc. | ✅︎ | ✅︎ |
578 +| `InternS2PreviewForConditionalGeneration` | Intern-S2-Preview | T + I<sup>E+</sup> + V<sup>E+</sup> | `internlm/Intern-S2-Preview`, etc. | ✅︎ | ✅︎ |
579 | `InternVLChatModel` | InternVL 3.5, InternVL 3.0, InternVideo 2.5, InternVL 2.5, Mono-InternVL, InternVL 2.0 | T + I<sup>E+</sup> + (V<sup>E+</sup>) | `OpenGVLab/InternVL3_5-14B`, `OpenGVLab/InternVL3-9B`, `OpenGVLab/InternVideo2_5_Chat_8B`, `OpenGVLab/InternVL2_5-4B`, `OpenGVLab/Mono-InternVL-2B`, `OpenGVLab/InternVL2-4B`, etc. | ✅︎ | ✅︎ |
580 | `InternVLForConditionalGeneration` | InternVL 3.0 (HF format) | T + I<sup>E+</sup> + V<sup>E+</sup> | `OpenGVLab/InternVL3-1B-hf`, etc. | ✅︎ | ✅︎ |
581 | `KananaVForConditionalGeneration` | Kanana-V | T + I<sup>+</sup> | `kakaocorp/kanana-1.5-v-3b-instruct`, etc. | | ✅︎ |
tests/models/registry.py
+5
@@ -988,6 +988,11 @@ _MULTIMODAL_EXAMPLE_MODELS = {
988 "internlm/Intern-S1-Pro",
989 trust_remote_code=True,
990 ),
991 + "InternS2PreviewForConditionalGeneration": _HfExamplesInfo(
992 + "internlm/Intern-S2-Preview",
993 + trust_remote_code=True,
994 + is_available_online=False,
995 + ),
996 "InternVLChatModel": _HfExamplesInfo(
997 "OpenGVLab/InternVL2-1B",
998 extras={
vllm/config/speculative.py
+11
@@ -467,6 +467,17 @@ class SpeculativeConfig:
467 "architectures": ["Qwen3_5MoeMTP" if is_moe else "Qwen3_5MTP"],
468 }
469 )
470 + if hf_config.model_type == "intern_s2_preview":
471 + text_config = getattr(hf_config, "text_config", None)
472 + is_moe = getattr(text_config, "model_type", None) == "qwen3_5_moe_text"
473 + hf_config.model_type = "qwen3_5_mtp"
474 + n_predict = getattr(text_config, "mtp_num_hidden_layers", None)
475 + hf_config.update(
476 + {
477 + "n_predict": n_predict,
478 + "architectures": ["Qwen3_5MoeMTP" if is_moe else "Qwen3_5MTP"],
479 + }
480 + )
481 if hf_config.model_type == "longcat_flash":
482 hf_config.model_type = "longcat_flash_mtp"
483 n_predict = getattr(hf_config, "num_nextn_predict_layers", 1)
vllm/model_executor/models/interns2_preview.py new
+38
@@ -0,0 +1,38 @@
1 +# SPDX-License-Identifier: Apache-2.0
2 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +from collections.abc import Iterable
4 +
5 +import torch
6 +from transformers import AutoProcessor
7 +
8 +from vllm.multimodal import MULTIMODAL_REGISTRY
9 +
10 +from .qwen3_5 import Qwen3_5MoeForConditionalGeneration
11 +from .qwen3_vl import (
12 + Qwen3VLDummyInputsBuilder,
13 + Qwen3VLMultiModalProcessor,
14 + Qwen3VLProcessingInfo,
15 +)
16 +from .utils import AutoWeightsLoader
17 +
18 +
19 +class InternS2PreviewProcessingInfo(Qwen3VLProcessingInfo):
20 + def get_hf_config(self):
21 + return self.ctx.get_hf_config()
22 +
23 + def get_hf_processor(self, **kwargs: object) -> AutoProcessor:
24 + return self.ctx.get_hf_processor(**kwargs)
25 +
26 +
27 +@MULTIMODAL_REGISTRY.register_processor(
28 + Qwen3VLMultiModalProcessor,
29 + info=InternS2PreviewProcessingInfo,
30 + dummy_inputs=Qwen3VLDummyInputsBuilder,
31 +)
32 +class InternS2PreviewForConditionalGeneration(Qwen3_5MoeForConditionalGeneration):
33 + def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
34 + loader = AutoWeightsLoader(
35 + self,
36 + skip_prefixes=["mtp.", "model.time_series.", "time_series."],
37 + )
38 + return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
vllm/model_executor/models/registry.py
+4
@@ -435,6 +435,10 @@ _MULTIMODAL_MODELS = {
435 "interns1_pro",
436 "InternS1ProForConditionalGeneration",
437 ),
438 + "InternS2PreviewForConditionalGeneration": (
439 + "interns2_preview",
440 + "InternS2PreviewForConditionalGeneration",
441 + ),
442 "Idefics3ForConditionalGeneration": (
443 "idefics3",
444 "Idefics3ForConditionalGeneration",
vllm/v1/spec_decode/llm_base_proposer.py
+1
@@ -1218,6 +1218,7 @@ class SpecDecodeBaseProposer:
1218 "Exaone4_5_ForConditionalGeneration",
1219 "GlmOcrForConditionalGeneration",
1220 "HunYuanVLForConditionalGeneration",
1221 + "InternS2PreviewForConditionalGeneration",
1222 "MiMoV2OmniForCausalLM",
1223 "Qwen2_5_VLForConditionalGeneration",
1224 "Qwen3_5ForConditionalGeneration",