Skip to content
Merged
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
1 change: 0 additions & 1 deletion python/sglang/srt/models/afmoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def __init__(
):
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)
Expand Down
7 changes: 0 additions & 7 deletions python/sglang/srt/models/bailing_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ def __init__(
)
# 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,
Expand Down Expand Up @@ -509,7 +506,6 @@ def __init__(
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

Expand Down Expand Up @@ -652,7 +648,6 @@ def __init__(
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,
Expand All @@ -662,8 +657,6 @@ def __init__(
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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/bailing_moe_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ def __init__(
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)
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/bailing_moe_nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def __init__(
) -> 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)
Expand Down
4 changes: 0 additions & 4 deletions python/sglang/srt/models/bailing_moe_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def __init__(
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
Expand Down Expand Up @@ -465,10 +464,8 @@ def __init__(
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)
Expand Down Expand Up @@ -1425,7 +1422,6 @@ def __init__(
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()
Expand Down
2 changes: 0 additions & 2 deletions python/sglang/srt/models/dbrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def __init__(
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(
Expand Down Expand Up @@ -244,7 +243,6 @@ def __init__(
)

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:
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/deepseek.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(
):
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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/deepseek_nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def __init__(
) -> 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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/deepseek_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3241,7 +3241,6 @@ def __init__(

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)
Expand Down
2 changes: 0 additions & 2 deletions python/sglang/srt/models/dots3_common/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,6 @@ def __init__(

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(
Expand Down Expand Up @@ -2716,7 +2715,6 @@ def __init__(
)
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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/dots3_common/nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def __init__(
) -> 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
Expand Down
3 changes: 0 additions & 3 deletions python/sglang/srt/models/exaone4.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ def __init__(

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,
Expand Down
4 changes: 0 additions & 4 deletions python/sglang/srt/models/exaone_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def __init__(
):
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
Expand Down Expand Up @@ -200,7 +199,6 @@ def __init__(
)

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
)
Expand Down Expand Up @@ -450,8 +448,6 @@ def __init__(
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,
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/exaone_moe_mtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def __init__(
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

Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/gemma4_causal.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def __init__(
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)
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/gigachat35.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ def __init__(
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(
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/gigachat35_mtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def __init__(
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

Expand Down
3 changes: 0 additions & 3 deletions python/sglang/srt/models/glm4_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def __init__(
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,
Expand Down Expand Up @@ -431,7 +430,6 @@ def __init__(
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 = (
Expand Down Expand Up @@ -1141,7 +1139,6 @@ def __init__(
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()
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/glm4_moe_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ def __init__(
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()
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/glm4_moe_lite_nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def __init__(
) -> 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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/glm4_moe_nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def __init__(
) -> 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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/glm4v_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def __init__(
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()
Expand Down
2 changes: 0 additions & 2 deletions python/sglang/srt/models/glm5_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ def __init__(
**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")
Expand Down Expand Up @@ -1237,7 +1236,6 @@ def __init__(

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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/glm_ocr_nextn.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def __init__(
) -> 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 {})
Expand Down
5 changes: 0 additions & 5 deletions python/sglang/srt/models/gpt_oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def __init__(
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
Expand Down Expand Up @@ -408,7 +407,6 @@ def __init__(
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,
Expand Down Expand Up @@ -563,9 +561,6 @@ def __init__(

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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/grok.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def __init__(
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,
Expand Down
2 changes: 0 additions & 2 deletions python/sglang/srt/models/hunyuan_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ def __init__(
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
Expand Down
1 change: 0 additions & 1 deletion python/sglang/srt/models/interns2_mobius.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ def __init__(
) -> 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,
Expand Down
7 changes: 0 additions & 7 deletions python/sglang/srt/models/llada2.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ def __init__(
)
# 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,
Expand Down Expand Up @@ -432,7 +429,6 @@ def __init__(
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

Expand Down Expand Up @@ -598,7 +594,6 @@ def __init__(
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,
Expand All @@ -608,8 +603,6 @@ def __init__(
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)
Expand Down
3 changes: 0 additions & 3 deletions python/sglang/srt/models/llama4.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def __init__(
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()

Expand Down Expand Up @@ -385,8 +384,6 @@ def __init__(
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,
Expand Down
Loading
Loading