Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
0bfa394a
Unverified
Commit
0bfa394a
authored
Oct 24, 2025
by
Yuanhang Sun
Committed by
GitHub
Oct 24, 2025
Browse files
[Fix]: HiCache hasher failed when EAGLE mode enabled (#12025)
parent
e04340bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
python/sglang/srt/mem_cache/hicache_storage.py
python/sglang/srt/mem_cache/hicache_storage.py
+7
-1
python/sglang/srt/mem_cache/storage/hf3fs/mini_3fs_metadata_server.py
...g/srt/mem_cache/storage/hf3fs/mini_3fs_metadata_server.py
+3
-2
No files found.
python/sglang/srt/mem_cache/hicache_storage.py
View file @
0bfa394a
...
@@ -19,7 +19,13 @@ def get_hash_str(token_ids: List[int], prior_hash: str = None) -> str:
...
@@ -19,7 +19,13 @@ def get_hash_str(token_ids: List[int], prior_hash: str = None) -> str:
hasher
.
update
(
bytes
.
fromhex
(
prior_hash
))
hasher
.
update
(
bytes
.
fromhex
(
prior_hash
))
for
t
in
token_ids
:
for
t
in
token_ids
:
hasher
.
update
(
t
.
to_bytes
(
4
,
byteorder
=
"little"
,
signed
=
False
))
if
isinstance
(
t
,
tuple
):
# EAGLE bigram mode: hash both elements to uniquely identify the bigram
for
elem
in
t
:
hasher
.
update
(
elem
.
to_bytes
(
4
,
byteorder
=
"little"
,
signed
=
False
))
else
:
# Regular mode: single integer token
hasher
.
update
(
t
.
to_bytes
(
4
,
byteorder
=
"little"
,
signed
=
False
))
return
hasher
.
hexdigest
()
return
hasher
.
hexdigest
()
...
...
python/sglang/srt/mem_cache/storage/hf3fs/mini_3fs_metadata_server.py
View file @
0bfa394a
...
@@ -3,8 +3,9 @@ import atexit
...
@@ -3,8 +3,9 @@ import atexit
import
json
import
json
import
logging
import
logging
import
threading
import
threading
from
collections
import
OrderedDict
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Dict
,
List
,
Optional
,
OrderedDict
,
Tuple
from
typing
import
Dict
,
List
,
Optional
,
Tuple
import
orjson
import
orjson
import
requests
import
requests
...
@@ -136,7 +137,7 @@ class GlobalMetadataState:
...
@@ -136,7 +137,7 @@ class GlobalMetadataState:
num_pages
=
data
[
"num_pages"
]
num_pages
=
data
[
"num_pages"
]
rank_meta
=
RankMetadata
(
num_pages
)
rank_meta
=
RankMetadata
(
num_pages
)
rank_meta
.
free_pages
=
data
[
"free_pages"
]
rank_meta
.
free_pages
=
data
[
"free_pages"
]
rank_meta
.
key_to_index
=
d
ict
(
data
[
"key_to_index"
])
rank_meta
.
key_to_index
=
OrderedD
ict
(
data
[
"key_to_index"
])
self
.
ranks
[
rank_id
]
=
rank_meta
self
.
ranks
[
rank_id
]
=
rank_meta
logging
.
info
(
logging
.
info
(
f
"Successfully loaded metadata for
{
len
(
self
.
ranks
)
}
ranks."
f
"Successfully loaded metadata for
{
len
(
self
.
ranks
)
}
ranks."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment