Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
Signed-off-by: Rui Qiao <ruisearch42@gmail.com>
  • Loading branch information
ruisearch42 committed Feb 12, 2025
1 parent d1822fa commit 9979500
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vllm/distributed/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,17 @@ def get_pp_indices(num_hidden_layers: int, pp_rank: int,
if sum(partitions) != num_hidden_layers:
raise ValueError(
f"{sum(partitions)=} does not match {num_hidden_layers=}.")
if envs.VLLM_USE_V1 and len(set(partitions)) != 1:
raise NotImplementedError(
f"Currently in V1, all pipeline parallel stages need to have "
f"the same number of layers. Got {partitions=}.")
start_layer = sum(partitions[:pp_rank])
end_layer = start_layer + partitions[pp_rank]
else:
if envs.VLLM_USE_V1 and num_hidden_layers % pp_size != 0:
raise NotImplementedError(
f"Currently in V1, num_hidden_layers={num_hidden_layers} "
f"must be divisible by pp_size={pp_size}.")
layers_per_partition = num_hidden_layers // pp_size
start_layer = pp_rank * layers_per_partition
end_layer = start_layer + layers_per_partition
Expand Down

0 comments on commit 9979500

Please sign in to comment.