mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-21 22:25:47 +08:00
[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>
This commit is contained in:
parent
97cfa99d59
commit
ba558c029a
@ -1369,11 +1369,7 @@ class ModelConfig:
|
|||||||
# Coerce to 0 if explicitly set to None
|
# Coerce to 0 if explicitly set to None
|
||||||
return num_experts or 0
|
return num_experts or 0
|
||||||
|
|
||||||
def get_layers_start_end_indices(
|
def get_total_num_hidden_layers(self) -> int:
|
||||||
self, parallel_config: ParallelConfig
|
|
||||||
) -> tuple[int, int]:
|
|
||||||
from vllm.distributed.utils import get_pp_indices
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
self.hf_text_config.model_type == "deepseek_mtp"
|
self.hf_text_config.model_type == "deepseek_mtp"
|
||||||
or self.hf_config.model_type == "mimo_mtp"
|
or self.hf_config.model_type == "mimo_mtp"
|
||||||
@ -1393,6 +1389,15 @@ class ModelConfig:
|
|||||||
total_num_hidden_layers = getattr(
|
total_num_hidden_layers = getattr(
|
||||||
self.hf_text_config, "num_hidden_layers", 0
|
self.hf_text_config, "num_hidden_layers", 0
|
||||||
)
|
)
|
||||||
|
return total_num_hidden_layers
|
||||||
|
|
||||||
|
def get_layers_start_end_indices(
|
||||||
|
self, parallel_config: ParallelConfig
|
||||||
|
) -> tuple[int, int]:
|
||||||
|
from vllm.distributed.utils import get_pp_indices
|
||||||
|
|
||||||
|
total_num_hidden_layers = self.get_total_num_hidden_layers()
|
||||||
|
|
||||||
# the layout order is: DP x PP x TP
|
# the layout order is: DP x PP x TP
|
||||||
pp_rank = (
|
pp_rank = (
|
||||||
parallel_config.rank // parallel_config.tensor_parallel_size
|
parallel_config.rank // parallel_config.tensor_parallel_size
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user