@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / ba558c029a
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 12, 23:30 UTC

[config] Expose `get_total_num_hidden_layers()` in ModelConfig (#28961)

Signed-off-by: tovam <tovam@pliops.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>

Tova Movshovitz committed Nov 19, 2025 at 13:37 UTC ba558c029ad65ab4f040c8320607ebd87612cf08
1 file changed +10 -5
vllm/config/model.py
+10 -5
@@ -1369,11 +1369,7 @@ class ModelConfig:
1369 # Coerce to 0 if explicitly set to None
1370 return num_experts or 0
1371
1372 - def get_layers_start_end_indices(
1373 - self, parallel_config: ParallelConfig
1374 - ) -> tuple[int, int]:
1375 - from vllm.distributed.utils import get_pp_indices
1376 -
1372 + def get_total_num_hidden_layers(self) -> int:
1373 if (
1374 self.hf_text_config.model_type == "deepseek_mtp"
1375 or self.hf_config.model_type == "mimo_mtp"
@@ -1393,6 +1389,15 @@ class ModelConfig:
1389 total_num_hidden_layers = getattr(
1390 self.hf_text_config, "num_hidden_layers", 0
1391 )
1392 + return total_num_hidden_layers
1393 +
1394 + def get_layers_start_end_indices(
1395 + self, parallel_config: ParallelConfig
1396 + ) -> tuple[int, int]:
1397 + from vllm.distributed.utils import get_pp_indices
1398 +
1399 + total_num_hidden_layers = self.get_total_num_hidden_layers()
1400 +
1401 # the layout order is: DP x PP x TP
1402 pp_rank = (
1403 parallel_config.rank // parallel_config.tensor_parallel_size