-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[BugFix] Fix min_tokens
when eos_token_id
is None
#4389
Conversation
Co-authored-by: DefTruth <[email protected]>
for j, seq_id in enumerate(seq_ids): | ||
seq_data = sampling_metadata.seq_data[seq_id] | ||
if len(seq_data.output_token_ids) < min_tokens: | ||
seqs_to_penalize.append(i) | ||
seqs_to_penalize.append(j) | ||
|
||
if seqs_to_penalize: | ||
# convert to the index into logits | ||
seqs_to_penalize = [start_idx + i for i in seqs_to_penalize] | ||
# use set() to remove any duplicates | ||
token_ids_to_penalize = set(sampling_params.stop_token_ids + | ||
[sampling_params.eos_token_id]) | ||
seqs_to_penalize = [start_idx + j for j in seqs_to_penalize] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait I don't understand the both i
-> j
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simon-mo there is an outer loop over the sequence groups enumerated with index i
and within that two separate loops that now each use index j
(well this one is actually a comprehension)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could change this one to k
just to be clearer? but they don't overlap so I think it's ok like this too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simon-mo let me know if you're good with this, I think this is ready to merge if so!
…_eos_token # Conflicts: # vllm/model_executor/layers/sampler.py
) Co-authored-by: DefTruth <[email protected]>
) Co-authored-by: DefTruth <[email protected]>
Fixes #4365
Also fix re-use of index variable
i
within inner loop.