Change top_k to be disabled with 0 (still accept -1 for now) (#17773)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-05-09 10:01:49 +00:00
committed by GitHub
parent 5b2dcbf0b8
commit c6798baa9c
6 changed files with 14 additions and 13 deletions
+1 -1
View File
@@ -416,7 +416,7 @@ class SamplingTensors:
# k should not be greater than the vocab size.
top_k = min(sampling_params.top_k, vocab_size)
top_k = vocab_size if top_k == -1 else top_k
top_k = vocab_size if top_k < 1 else top_k
if temperature < _SAMPLING_EPS:
# NOTE: Zero temperature means deterministic sampling
# (i.e., greedy sampling or beam search).