Support Intern-S2-Preview (#24875)
This commit is contained in:
@@ -76,6 +76,7 @@ def get_model_config(
|
|||||||
"Qwen3NextForCausalLM",
|
"Qwen3NextForCausalLM",
|
||||||
"Qwen3VLMoeForConditionalGeneration",
|
"Qwen3VLMoeForConditionalGeneration",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
]:
|
]:
|
||||||
E = config.num_experts // ep_size
|
E = config.num_experts // ep_size
|
||||||
topk = config.num_experts_per_tok
|
topk = config.num_experts_per_tok
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from sglang.srt.configs.dots_vlm import DotsVLMConfig
|
|||||||
from sglang.srt.configs.exaone import ExaoneConfig
|
from sglang.srt.configs.exaone import ExaoneConfig
|
||||||
from sglang.srt.configs.falcon_h1 import FalconH1Config
|
from sglang.srt.configs.falcon_h1 import FalconH1Config
|
||||||
from sglang.srt.configs.granitemoehybrid import GraniteMoeHybridConfig
|
from sglang.srt.configs.granitemoehybrid import GraniteMoeHybridConfig
|
||||||
|
from sglang.srt.configs.interns2preview import InternS2PreviewConfig
|
||||||
from sglang.srt.configs.janus_pro import MultiModalityConfig
|
from sglang.srt.configs.janus_pro import MultiModalityConfig
|
||||||
from sglang.srt.configs.jet_nemotron import JetNemotronConfig
|
from sglang.srt.configs.jet_nemotron import JetNemotronConfig
|
||||||
from sglang.srt.configs.jet_vlm import JetVLMConfig
|
from sglang.srt.configs.jet_vlm import JetVLMConfig
|
||||||
@@ -57,6 +58,7 @@ __all__ = [
|
|||||||
"Qwen3NextConfig",
|
"Qwen3NextConfig",
|
||||||
"Qwen3_5Config",
|
"Qwen3_5Config",
|
||||||
"Qwen3_5MoeConfig",
|
"Qwen3_5MoeConfig",
|
||||||
|
"InternS2PreviewConfig",
|
||||||
"DotsVLMConfig",
|
"DotsVLMConfig",
|
||||||
"DotsOCRConfig",
|
"DotsOCRConfig",
|
||||||
"FalconH1Config",
|
"FalconH1Config",
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
from sglang.srt.configs.qwen3_5 import (
|
||||||
|
Qwen3_5MoeConfig,
|
||||||
|
Qwen3_5MoeTextConfig,
|
||||||
|
Qwen3_5MoeVisionConfig,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class InternS2PreviewVisionConfig(Qwen3_5MoeVisionConfig):
|
||||||
|
model_type = "intern_s2_preview"
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class InternS2PreviewConfig(Qwen3_5MoeConfig):
|
||||||
|
model_type = "intern_s2_preview"
|
||||||
|
sub_configs = {
|
||||||
|
"vision_config": InternS2PreviewVisionConfig,
|
||||||
|
"text_config": Qwen3_5MoeTextConfig,
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super().__init__(**kwargs)
|
||||||
@@ -466,6 +466,7 @@ class ModelConfig:
|
|||||||
if is_draft_model and self.hf_config.architectures[0] in [
|
if is_draft_model and self.hf_config.architectures[0] in [
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
]:
|
]:
|
||||||
self.hf_config.architectures[0] = "Qwen3_5ForCausalLMMTP"
|
self.hf_config.architectures[0] = "Qwen3_5ForCausalLMMTP"
|
||||||
self.hf_config.num_nextn_predict_layers = 1
|
self.hf_config.num_nextn_predict_layers = 1
|
||||||
@@ -1522,6 +1523,7 @@ multimodal_model_archs = [
|
|||||||
"Qwen3VLMoeForConditionalGeneration",
|
"Qwen3VLMoeForConditionalGeneration",
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
"Qwen3ASRForConditionalGeneration",
|
"Qwen3ASRForConditionalGeneration",
|
||||||
"Qwen3OmniMoeForConditionalGeneration",
|
"Qwen3OmniMoeForConditionalGeneration",
|
||||||
"KimiVLForConditionalGeneration",
|
"KimiVLForConditionalGeneration",
|
||||||
|
|||||||
@@ -970,7 +970,13 @@ class MMEncoder:
|
|||||||
# Get additional video metadata
|
# Get additional video metadata
|
||||||
if (
|
if (
|
||||||
self.model_type
|
self.model_type
|
||||||
in ["qwen3_vl", "qwen3_vl_moe", "qwen3_5", "qwen3_5_moe"]
|
in [
|
||||||
|
"qwen3_vl",
|
||||||
|
"qwen3_vl_moe",
|
||||||
|
"qwen3_5",
|
||||||
|
"qwen3_5_moe",
|
||||||
|
"intern_s2_preview",
|
||||||
|
]
|
||||||
and video_processor_kwargs.get("video_metadata", None) is not None
|
and video_processor_kwargs.get("video_metadata", None) is not None
|
||||||
):
|
):
|
||||||
# For qwen3-vl/qwen3.5 models, we need to store the video timestamps
|
# For qwen3-vl/qwen3.5 models, we need to store the video timestamps
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ def get_rope_index(
|
|||||||
"qwen3_vl_moe",
|
"qwen3_vl_moe",
|
||||||
"qwen3_5",
|
"qwen3_5",
|
||||||
"qwen3_5_moe",
|
"qwen3_5_moe",
|
||||||
|
"intern_s2_preview",
|
||||||
):
|
):
|
||||||
t_index = (
|
t_index = (
|
||||||
torch.arange(llm_grid_t, device=position_ids.device)
|
torch.arange(llm_grid_t, device=position_ids.device)
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ from sglang.srt.configs import (
|
|||||||
BailingHybridConfig,
|
BailingHybridConfig,
|
||||||
FalconH1Config,
|
FalconH1Config,
|
||||||
GraniteMoeHybridConfig,
|
GraniteMoeHybridConfig,
|
||||||
|
InternS2PreviewConfig,
|
||||||
JetNemotronConfig,
|
JetNemotronConfig,
|
||||||
JetVLMConfig,
|
JetVLMConfig,
|
||||||
KimiLinearConfig,
|
KimiLinearConfig,
|
||||||
@@ -2193,6 +2194,7 @@ class ModelRunner(ModelRunnerKVCacheMixin):
|
|||||||
Qwen3NextConfig
|
Qwen3NextConfig
|
||||||
| Qwen3_5Config
|
| Qwen3_5Config
|
||||||
| Qwen3_5MoeConfig
|
| Qwen3_5MoeConfig
|
||||||
|
| InternS2PreviewConfig
|
||||||
| JetNemotronConfig
|
| JetNemotronConfig
|
||||||
| JetVLMConfig,
|
| JetVLMConfig,
|
||||||
):
|
):
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# Models
|
||||||
|
from sglang.srt.models.qwen3_5 import Qwen3_5MoeForConditionalGeneration
|
||||||
|
|
||||||
|
|
||||||
|
class InternS2PreviewForConditionalGeneration(Qwen3_5MoeForConditionalGeneration):
|
||||||
|
"""InternS2Preview Vision-Language Model."""
|
||||||
|
|
||||||
|
|
||||||
|
EntryClass = [InternS2PreviewForConditionalGeneration]
|
||||||
@@ -17,6 +17,7 @@ from sglang.srt.managers.schedule_batch import (
|
|||||||
MultimodalDataItem,
|
MultimodalDataItem,
|
||||||
MultimodalProcessorOutput,
|
MultimodalProcessorOutput,
|
||||||
)
|
)
|
||||||
|
from sglang.srt.models.interns2preview import InternS2PreviewForConditionalGeneration
|
||||||
from sglang.srt.models.qwen2_5_vl import Qwen2_5_VLForConditionalGeneration
|
from sglang.srt.models.qwen2_5_vl import Qwen2_5_VLForConditionalGeneration
|
||||||
from sglang.srt.models.qwen2_vl import Qwen2VLForConditionalGeneration
|
from sglang.srt.models.qwen2_vl import Qwen2VLForConditionalGeneration
|
||||||
from sglang.srt.models.qwen3_5 import (
|
from sglang.srt.models.qwen3_5 import (
|
||||||
@@ -246,6 +247,7 @@ class QwenVLImageProcessor(SGLangBaseProcessor):
|
|||||||
Qwen3VLMoeForConditionalGeneration,
|
Qwen3VLMoeForConditionalGeneration,
|
||||||
Qwen3_5ForConditionalGeneration,
|
Qwen3_5ForConditionalGeneration,
|
||||||
Qwen3_5MoeForConditionalGeneration,
|
Qwen3_5MoeForConditionalGeneration,
|
||||||
|
InternS2PreviewForConditionalGeneration,
|
||||||
Qwen3OmniMoeForConditionalGeneration,
|
Qwen3OmniMoeForConditionalGeneration,
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -419,7 +421,14 @@ class QwenVLImageProcessor(SGLangBaseProcessor):
|
|||||||
audio_seq_lens = (audio_seq_lens - 2) // 2 + 1
|
audio_seq_lens = (audio_seq_lens - 2) // 2 + 1
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.model_type in ["qwen3_vl", "qwen3_vl_moe", "qwen3_5", "qwen3_5_moe"]
|
self.model_type
|
||||||
|
in [
|
||||||
|
"qwen3_vl",
|
||||||
|
"qwen3_vl_moe",
|
||||||
|
"qwen3_5",
|
||||||
|
"qwen3_5_moe",
|
||||||
|
"intern_s2_preview",
|
||||||
|
]
|
||||||
and video_timestamps is not None
|
and video_timestamps is not None
|
||||||
):
|
):
|
||||||
input_ids, offsets, modality_list = self.build_input_ids_with_timestamps(
|
input_ids, offsets, modality_list = self.build_input_ids_with_timestamps(
|
||||||
@@ -522,6 +531,7 @@ class QwenVLImageProcessor(SGLangBaseProcessor):
|
|||||||
"qwen3_vl_moe",
|
"qwen3_vl_moe",
|
||||||
"qwen3_5",
|
"qwen3_5",
|
||||||
"qwen3_5_moe",
|
"qwen3_5_moe",
|
||||||
|
"intern_s2_preview",
|
||||||
):
|
):
|
||||||
mm_items, input_ids, ret = self.process_and_combine_mm_data(
|
mm_items, input_ids, ret = self.process_and_combine_mm_data(
|
||||||
base_output,
|
base_output,
|
||||||
|
|||||||
@@ -2231,6 +2231,7 @@ class ServerArgs:
|
|||||||
"Qwen3VLMoeForConditionalGeneration",
|
"Qwen3VLMoeForConditionalGeneration",
|
||||||
"Qwen3NextForCausalLM",
|
"Qwen3NextForCausalLM",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
]:
|
]:
|
||||||
if is_sm100_supported():
|
if is_sm100_supported():
|
||||||
@@ -2258,6 +2259,7 @@ class ServerArgs:
|
|||||||
if model_arch in [
|
if model_arch in [
|
||||||
"Qwen3NextForCausalLM",
|
"Qwen3NextForCausalLM",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
]:
|
]:
|
||||||
sm100_default_attn_backend = "triton"
|
sm100_default_attn_backend = "triton"
|
||||||
@@ -2386,6 +2388,7 @@ class ServerArgs:
|
|||||||
"Qwen3NextForCausalLM",
|
"Qwen3NextForCausalLM",
|
||||||
"KimiK25ForConditionalGeneration",
|
"KimiK25ForConditionalGeneration",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
]
|
]
|
||||||
and (is_sm90_supported() or is_sm100_supported())
|
and (is_sm90_supported() or is_sm100_supported())
|
||||||
@@ -3901,6 +3904,7 @@ class ServerArgs:
|
|||||||
"Qwen3VLMoeForConditionalGeneration",
|
"Qwen3VLMoeForConditionalGeneration",
|
||||||
"Qwen3_5ForConditionalGeneration",
|
"Qwen3_5ForConditionalGeneration",
|
||||||
"Qwen3_5MoeForConditionalGeneration",
|
"Qwen3_5MoeForConditionalGeneration",
|
||||||
|
"InternS2PreviewForConditionalGeneration",
|
||||||
"Qwen3OmniMoeForConditionalGeneration",
|
"Qwen3OmniMoeForConditionalGeneration",
|
||||||
"Qwen2AudioForConditionalGeneration",
|
"Qwen2AudioForConditionalGeneration",
|
||||||
"Qwen2_5OmniForConditionalGeneration",
|
"Qwen2_5OmniForConditionalGeneration",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ from sglang.srt.configs import (
|
|||||||
ExaoneConfig,
|
ExaoneConfig,
|
||||||
FalconH1Config,
|
FalconH1Config,
|
||||||
GraniteMoeHybridConfig,
|
GraniteMoeHybridConfig,
|
||||||
|
InternS2PreviewConfig,
|
||||||
JetNemotronConfig,
|
JetNemotronConfig,
|
||||||
JetVLMConfig,
|
JetVLMConfig,
|
||||||
KimiK25Config,
|
KimiK25Config,
|
||||||
@@ -96,6 +97,7 @@ _CONFIG_REGISTRY: Dict[str, Type[PretrainedConfig]] = {
|
|||||||
DeepseekVLV2Config,
|
DeepseekVLV2Config,
|
||||||
Qwen3_5Config,
|
Qwen3_5Config,
|
||||||
Qwen3_5MoeConfig,
|
Qwen3_5MoeConfig,
|
||||||
|
InternS2PreviewConfig,
|
||||||
JetNemotronConfig,
|
JetNemotronConfig,
|
||||||
JetVLMConfig,
|
JetVLMConfig,
|
||||||
KimiK25Config,
|
KimiK25Config,
|
||||||
|
|||||||
Reference in New Issue
Block a user