Skip to content

Commit aba348f

Browse files
LucasWilkinsonamd-hhashemi
authored andcommitted
[BugFix] Fix DBO failing with TypeError: 'NoneType' object is not iterable (vllm-project#29698)
Signed-off-by: Lucas Wilkinson <[email protected]> Signed-off-by: Hashem Hashemi <[email protected]>
1 parent 730f5c4 commit aba348f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

tests/v1/distributed/test_dbo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,4 @@ def test_dbo_dp_ep_gsm8k(all2all_backend: str, num_gpus_available):
8585
assert accuracy >= MIN_ACCURACY, (
8686
f"DBO+DP+EP accuracy too low ({all2all_backend}): "
8787
f"{accuracy:.3f} < {MIN_ACCURACY:.3f} "
88-
f"(correct: {results['num_correct']}/{results['num_questions']})"
8988
)

vllm/v1/attention/backends/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ def _make_metadata_with_slice(
166166
assert start_locs[first_req] <= first_tok < start_locs[first_req + 1], (
167167
"Token slice start outside of first request"
168168
)
169-
assert start_locs[last_req] <= last_tok < start_locs[last_req + 1], (
170-
"Token slice end outside of last request"
171-
)
169+
# NOTE: last token can be outside of the last request if we have CG padding.
172170

173171
# If the "middle" request has tokens in both ubatches, we have to split it.
174172
# If ubatch_slice is the first ubatch then we will be splitting the last

vllm/v1/worker/dp_utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,16 @@ def _post_process_dp_padding(tensor: torch.Tensor, should_dp_pad: bool) -> torch
9393

9494
# This just pads the second ubatch slice out to the total number of tokens
9595
# (num_tokens + padding) since we do `create_ubatch_slices` before applying DP padding.
96-
def _pad_out_ubatch_slice(ubatch_slices: UBatchSlices, num_total_tokens: int):
97-
padded_second_ubatch_slice = slice(
96+
def _pad_out_ubatch_slice(
97+
ubatch_slices: UBatchSlices, num_total_tokens: int
98+
) -> UBatchSlices:
99+
padded_second_token_slice = slice(
98100
ubatch_slices[1].token_slice.start, num_total_tokens
99101
)
100102
ubatch_slices[1] = UBatchSlice(
101-
padded_second_ubatch_slice, padded_second_ubatch_slice
103+
ubatch_slices[1].request_slice, padded_second_token_slice
102104
)
105+
return ubatch_slices
103106

104107

105108
def _synchronize_dp_ranks(

0 commit comments

Comments
 (0)