Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes delayed sampling for sequential requests #845

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion vllm/worker/hpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2781,6 +2781,11 @@ def _patch_prev_output(self):
model_input = self.cached_step_inputs.pop(0)
delayed_output = self.cached_step_outputs.pop(0).cpu().squeeze(-1).tolist()
ctx = model_input.async_callback.keywords["ctx"]
# If there's no output to patch with,
# which is usually the case when we're starting a new request after all in-flight requests are completed,
# We return (Note that we have now cleared the cached_step_inputs/outputs as required).
if len(ctx.output_queue) == 0:
return
assert len(ctx.output_queue) == 1, 'There should be exactly 1 output waiting!'
output_data = ctx.output_queue[0]
assert len(output_data.outputs) == 1
Expand All @@ -2792,4 +2797,4 @@ def _patch_prev_output(self):
# This is a hack. Assigning output_token_ids triggers
# a cache recomputation and we only need to update the last token
seq_data.output_token_ids_array[-1] = real_out
seq_data._cached_all_token_ids[-1] = real_out
seq_data._cached_all_token_ids[-1] = real_out
Loading