[Sampling] Restore finite top-k requirement for sampling masks (#35205)
This commit is contained in:
@@ -2572,13 +2572,11 @@ class Scheduler(
|
||||
self._add_request_to_queue(req)
|
||||
return
|
||||
|
||||
uses_top_k_or_top_p_truncation = (
|
||||
req.sampling_params.top_k != TOP_K_ALL or req.sampling_params.top_p < 1.0
|
||||
)
|
||||
if req.return_sampling_mask and not uses_top_k_or_top_p_truncation:
|
||||
if req.return_sampling_mask and req.sampling_params.top_k == TOP_K_ALL:
|
||||
error_msg = (
|
||||
"return_sampling_mask cannot return the full vocabulary; set "
|
||||
"top_p < 1 or a finite top_k."
|
||||
"return_sampling_mask requires finite top_k; top_p-only sampling "
|
||||
"is valid but can return huge masks in the tail, blowing up "
|
||||
"metadata, so we need a safety cap."
|
||||
)
|
||||
req.set_finish_with_abort(error_msg)
|
||||
self.init_req_max_new_tokens(req)
|
||||
|
||||
Reference in New Issue
Block a user