Skip to content

Commit 3b67ae0

Browse files
committed
fix: guard against KeyError with _req_ids2idx
Signed-off-by: Travis Johnson <[email protected]>
1 parent c650320 commit 3b67ae0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vllm_spyre/worker/spyre_model_runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,10 @@ def prepare_model_input(
284284
# updating indices: set indices of newly finished sequences False
285285
if finished_requests_ids:
286286
for seq_id in finished_requests_ids:
287-
self.model.indices[self._req_ids2idx[seq_id]] = False
287+
# ignore requests that are not in the batch, eg. requests
288+
# cancelled while waiting
289+
if idx := self._req_ids2idx.get(seq_id):
290+
self.model.indices[idx] = False
288291
(input_tokens, input_positions,
289292
input_masks) = self._prepare_decode(seq_group_metadata_list)
290293
seq_lens = []

0 commit comments

Comments
 (0)