Fix: Correctly filter special tokens in benchmark_prefix_caching (#28615)

Signed-off-by: Di Wu <dw2761@nyu.edu>
This commit is contained in:
Di Wu 2025-11-13 18:57:44 +08:00 committed by GitHub
parent 11ac9ddd03
commit e63fd44560
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,7 +69,7 @@ def sample_tokens(tokenizer: PreTrainedTokenizerBase, length: int) -> list[int]:
# Remove the special tokens.
return random.choices(
[v for k, v in vocab.items() if k not in all_special_ids],
[v for v in vocab.values() if v not in all_special_ids],
k=length,
)