Skip to content

Commit ba558c0

Browse files
ptovamyewentao256DarkLight1337
authored
[config] Expose get_total_num_hidden_layers() in ModelConfig (#28961)
Signed-off-by: tovam <[email protected]> Co-authored-by: Wentao Ye <[email protected]> Co-authored-by: Cyrus Leung <[email protected]>
1 parent 97cfa99 commit ba558c0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

vllm/config/model.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,11 +1369,7 @@ def get_num_experts(self) -> int:
13691369
# Coerce to 0 if explicitly set to None
13701370
return num_experts or 0
13711371

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:
13771373
if (
13781374
self.hf_text_config.model_type == "deepseek_mtp"
13791375
or self.hf_config.model_type == "mimo_mtp"
@@ -1393,6 +1389,15 @@ def get_layers_start_end_indices(
13931389
total_num_hidden_layers = getattr(
13941390
self.hf_text_config, "num_hidden_layers", 0
13951391
)
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+
13961401
# the layout order is: DP x PP x TP
13971402
pp_rank = (
13981403
parallel_config.rank // parallel_config.tensor_parallel_size

0 commit comments

Comments
 (0)