From 8dfb6e1684ad5c80ca64ef727d782e616f46b423 Mon Sep 17 00:00:00 2001 From: huangtingwei <141888744+huangtingwei9988@users.noreply.github.com> Date: Tue, 3 Mar 2026 10:29:51 +0800 Subject: [PATCH] [HiCache] fix compatibility bugs with eagle and HiCacheStorage (#19570) Co-authored-by: maoyuhan --- python/sglang/srt/mem_cache/hiradix_cache.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/sglang/srt/mem_cache/hiradix_cache.py b/python/sglang/srt/mem_cache/hiradix_cache.py index ed094aa56..2acb01157 100644 --- a/python/sglang/srt/mem_cache/hiradix_cache.py +++ b/python/sglang/srt/mem_cache/hiradix_cache.py @@ -39,6 +39,7 @@ from sglang.srt.mem_cache.radix_cache import ( compute_node_hash_values, split_node_hash_value, ) +from sglang.srt.mem_cache.utils import convert_to_bigram_key from sglang.srt.observability.metrics_collector import StorageMetricsCollector from sglang.srt.utils import bind_to_closest_numa_node_cuda @@ -1298,6 +1299,11 @@ class HiRadixCache(RadixCache): last_hash: Optional[str] = None, prefix_keys: Optional[List[str]] = None, ): + new_input_tokens = ( + convert_to_bigram_key(new_input_tokens) + if self.is_eagle + else new_input_tokens + ) # align the number of fetching tokens to the page size prefetch_length = len(new_input_tokens) - ( len(new_input_tokens) % self.page_size