From a09aedf1ca5ebe62c9f9ad646c4819afc95d65b6 Mon Sep 17 00:00:00 2001 From: Cheng Wan <54331508+ch-wan@users.noreply.github.com> Date: Wed, 30 Sep 2026 13:27:11 -0700 Subject: [PATCH] [Refactor] Drop model placement attributes and parameters nothing reads (#41812) --- python/sglang/srt/models/afmoe.py | 1 - python/sglang/srt/models/bailing_moe.py | 7 ------- python/sglang/srt/models/bailing_moe_linear.py | 1 - python/sglang/srt/models/bailing_moe_nextn.py | 1 - python/sglang/srt/models/bailing_moe_v3.py | 4 ---- python/sglang/srt/models/dbrx.py | 2 -- python/sglang/srt/models/deepseek.py | 1 - python/sglang/srt/models/deepseek_nextn.py | 1 - python/sglang/srt/models/deepseek_v2.py | 1 - python/sglang/srt/models/dots3_common/modeling.py | 2 -- python/sglang/srt/models/dots3_common/nextn.py | 1 - python/sglang/srt/models/exaone4.py | 3 --- python/sglang/srt/models/exaone_moe.py | 4 ---- python/sglang/srt/models/exaone_moe_mtp.py | 1 - python/sglang/srt/models/gemma4_causal.py | 1 - python/sglang/srt/models/gigachat35.py | 1 - python/sglang/srt/models/gigachat35_mtp.py | 1 - python/sglang/srt/models/glm4_moe.py | 3 --- python/sglang/srt/models/glm4_moe_lite.py | 1 - python/sglang/srt/models/glm4_moe_lite_nextn.py | 1 - python/sglang/srt/models/glm4_moe_nextn.py | 1 - python/sglang/srt/models/glm4v_moe.py | 1 - python/sglang/srt/models/glm5_next.py | 2 -- python/sglang/srt/models/glm_ocr_nextn.py | 1 - python/sglang/srt/models/gpt_oss.py | 5 ----- python/sglang/srt/models/grok.py | 1 - python/sglang/srt/models/hunyuan_v3.py | 2 -- python/sglang/srt/models/interns2_mobius.py | 1 - python/sglang/srt/models/llada2.py | 7 ------- python/sglang/srt/models/llama4.py | 3 --- python/sglang/srt/models/longcat_flash.py | 4 ---- python/sglang/srt/models/longcat_flash_nextn.py | 5 +---- python/sglang/srt/models/mellum.py | 6 ------ python/sglang/srt/models/mimo_mtp.py | 2 -- python/sglang/srt/models/mimo_v2_nextn.py | 1 - python/sglang/srt/models/minimax_m3.py | 3 --- python/sglang/srt/models/mixtral.py | 1 - python/sglang/srt/models/moss_vl.py | 1 - python/sglang/srt/models/nemotron_h.py | 1 - python/sglang/srt/models/olmoe.py | 1 - python/sglang/srt/models/phimoe.py | 1 - python/sglang/srt/models/qwen2_5_vl.py | 1 - python/sglang/srt/models/qwen2_moe.py | 7 ------- python/sglang/srt/models/qwen3.py | 2 -- python/sglang/srt/models/qwen3_5_mtp.py | 1 - python/sglang/srt/models/qwen3_moe.py | 4 ---- python/sglang/srt/models/qwen3_moe_mtp.py | 1 - python/sglang/srt/models/qwen3_next_mtp.py | 1 - python/sglang/srt/models/qwen4_exp_mtp.py | 1 - python/sglang/srt/models/sdar.py | 1 - python/sglang/srt/models/sdar_moe.py | 1 - python/sglang/srt/models/step3_vl.py | 2 -- python/sglang/srt/models/step3p5.py | 8 -------- python/sglang/srt/models/step3p5_mtp.py | 2 -- python/sglang/srt/models/xllm.py | 4 ---- python/sglang/srt/models/xverse_moe.py | 1 - 56 files changed, 1 insertion(+), 124 deletions(-) diff --git a/python/sglang/srt/models/afmoe.py b/python/sglang/srt/models/afmoe.py index e21b3e47ce..0efd7cd11b 100644 --- a/python/sglang/srt/models/afmoe.py +++ b/python/sglang/srt/models/afmoe.py @@ -158,7 +158,6 @@ class AfmoeMoE(nn.Module): ): super().__init__() self.config = config - self.rank = get_parallel().tp_rank self.tp_size = get_parallel().tp_size self.n_routed_experts = getattr(config, "num_experts", None) diff --git a/python/sglang/srt/models/bailing_moe.py b/python/sglang/srt/models/bailing_moe.py index bc2de5dbbd..dbf9a32812 100644 --- a/python/sglang/srt/models/bailing_moe.py +++ b/python/sglang/srt/models/bailing_moe.py @@ -329,9 +329,6 @@ class BailingMoESparseMoeBlock(nn.Module): ) # dispatcher if get_moe_a2a_backend().is_deepep(): - # TODO: we will support tp < ep in the future - self.ep_size = get_parallel().tp_size - self.deepep_dispatcher = DeepEPDispatcher( group=get_parallel().tp_group.device_group, router_topk=self.top_k, @@ -509,7 +506,6 @@ class BailingMoEAttention(nn.Module): self.hidden_size = config.hidden_size self.total_num_heads = config.num_attention_heads self.total_kv_heads = config.num_key_value_heads - self.dp_size = get_parallel().attn_dp_size attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size @@ -652,7 +648,6 @@ class BailingMoEBlock(nn.Module): hidden_size = config.hidden_size self.input_layernorm = RMSNorm(hidden_size, eps=config.rms_norm_eps) - self.dp_size = get_parallel().attn_dp_size self.attention = BailingMoEAttention( config, layer_id, @@ -662,8 +657,6 @@ class BailingMoEBlock(nn.Module): alt_stream=alt_stream, ) self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank self.is_layer_sparse = self._is_layer_sparse( config, layer_id=layer_id, is_nextn=is_nextn diff --git a/python/sglang/srt/models/bailing_moe_linear.py b/python/sglang/srt/models/bailing_moe_linear.py index 8d87dcc342..762608bec5 100644 --- a/python/sglang/srt/models/bailing_moe_linear.py +++ b/python/sglang/srt/models/bailing_moe_linear.py @@ -246,7 +246,6 @@ class BailingMoE(nn.Module): self.layer_id = layer_id self.tp_size = get_parallel().tp_size - self.tp_rank = get_parallel().tp_rank self.top_k = config.num_experts_per_tok self.norm_expert_prob = getattr(config, "norm_topk_prob", False) diff --git a/python/sglang/srt/models/bailing_moe_nextn.py b/python/sglang/srt/models/bailing_moe_nextn.py index 583e869936..fa9d35b9ea 100644 --- a/python/sglang/srt/models/bailing_moe_nextn.py +++ b/python/sglang/srt/models/bailing_moe_nextn.py @@ -219,7 +219,6 @@ class BailingMoeForCausalLMNextN(nn.Module): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.num_fused_shared_experts = 0 is_bailing_moe_v3 = _is_bailing_moe_v3_config(config) diff --git a/python/sglang/srt/models/bailing_moe_v3.py b/python/sglang/srt/models/bailing_moe_v3.py index 279a11bf3a..34d1bcd39a 100644 --- a/python/sglang/srt/models/bailing_moe_v3.py +++ b/python/sglang/srt/models/bailing_moe_v3.py @@ -317,7 +317,6 @@ class BailingMLP(nn.Module): self.config = config self.swiglu_limit = swiglu_limit self.tp_size = tp_size if tp_size is not None else get_parallel().tp_size - self.tp_rank = tp_rank if tp_rank is not None else get_parallel().tp_rank self.intermediate_size = intermediate_size self.padded_intermediate_size = padded_intermediate_size or intermediate_size @@ -465,10 +464,8 @@ class BailingMoE(nn.Module): self.alt_stream = alt_stream self.tp_size = get_parallel().tp_size - self.tp_rank = get_parallel().tp_rank self.moe_ep_size = get_parallel().moe_ep_size self.moe_tp_size = get_parallel().moe_tp_size - self.moe_tp_rank = get_parallel().moe_tp_rank self.top_k = config.num_experts_per_tok self.norm_expert_prob = getattr(config, "norm_topk_prob", False) @@ -1425,7 +1422,6 @@ class BailingMoeV3ForCausalLM(nn.Module): self.pp_group = get_parallel().pp_group self.config = config self.quant_config = quant_config - self.tp_size = get_parallel().tp_size # Determine num_fused_shared_experts self.determine_num_fused_shared_experts() diff --git a/python/sglang/srt/models/dbrx.py b/python/sglang/srt/models/dbrx.py index 18037900be..8bfbf52de2 100644 --- a/python/sglang/srt/models/dbrx.py +++ b/python/sglang/srt/models/dbrx.py @@ -70,7 +70,6 @@ class DbrxRouter(nn.Module): prefix: str = "", ): super().__init__() - self.tp_size = get_parallel().tp_size self.num_total_experts = config.ffn_config.moe_num_experts self.d_model = config.d_model self.layer = ReplicatedLinear( @@ -244,7 +243,6 @@ class DbrxAttention(nn.Module): ) tp_world_size = get_parallel().tp_size - self.tp_size = tp_world_size assert self.total_num_heads % tp_world_size == 0 self.num_heads = self.total_num_heads // tp_world_size if self.total_num_kv_heads >= tp_world_size: diff --git a/python/sglang/srt/models/deepseek.py b/python/sglang/srt/models/deepseek.py index a28f2a0a4d..67ac59ba2e 100644 --- a/python/sglang/srt/models/deepseek.py +++ b/python/sglang/srt/models/deepseek.py @@ -115,7 +115,6 @@ class DeepseekMoE(nn.Module): ): super().__init__() self.config = config - self.rank = get_parallel().tp_rank self.tp_size = get_parallel().tp_size self.n_routed_experts = config.n_routed_experts self.top_k = config.num_experts_per_tok diff --git a/python/sglang/srt/models/deepseek_nextn.py b/python/sglang/srt/models/deepseek_nextn.py index fc8e3d428b..6a71ee2c6f 100644 --- a/python/sglang/srt/models/deepseek_nextn.py +++ b/python/sglang/srt/models/deepseek_nextn.py @@ -277,7 +277,6 @@ class DeepseekV3ForCausalLMNextN(DeepseekV3ForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config # if not set, model load will be broken in DeepseekV3ForCausalLM load_weights() self.pp_group = get_parallel().pp_group diff --git a/python/sglang/srt/models/deepseek_v2.py b/python/sglang/srt/models/deepseek_v2.py index dc94bd60b4..3550446f43 100644 --- a/python/sglang/srt/models/deepseek_v2.py +++ b/python/sglang/srt/models/deepseek_v2.py @@ -3241,7 +3241,6 @@ class DeepseekV2ForCausalLM(nn.Module, DeepseekV2WeightLoaderMixin): self.pp_group = get_parallel().pp_group self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.determine_num_fused_shared_experts() self.use_dsa = is_deepseek_dsa(config) diff --git a/python/sglang/srt/models/dots3_common/modeling.py b/python/sglang/srt/models/dots3_common/modeling.py index 181ec5a30b..bc7455878a 100644 --- a/python/sglang/srt/models/dots3_common/modeling.py +++ b/python/sglang/srt/models/dots3_common/modeling.py @@ -1834,7 +1834,6 @@ class Dots3LanguageModelForCausalLM(nn.Module): self.pp_group = get_parallel().pp_group self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.determine_num_fused_shared_experts() self.model = Dots3Model( @@ -2716,7 +2715,6 @@ class DotsNoteOmniForConditionalGeneration(nn.Module): ) language_model = self.thinker.language_model self.pp_group = language_model.pp_group - self.tp_size = language_model.tp_size self.quant_config = language_model.quant_config self.num_fused_shared_experts = language_model.num_fused_shared_experts self.forward = self.thinker.forward diff --git a/python/sglang/srt/models/dots3_common/nextn.py b/python/sglang/srt/models/dots3_common/nextn.py index af8854c49b..073f9fc758 100644 --- a/python/sglang/srt/models/dots3_common/nextn.py +++ b/python/sglang/srt/models/dots3_common/nextn.py @@ -146,7 +146,6 @@ class Dots3NoteForCausalLMNextN(Dots3LanguageModelForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group self.fuse_qkv_a_g_proj = True diff --git a/python/sglang/srt/models/exaone4.py b/python/sglang/srt/models/exaone4.py index 63181fe632..736290257f 100644 --- a/python/sglang/srt/models/exaone4.py +++ b/python/sglang/srt/models/exaone4.py @@ -244,9 +244,6 @@ class Exaone4DecoderLayer(nn.Module): max_position_embeddings = getattr(config, "max_position_embeddings", 8192) - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - self.self_attn = Exaone4Attention( config=config, hidden_size=self.hidden_size, diff --git a/python/sglang/srt/models/exaone_moe.py b/python/sglang/srt/models/exaone_moe.py index 01a488b7e8..41c1ce289b 100755 --- a/python/sglang/srt/models/exaone_moe.py +++ b/python/sglang/srt/models/exaone_moe.py @@ -134,7 +134,6 @@ class ExaoneMoESparseMoEBlock(nn.Module): ): super().__init__() self.tp_size = get_parallel().tp_size - self.moe_ep_size = get_parallel().moe_ep_size self.layer_id = layer_id self.routed_scaling_factor = config.routed_scaling_factor self.alt_stream = alt_stream @@ -200,7 +199,6 @@ class ExaoneMoESparseMoEBlock(nn.Module): ) if get_moe_a2a_backend().is_deepep(): - self.ep_size = get_parallel().moe_ep_size self.num_experts = ( config.num_experts + get_exec().moe.ep_num_redundant_experts ) @@ -450,8 +448,6 @@ class ExaoneMoEDecoderLayer(nn.Module): attention_bias = getattr(config, "attention_bias", False) or getattr( config, "bias", False ) - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank self.self_attn = ExaoneMoEAttention( config=config, diff --git a/python/sglang/srt/models/exaone_moe_mtp.py b/python/sglang/srt/models/exaone_moe_mtp.py index 92bce030c2..2ff69d0890 100644 --- a/python/sglang/srt/models/exaone_moe_mtp.py +++ b/python/sglang/srt/models/exaone_moe_mtp.py @@ -45,7 +45,6 @@ class ExaoneMoEForCausalLMMTP(ExaoneMoEForCausalLM): nn.Module.__init__(self) self.config = config config.num_hidden_layers = 1 - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group diff --git a/python/sglang/srt/models/gemma4_causal.py b/python/sglang/srt/models/gemma4_causal.py index eec706fd6b..67b6c87a3c 100644 --- a/python/sglang/srt/models/gemma4_causal.py +++ b/python/sglang/srt/models/gemma4_causal.py @@ -224,7 +224,6 @@ class Gemma4MoE(nn.Module): self.layer_id = layer_id self.hidden_size = hidden_size self.num_experts = config.num_experts - self.tp_size = get_parallel().tp_size # Per-expert output scale folded into routing weights so that # MoE's fused kernel computes: Σ_e (expert_e * w_e * scale_e) diff --git a/python/sglang/srt/models/gigachat35.py b/python/sglang/srt/models/gigachat35.py index d8dd46a659..5e6c66063e 100644 --- a/python/sglang/srt/models/gigachat35.py +++ b/python/sglang/srt/models/gigachat35.py @@ -598,7 +598,6 @@ class GigaChat35ForCausalLM(DeepseekV2WeightLoaderMixin, nn.Module): self.config = config self.quant_config = quant_config self.pp_group = get_parallel().pp_group - self.tp_size = get_parallel().tp_size self.num_fused_shared_experts = 0 self.model = GigaChat35Model( diff --git a/python/sglang/srt/models/gigachat35_mtp.py b/python/sglang/srt/models/gigachat35_mtp.py index 3d376f9651..3942183396 100644 --- a/python/sglang/srt/models/gigachat35_mtp.py +++ b/python/sglang/srt/models/gigachat35_mtp.py @@ -141,7 +141,6 @@ class GigaChat35ForCausalLMNextN(DeepseekV2WeightLoaderMixin, nn.Module): self.config = config self.quant_config = quant_config self.pp_group = get_parallel().pp_group - self.tp_size = get_parallel().tp_size self.num_fused_shared_experts = 0 self.draft_model_idx = draft_model_idx or 0 diff --git a/python/sglang/srt/models/glm4_moe.py b/python/sglang/srt/models/glm4_moe.py index b09c3e7031..152d95b8fb 100644 --- a/python/sglang/srt/models/glm4_moe.py +++ b/python/sglang/srt/models/glm4_moe.py @@ -258,7 +258,6 @@ class Glm4MoeAttention(nn.Module): self.rope_theta = rope_theta self.use_qk_norm = use_qk_norm self.max_position_embeddings = max_position_embeddings - self.tp_rank = get_parallel().tp_rank self.qkv_proj = QKVParallelLinear( hidden_size, @@ -431,7 +430,6 @@ class Glm4MoeSparseMoeBlock(nn.Module): nn.Module.__init__(self) self.top_k = config.num_experts_per_tok self.tp_size = get_parallel().tp_size - self.moe_ep_size = get_parallel().moe_ep_size self.routed_scaling_factor = config.routed_scaling_factor self.n_shared_experts = config.n_shared_experts self.num_fused_shared_experts = ( @@ -1141,7 +1139,6 @@ class Glm4MoeForCausalLM(nn.Module): nn.Module.__init__(self) self.pp_group = get_parallel().pp_group self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.num_fused_shared_experts = 0 self.determine_num_fused_shared_experts() diff --git a/python/sglang/srt/models/glm4_moe_lite.py b/python/sglang/srt/models/glm4_moe_lite.py index 7e9fc19e8a..5b756dd154 100644 --- a/python/sglang/srt/models/glm4_moe_lite.py +++ b/python/sglang/srt/models/glm4_moe_lite.py @@ -850,7 +850,6 @@ class Glm4MoeLiteForCausalLM(nn.Module, DeepseekV2WeightLoaderMixin): super().__init__() config.moe_layer_freq = 1 self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group self.determine_num_fused_shared_experts() diff --git a/python/sglang/srt/models/glm4_moe_lite_nextn.py b/python/sglang/srt/models/glm4_moe_lite_nextn.py index 9ecd58cc5d..e0baf64600 100644 --- a/python/sglang/srt/models/glm4_moe_lite_nextn.py +++ b/python/sglang/srt/models/glm4_moe_lite_nextn.py @@ -142,7 +142,6 @@ class Glm4MoeLiteForCausalLMNextN(Glm4MoeLiteForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size if is_npu() and get_spec().speculative_draft_model_quantization is None: quant_config = None self.quant_config = quant_config diff --git a/python/sglang/srt/models/glm4_moe_nextn.py b/python/sglang/srt/models/glm4_moe_nextn.py index f6b3ab0510..83d438e067 100644 --- a/python/sglang/srt/models/glm4_moe_nextn.py +++ b/python/sglang/srt/models/glm4_moe_nextn.py @@ -123,7 +123,6 @@ class Glm4MoeForCausalLMNextN(Glm4MoeForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size if is_npu() and get_spec().speculative_draft_model_quantization is None: quant_config = None self.quant_config = quant_config diff --git a/python/sglang/srt/models/glm4v_moe.py b/python/sglang/srt/models/glm4v_moe.py index 6acc2789ad..842cf52e4e 100644 --- a/python/sglang/srt/models/glm4v_moe.py +++ b/python/sglang/srt/models/glm4v_moe.py @@ -43,7 +43,6 @@ class Glm4vMoeForConditionalGeneration(Glm4vForConditionalGeneration): self.config = config self.use_data_parallel = get_mm().mm_enable_dp_encoder vision_utils.update_vit_attn_dummy_heads_config(self.config) - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.num_fused_shared_experts = 0 self.determine_num_fused_shared_experts() diff --git a/python/sglang/srt/models/glm5_next.py b/python/sglang/srt/models/glm5_next.py index ca7c54ee93..dcec3b62d6 100644 --- a/python/sglang/srt/models/glm5_next.py +++ b/python/sglang/srt/models/glm5_next.py @@ -391,7 +391,6 @@ class Glm5NextLinearAttention(nn.Module): **kwargs, ) -> None: super().__init__() - self.tp_size = get_parallel().tp_size head_shard_size = get_parallel().attn_tp_size head_shard_rank = get_parallel().attn_tp_rank _head_shard_rank_getter = partial(getattr, get_parallel(), "attn_tp_rank") @@ -1237,7 +1236,6 @@ class Glm5NextForConditionalGeneration(nn.Module): self.pp_group = get_parallel().pp_group self.config = text_config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.use_dsa = is_deepseek_dsa(text_config) self.num_fused_shared_experts = 0 diff --git a/python/sglang/srt/models/glm_ocr_nextn.py b/python/sglang/srt/models/glm_ocr_nextn.py index 3f877be607..2a7123425e 100644 --- a/python/sglang/srt/models/glm_ocr_nextn.py +++ b/python/sglang/srt/models/glm_ocr_nextn.py @@ -137,7 +137,6 @@ class GlmOcrForConditionalGenerationNextN(GlmOcrForConditionalGeneration): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config _, rope_scaling = get_rope_config(config) self.is_mrope_enabled = "mrope_section" in (rope_scaling or {}) diff --git a/python/sglang/srt/models/gpt_oss.py b/python/sglang/srt/models/gpt_oss.py index 8537db66cd..9f06a30ec7 100644 --- a/python/sglang/srt/models/gpt_oss.py +++ b/python/sglang/srt/models/gpt_oss.py @@ -209,7 +209,6 @@ class GptOssSparseMoeBlock(nn.Module): prefix: str = "", ): super().__init__() - self.tp_size = get_parallel().tp_size self.layer_id = layer_id self.hidden_size = config.hidden_size self.activation = config.hidden_act @@ -408,7 +407,6 @@ class GptOssAttention(nn.Module): self.scaling = self.head_dim**-0.5 self.rope_theta = rope_theta self.max_position_embeddings = max_position_embeddings - self.tp_rank = get_parallel().tp_rank self.qkv_proj = QKVParallelLinear( hidden_size, @@ -563,9 +561,6 @@ class GptOssDecoderLayer(nn.Module): self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - # GptOss all layers are sparse self.is_layer_sparse = True is_previous_layer_sparse = True diff --git a/python/sglang/srt/models/grok.py b/python/sglang/srt/models/grok.py index 34a43ef9db..0db1c82979 100644 --- a/python/sglang/srt/models/grok.py +++ b/python/sglang/srt/models/grok.py @@ -118,7 +118,6 @@ class Grok1MoE(nn.Module): intermediate_size: int, params_dtype: Optional[torch.dtype] = None, quant_config: Optional[QuantizationConfig] = None, - tp_size: Optional[int] = None, reduce_results: bool = True, use_presharded_weights: bool = False, inplace: bool = True, diff --git a/python/sglang/srt/models/hunyuan_v3.py b/python/sglang/srt/models/hunyuan_v3.py index 7312e38625..fe61d554c2 100644 --- a/python/sglang/srt/models/hunyuan_v3.py +++ b/python/sglang/srt/models/hunyuan_v3.py @@ -95,8 +95,6 @@ class HYV3MoEFused(nn.Module): alt_stream: Optional[torch.cuda.Stream] = None, ): super().__init__() - self.tp_size = get_parallel().moe_tp_size - self.ep_size = get_parallel().moe_ep_size self.layer_id = layer_id self.alt_stream = alt_stream self.n_routed_experts = config.num_experts diff --git a/python/sglang/srt/models/interns2_mobius.py b/python/sglang/srt/models/interns2_mobius.py index 331336351b..371215e059 100644 --- a/python/sglang/srt/models/interns2_mobius.py +++ b/python/sglang/srt/models/interns2_mobius.py @@ -323,7 +323,6 @@ class InternS2MobiusRoutedExpertBank(nn.Module): ) -> None: super().__init__() self.bank_id = bank_id - self.tp_size = get_parallel().tp_size self.num_experts = config.num_experts self.topk = TopK( top_k=config.num_experts_per_tok, diff --git a/python/sglang/srt/models/llada2.py b/python/sglang/srt/models/llada2.py index a36e3708c0..5c36c9dc65 100644 --- a/python/sglang/srt/models/llada2.py +++ b/python/sglang/srt/models/llada2.py @@ -303,9 +303,6 @@ class LLaDA2MoeSparseMoeBlock(nn.Module): ) # dispatcher if get_moe_a2a_backend().is_deepep(): - # TODO: we will support tp < ep in the future - self.ep_size = get_parallel().tp_size - self.deepep_dispatcher = DeepEPDispatcher( group=get_parallel().tp_group.device_group, router_topk=self.top_k, @@ -432,7 +429,6 @@ class LLaDA2MoeAttention(nn.Module): self.hidden_size = config.hidden_size self.total_num_heads = config.num_attention_heads self.total_kv_heads = config.num_key_value_heads - self.dp_size = get_parallel().attn_dp_size attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size @@ -598,7 +594,6 @@ class LLaDA2MoeBlock(nn.Module): hidden_size = config.hidden_size self.input_layernorm = RMSNorm(hidden_size, eps=config.rms_norm_eps) - self.dp_size = get_parallel().attn_dp_size self.attention = LLaDA2MoeAttention( config, layer_id, @@ -608,8 +603,6 @@ class LLaDA2MoeBlock(nn.Module): alt_stream=alt_stream, ) self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank self.is_layer_sparse = self._is_layer_sparse(config, layer_id=layer_id) is_previous_layer_sparse = self._is_layer_sparse(config, layer_id=layer_id - 1) diff --git a/python/sglang/srt/models/llama4.py b/python/sglang/srt/models/llama4.py index 97ac09ce48..a8f7a19aa1 100644 --- a/python/sglang/srt/models/llama4.py +++ b/python/sglang/srt/models/llama4.py @@ -98,7 +98,6 @@ class Llama4MoE(nn.Module): prefix: str = "", ): super().__init__() - self.tp_size = get_parallel().tp_size self.top_k = config.num_experts_per_tok self.device_module = torch.get_device_module() @@ -385,8 +384,6 @@ class Llama4DecoderLayer(nn.Module): rope_theta = config.rope_parameters["rope_theta"] rope_scaling = config.rope_parameters max_position_embeddings = config.max_position_embeddings - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank self.self_attn = Llama4Attention( config=config, diff --git a/python/sglang/srt/models/longcat_flash.py b/python/sglang/srt/models/longcat_flash.py index a176ca84df..0199ff3052 100644 --- a/python/sglang/srt/models/longcat_flash.py +++ b/python/sglang/srt/models/longcat_flash.py @@ -428,9 +428,6 @@ class LongcatFlashDecoderLayer(nn.Module): prefix=add_prefix("mlp", prefix), ) - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - self.attn_boundary, self.moe_boundary = make_stages( ( declare_attn(), @@ -676,7 +673,6 @@ class LongcatFlashForCausalLM(nn.Module): ] self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.model = LongcatFlashModel( config, quant_config, prefix=add_prefix("model", prefix) diff --git a/python/sglang/srt/models/longcat_flash_nextn.py b/python/sglang/srt/models/longcat_flash_nextn.py index 28ab746ed2..12ee1678ee 100644 --- a/python/sglang/srt/models/longcat_flash_nextn.py +++ b/python/sglang/srt/models/longcat_flash_nextn.py @@ -73,7 +73,7 @@ from sglang.srt.model_loader.utils import should_deepgemm_weight_requant_ue8m0 from sglang.srt.model_loader.weight_utils import default_weight_loader from sglang.srt.models.deepseek_v2 import DeepseekV2AttentionMLA from sglang.srt.models.longcat_flash import LongcatFlashForCausalLM, LongcatFlashMLP -from sglang.srt.runtime_context import get_parallel, get_stream +from sglang.srt.runtime_context import get_stream from sglang.srt.utils import ( BumpAllocator, add_prefix, @@ -162,9 +162,6 @@ class LongcatFlashDenseDecoderLayer(nn.Module): config.hidden_size, eps=config.rms_norm_eps ) - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - self.attn_boundary, self.ffn_boundary = make_stages( (declare_attn(), self.input_layernorm), ( diff --git a/python/sglang/srt/models/mellum.py b/python/sglang/srt/models/mellum.py index 607e089b5c..4b569f63d1 100644 --- a/python/sglang/srt/models/mellum.py +++ b/python/sglang/srt/models/mellum.py @@ -187,8 +187,6 @@ class MellumAttention(Qwen3MoeAttention): self.rope_theta = rope_params.get("rope_theta", 10000.0) rope_scaling = rope_params if _get_rope_type(rope_params) != "default" else None - self.tp_rank = get_parallel().tp_rank - self.qkv_proj = QKVParallelLinear( hidden_size, self.head_dim, @@ -398,9 +396,6 @@ class MellumDecoderLayer(Qwen3MoeDecoderLayer): alt_stream=alt_stream, ) - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - mlp_layer_types = cfg.mlp_layer_types num_experts = cfg.num_experts @@ -530,7 +525,6 @@ class MellumForCausalLM(Qwen3MoeForCausalLM): self.capture_aux_hidden_states = False self.attn_cp_size = get_parallel().attn_cp_size - self.attn_cp_rank = get_parallel().attn_cp_rank self.moe_dp_size = get_parallel().moe_dp_size assert self.attn_cp_size % self.moe_dp_size == 0, ( diff --git a/python/sglang/srt/models/mimo_mtp.py b/python/sglang/srt/models/mimo_mtp.py index b0dade2377..6910e123b1 100644 --- a/python/sglang/srt/models/mimo_mtp.py +++ b/python/sglang/srt/models/mimo_mtp.py @@ -19,7 +19,6 @@ from sglang.srt.model_executor.forward_batch_info import ForwardBatch from sglang.srt.model_loader.weight_utils import default_weight_loader from sglang.srt.models.qwen2 import Qwen2DecoderLayer from sglang.srt.platforms import current_platform -from sglang.srt.runtime_context import get_parallel class MiMoMultiTokenPredictorLayer(nn.Module): @@ -90,7 +89,6 @@ class MiMoMTP(nn.Module): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.model = MiMoMultiTokenPredictorLayer( diff --git a/python/sglang/srt/models/mimo_v2_nextn.py b/python/sglang/srt/models/mimo_v2_nextn.py index 7916103349..57ae19213a 100644 --- a/python/sglang/srt/models/mimo_v2_nextn.py +++ b/python/sglang/srt/models/mimo_v2_nextn.py @@ -252,7 +252,6 @@ class MiMoV2MTP(MiMoV2ForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.model = MiMoV2ModelNextN( diff --git a/python/sglang/srt/models/minimax_m3.py b/python/sglang/srt/models/minimax_m3.py index 22345e1224..1d7ff25a39 100644 --- a/python/sglang/srt/models/minimax_m3.py +++ b/python/sglang/srt/models/minimax_m3.py @@ -163,7 +163,6 @@ class MultiHeadRMSNorm(nn.Module): ) -> None: super().__init__() self.tp_world = get_parallel().attn_tp_size - self.tp_rank = get_parallel().attn_tp_rank self.num_heads = num_heads self.num_heads_per_tp = num_heads // self.tp_world self.head_dim = head_dim @@ -422,7 +421,6 @@ class MiniMaxM3MoE(nn.Module): self.layer_id = layer_id if get_moe_a2a_backend().is_deepep(): - self.ep_size = get_parallel().moe_ep_size self.top_k = config.num_experts_per_tok @staticmethod @@ -564,7 +562,6 @@ class MiniMaxM3Attention(nn.Module): attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size self.attn_tp_size = attn_tp_size - self.attn_tp_rank = attn_tp_rank self.total_num_heads = config.num_attention_heads assert self.total_num_heads % attn_tp_size == 0 diff --git a/python/sglang/srt/models/mixtral.py b/python/sglang/srt/models/mixtral.py index 3c0bf0d291..929c13511d 100644 --- a/python/sglang/srt/models/mixtral.py +++ b/python/sglang/srt/models/mixtral.py @@ -77,7 +77,6 @@ class MixtralMoE(nn.Module): layer_id: int, params_dtype: Optional[torch.dtype] = None, quant_config: Optional[QuantizationConfig] = None, - tp_size: Optional[int] = None, prefix: str = "", ): super().__init__() diff --git a/python/sglang/srt/models/moss_vl.py b/python/sglang/srt/models/moss_vl.py index c224061566..664c15df6c 100644 --- a/python/sglang/srt/models/moss_vl.py +++ b/python/sglang/srt/models/moss_vl.py @@ -894,7 +894,6 @@ class MossVLSelfAttention(nn.Module): ): super().__init__() self.hidden_size = config.hidden_size - self.tp_size = get_parallel().tp_size self.total_num_heads = config.num_attention_heads attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size diff --git a/python/sglang/srt/models/nemotron_h.py b/python/sglang/srt/models/nemotron_h.py index 3440b01f0d..abb75a27c0 100644 --- a/python/sglang/srt/models/nemotron_h.py +++ b/python/sglang/srt/models/nemotron_h.py @@ -174,7 +174,6 @@ class NemotronHMoE(nn.Module): ) -> None: super().__init__() - self.tp_size = get_parallel().tp_size self.routed_scaling_factor = config.routed_scaling_factor self.device_module = torch.get_device_module() diff --git a/python/sglang/srt/models/olmoe.py b/python/sglang/srt/models/olmoe.py index ec0c2ece48..ac97c72996 100644 --- a/python/sglang/srt/models/olmoe.py +++ b/python/sglang/srt/models/olmoe.py @@ -64,7 +64,6 @@ class OlmoeMoE(nn.Module): intermediate_size: int, params_dtype: Optional[torch.dtype] = None, quant_config: Optional[QuantizationConfig] = None, - tp_size: Optional[int] = None, layer_id: int = 0, prefix: str = "", ): diff --git a/python/sglang/srt/models/phimoe.py b/python/sglang/srt/models/phimoe.py index e7e5f43426..f5cd3a0011 100644 --- a/python/sglang/srt/models/phimoe.py +++ b/python/sglang/srt/models/phimoe.py @@ -188,7 +188,6 @@ class PhiMoE(nn.Module): ): super().__init__() self.hidden_size = hidden_size - self.tp_size = get_parallel().tp_size # Gate always runs at half / full precision for now. self.gate = ReplicatedLinear( diff --git a/python/sglang/srt/models/qwen2_5_vl.py b/python/sglang/srt/models/qwen2_5_vl.py index 1003b7f66c..b0575a7242 100644 --- a/python/sglang/srt/models/qwen2_5_vl.py +++ b/python/sglang/srt/models/qwen2_5_vl.py @@ -430,7 +430,6 @@ class Qwen2_5_VisionTransformer(nn.Module, RotaryPosMixin): ) # Resource prepared for vit cuda graph - self.tp_size = 1 if use_data_parallel else get_parallel().tp_size self.max_context_len = max_context_len self.enable_cg = _is_cuda and envs.SGLANG_VIT_ENABLE_CUDA_GRAPH.get() diff --git a/python/sglang/srt/models/qwen2_moe.py b/python/sglang/srt/models/qwen2_moe.py index 4c9dbdba9f..10284a3620 100644 --- a/python/sglang/srt/models/qwen2_moe.py +++ b/python/sglang/srt/models/qwen2_moe.py @@ -394,8 +394,6 @@ class Qwen2MoeSparseMoeBlock(nn.Module): or get_moe_a2a_backend().is_deepep_v2() or get_moe_a2a_backend().is_mori() ): - # TODO: we will support tp < ep in the future - self.ep_size = get_parallel().moe_ep_size self.num_experts = ( config.num_experts + get_exec().moe.ep_num_redundant_experts ) @@ -1025,9 +1023,6 @@ class Qwen2MoeDecoderLayer(nn.Module): self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - # Qwen2MoE all layers are sparse and have no nextn now self.is_layer_sparse = True is_previous_layer_sparse = True @@ -1117,8 +1112,6 @@ class Qwen2MoeModel(nn.Module): self.vocab_size = config.vocab_size self.pp_group = get_parallel().pp_group - self.moe_dp_size = get_parallel().moe_dp_size - if self.pp_group.is_first_rank: self.embed_tokens = VocabParallelEmbedding( config.vocab_size, diff --git a/python/sglang/srt/models/qwen3.py b/python/sglang/srt/models/qwen3.py index 743232dc38..97a40f1604 100644 --- a/python/sglang/srt/models/qwen3.py +++ b/python/sglang/srt/models/qwen3.py @@ -85,7 +85,6 @@ class Qwen3Attention(nn.Module): super().__init__() self.hidden_size = hidden_size self.start_layer = start_layer - self.tp_size = get_parallel().tp_size self.total_num_heads = num_heads attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size @@ -108,7 +107,6 @@ class Qwen3Attention(nn.Module): self.scaling = self.head_dim**-0.5 self.rope_theta = rope_theta self.max_position_embeddings = max_position_embeddings - self.tp_rank = get_parallel().tp_rank norm_kwargs = ( dict( diff --git a/python/sglang/srt/models/qwen3_5_mtp.py b/python/sglang/srt/models/qwen3_5_mtp.py index b90d6f728c..e3450be475 100644 --- a/python/sglang/srt/models/qwen3_5_mtp.py +++ b/python/sglang/srt/models/qwen3_5_mtp.py @@ -123,7 +123,6 @@ class Qwen3_5ForCausalLMMTP(nn.Module): quant_config = _mtp_quant_config(quant_config) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group diff --git a/python/sglang/srt/models/qwen3_moe.py b/python/sglang/srt/models/qwen3_moe.py index 334ab2904b..159e74e973 100644 --- a/python/sglang/srt/models/qwen3_moe.py +++ b/python/sglang/srt/models/qwen3_moe.py @@ -535,7 +535,6 @@ class Qwen3MoeAttention(nn.Module): self.scaling = self.head_dim**-0.5 self.rope_theta = rope_theta self.max_position_embeddings = max_position_embeddings - self.tp_rank = get_parallel().tp_rank self.qkv_proj = QKVParallelLinear( hidden_size, @@ -838,9 +837,6 @@ class Qwen3MoeDecoderLayer(nn.Module): self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - # Qwen3MoE all layers are sparse and have no nextn now self.is_layer_sparse = True is_previous_layer_sparse = True diff --git a/python/sglang/srt/models/qwen3_moe_mtp.py b/python/sglang/srt/models/qwen3_moe_mtp.py index c401c2e1f7..3c5429fe74 100644 --- a/python/sglang/srt/models/qwen3_moe_mtp.py +++ b/python/sglang/srt/models/qwen3_moe_mtp.py @@ -45,7 +45,6 @@ class Qwen3MoeForCausalLMMTP(Qwen3MoeForCausalLM): nn.Module.__init__(self) self.config = config config.num_hidden_layers = 1 - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group diff --git a/python/sglang/srt/models/qwen3_next_mtp.py b/python/sglang/srt/models/qwen3_next_mtp.py index b7c2cb90a5..4a1bc3ac92 100644 --- a/python/sglang/srt/models/qwen3_next_mtp.py +++ b/python/sglang/srt/models/qwen3_next_mtp.py @@ -48,7 +48,6 @@ class Qwen3NextForCausalLMMTP(Qwen3NextForCausalLM): # Deep-copy so MTP mutations below don't leak into the target's config. config = copy.deepcopy(config) self.config = config - self.tp_size = get_parallel().tp_size if is_npu() and get_spec().speculative_draft_model_quantization is None: quant_config = None self.quant_config = quant_config diff --git a/python/sglang/srt/models/qwen4_exp_mtp.py b/python/sglang/srt/models/qwen4_exp_mtp.py index 103e1600d3..b32326bd4b 100644 --- a/python/sglang/srt/models/qwen4_exp_mtp.py +++ b/python/sglang/srt/models/qwen4_exp_mtp.py @@ -47,7 +47,6 @@ class Qwen4ExpForCausalLMMTP(Qwen3_5ForCausalLMMTP): quant_config = _mtp_quant_config(quant_config) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.pp_group = get_parallel().pp_group self.hidden_size = config.hidden_size diff --git a/python/sglang/srt/models/sdar.py b/python/sglang/srt/models/sdar.py index e4b8bef30a..7f2c44d089 100644 --- a/python/sglang/srt/models/sdar.py +++ b/python/sglang/srt/models/sdar.py @@ -99,7 +99,6 @@ class SDARAttention(nn.Module): self.layer_id = layer_id self.hidden_size = config.hidden_size self.total_num_heads = config.num_attention_heads - self.tp_size = get_parallel().tp_size attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size diff --git a/python/sglang/srt/models/sdar_moe.py b/python/sglang/srt/models/sdar_moe.py index d541d15132..c3ad34905a 100644 --- a/python/sglang/srt/models/sdar_moe.py +++ b/python/sglang/srt/models/sdar_moe.py @@ -117,7 +117,6 @@ class SDARMoeSparseMoeBlock(nn.Module): # Deepep / FuseEP support if get_moe_a2a_backend().is_deepep(): - self.ep_size = get_parallel().moe_ep_size self.num_experts = ( config.num_experts + get_exec().moe.ep_num_redundant_experts ) diff --git a/python/sglang/srt/models/step3_vl.py b/python/sglang/srt/models/step3_vl.py index 64aef10e5a..ab1ffc4c46 100644 --- a/python/sglang/srt/models/step3_vl.py +++ b/python/sglang/srt/models/step3_vl.py @@ -192,9 +192,7 @@ class Step3TextAttention(nn.Module): attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size - self.all_tp_rank = get_parallel().tp_rank self.total_num_heads = num_heads - self.attn_tp_rank = attn_tp_rank self.layer_id = layer_id assert self.total_num_heads % attn_tp_size == 0 self.num_heads = self.total_num_heads // attn_tp_size diff --git a/python/sglang/srt/models/step3p5.py b/python/sglang/srt/models/step3p5.py index 5c71088dbf..f4ab59d4b6 100644 --- a/python/sglang/srt/models/step3p5.py +++ b/python/sglang/srt/models/step3p5.py @@ -64,8 +64,6 @@ class Step3p5MLP(nn.Module): swiglu_limit: Optional[float] = None, quant_config: Optional[QuantizationConfig] = None, prefix: str = "", - tp_size: Optional[int] = None, - tp_rank: Optional[int] = None, reduce_results: bool = True, ) -> None: super().__init__() @@ -77,8 +75,6 @@ class Step3p5MLP(nn.Module): bias=False, quant_config=quant_config, prefix=add_prefix("gate_up_proj", prefix), - tp_size=tp_size, - tp_rank=tp_rank, ) self.down_proj = RowParallelLinear( intermediate_size, @@ -86,8 +82,6 @@ class Step3p5MLP(nn.Module): bias=False, quant_config=quant_config, prefix=add_prefix("down_proj", prefix), - tp_size=tp_size, - tp_rank=tp_rank, reduce_results=reduce_results, ) self.act_fn = SiluAndMul() @@ -349,7 +343,6 @@ class Step3p5Attention(nn.Module): ) -> None: super().__init__() self.hidden_size = hidden_size - self.tp_size = get_parallel().tp_size self.total_num_heads = num_heads attn_tp_rank = get_parallel().attn_tp_rank attn_tp_size = get_parallel().attn_tp_size @@ -372,7 +365,6 @@ class Step3p5Attention(nn.Module): self.scaling = self.head_dim**-0.5 self.rope_theta = rope_theta self.max_position_embeddings = max_position_embeddings - self.tp_rank = get_parallel().tp_rank self.q_norm = GemmaRMSNorm(self.head_dim, eps=rms_norm_eps) self.k_norm = GemmaRMSNorm(self.head_dim, eps=rms_norm_eps) diff --git a/python/sglang/srt/models/step3p5_mtp.py b/python/sglang/srt/models/step3p5_mtp.py index 72411024bd..388ed66f8c 100644 --- a/python/sglang/srt/models/step3p5_mtp.py +++ b/python/sglang/srt/models/step3p5_mtp.py @@ -17,7 +17,6 @@ from sglang.srt.layers.vocab_parallel_embedding import ( from sglang.srt.model_executor.forward_batch_info import ForwardBatch from sglang.srt.model_loader.weight_utils import default_weight_loader from sglang.srt.models.step3p5 import Step3p5DecoderLayer, Step3p5ForCausalLM -from sglang.srt.runtime_context import get_parallel from sglang.srt.utils import add_prefix logger = logging.getLogger(__name__) @@ -151,7 +150,6 @@ class Step3p5MTP(Step3p5ForCausalLM): ) -> None: nn.Module.__init__(self) self.config = config - self.tp_size = get_parallel().tp_size self.quant_config = quant_config self.draft_model_idx = draft_model_idx diff --git a/python/sglang/srt/models/xllm.py b/python/sglang/srt/models/xllm.py index 1e749b851e..8ff619b703 100644 --- a/python/sglang/srt/models/xllm.py +++ b/python/sglang/srt/models/xllm.py @@ -969,7 +969,6 @@ class XllmSparseMoeBlock(nn.Module): self.shared_experts = None if get_moe_a2a_backend().is_deepep() or get_moe_a2a_backend().is_mori(): - self.ep_size = get_parallel().moe_ep_size self.num_experts = ( config.num_experts + get_exec().moe.ep_num_redundant_experts ) @@ -1448,9 +1447,6 @@ class XllmDecoderLayer(nn.Module): self.layer_id = layer_id - self.attn_tp_size = get_parallel().attn_tp_size - self.attn_tp_rank = get_parallel().attn_tp_rank - # Determine if this layer is sparse (MoE) or dense mlp_only_layers = getattr(config, "mlp_only_layers", []) decoder_sparse_step = getattr(config, "decoder_sparse_step", 1) diff --git a/python/sglang/srt/models/xverse_moe.py b/python/sglang/srt/models/xverse_moe.py index 6dcb4e1320..81029f308c 100644 --- a/python/sglang/srt/models/xverse_moe.py +++ b/python/sglang/srt/models/xverse_moe.py @@ -100,7 +100,6 @@ class XverseMoE(nn.Module): ): super().__init__() self.config = config - self.rank = get_parallel().tp_rank self.tp_size = get_parallel().tp_size self.n_routed_experts = config.num_experts self.top_k = config.moe_top_k