Fix benchmark generating empty prompts when random_input_len is small (#21492)

This commit is contained in:
Liangsheng Yin
2026-03-26 16:24:35 -07:00
committed by GitHub
parent a93065679b
commit c580ddd19d
+1 -1
View File
@@ -79,7 +79,7 @@ def sample_random_requests(
# Need to truncate input_len as server encode will add special token.
num_special_tokens = int(tokenizer.num_special_tokens_to_add())
for i in range(num_prompts):
input_lens[i] = max(0, input_lens[i] - num_special_tokens)
input_lens[i] = max(1, input_lens[i] - num_special_tokens)
if random_sample:
# Sample token ids from ShareGPT and repeat/truncate them to satisfy the input_lens