diff --git a/python/sglang/srt/models/transformers.py b/python/sglang/srt/models/transformers.py index 9135dc915..a8d33c6aa 100644 --- a/python/sglang/srt/models/transformers.py +++ b/python/sglang/srt/models/transformers.py @@ -211,16 +211,13 @@ class TransformersForCausalLM(nn.Module): Apply the model's tensor parallelization plan. Currently only supports linear layers. """ - if not self.model.supports_tp_plan: - if tp_size <= 1: - return + tp_plan = getattr(self.model.config, "base_model_tp_plan", None) or {} + if not tp_plan and self.tp_size > 1: raise ValueError( f"{type(self.model)} does not support tensor parallel yet!" ) - tp_plan = getattr(self.model.config, "base_model_tp_plan", None) or {} - def _tensor_parallel(module: nn.Module, prefix: str = ""): for child_name, child_module in module.named_children(): qual_name = maybe_prefix(prefix, child_name)