[Bugfix] fix apply_temperature to avoid nan in probs (#24734)

Signed-off-by: courage17340 <courage17340@163.com>
This commit is contained in:
courage17340
2025-09-25 05:32:21 +00:00
committed by GitHub
parent c85be1f6dd
commit a676e668ee
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -354,8 +354,8 @@ class InputBatch:
and is_spec_decode_unsupported(sampling_params)):
self.spec_decode_unsupported_reqs.add(req_id)
if sampling_params.sampling_type == SamplingType.GREEDY:
# Avoid later division by zero.
self.temperature_cpu[req_index] = -1.0
# Should avoid division by zero later when apply_temperature.
self.temperature_cpu[req_index] = 0.0
self.greedy_reqs.add(req_id)
else:
self.temperature_cpu[req_index] = sampling_params.temperature