From e63fd445605b442a81a4eb2f402206cc337ab8dd Mon Sep 17 00:00:00 2001 From: Di Wu <95495325+dw2761@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:57:44 +0800 Subject: [PATCH] Fix: Correctly filter special tokens in benchmark_prefix_caching (#28615) Signed-off-by: Di Wu --- benchmarks/benchmark_prefix_caching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/benchmark_prefix_caching.py b/benchmarks/benchmark_prefix_caching.py index 146c268a6b..28fc383a31 100644 --- a/benchmarks/benchmark_prefix_caching.py +++ b/benchmarks/benchmark_prefix_caching.py @@ -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, )