-
Notifications
You must be signed in to change notification settings - Fork 484
Remap to max supported topk instead of assert #37290
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,10 +346,11 @@ def format_sampling_params(sampling_params, max_batch_size): | |
|
|
||
| # `top_k` contract: TT sampling supports up to 32 today. | ||
| # - k < 1 means "no restriction" so set it to max (32) | ||
| # - k > 32 is a caller error | ||
| # - k > 32 is re-mapped to 32 until we support it | ||
| if sampling_params.top_k[i] < 1: | ||
| sampling_params.top_k[i] = 32 | ||
| assert sampling_params.top_k[i] <= 32, f"top_k must be <= 32, got {sampling_params.top_k[i]}" | ||
| if sampling_params.top_k[i] > 32: | ||
| sampling_params.top_k[i] = 32 | ||
|
Comment on lines
+349
to
+353
|
||
|
|
||
| if sampling_params.repetition_penalty[i] == 0: | ||
| sampling_params.repetition_penalty[i] = default_params["repetition_penalty"] | ||
|
|
||
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.
Clamping
top_kvalues >32 is now silent. Since this used to assert, callers may not realize their request is being changed, which can make sampling behavior hard to debug. Consider emitting a warning whentop_kis re-mapped (e.g., only when the value is modified) so the change is discoverable without crashing.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.
other vllm backends don't emit warnings when remapping, and based on discussions with @skhorasganiTT we don't want to either