diff --git a/python/sglang/srt/mem_cache/swa_radix_cache.py b/python/sglang/srt/mem_cache/swa_radix_cache.py index 4268130e9..01c8814db 100644 --- a/python/sglang/srt/mem_cache/swa_radix_cache.py +++ b/python/sglang/srt/mem_cache/swa_radix_cache.py @@ -519,7 +519,7 @@ class SWARadixCache(KVCacheEventMixin, BasePrefixCache): ] # `req.prefix_indices` will be used in `PrefillAdder::add_chunked_req` later - req.prefix_indices = kv_indices + req.prefix_indices = kv_indices.to(dtype=torch.int64, copy=True) return token_ids = req.get_fill_ids() diff --git a/python/sglang/srt/mem_cache/unified_radix_cache.py b/python/sglang/srt/mem_cache/unified_radix_cache.py index 375c17832..597de340d 100644 --- a/python/sglang/srt/mem_cache/unified_radix_cache.py +++ b/python/sglang/srt/mem_cache/unified_radix_cache.py @@ -749,7 +749,7 @@ class UnifiedRadixCache(BasePrefixCache): kv_indices = self.req_to_token_pool.req_to_token[ req.req_pool_idx, : len(token_ids) ] - req.prefix_indices = kv_indices + req.prefix_indices = kv_indices.to(dtype=torch.int64, copy=True) return kv_indices_orig = self.req_to_token_pool.req_to_token[