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
1bebd315
Unverified
Commit
1bebd315
authored
Jul 03, 2025
by
Ziming Huang
Committed by
GitHub
Jul 02, 2025
Browse files
Fix num_tokens_pre_allocated in disaggregation log (#7714)
parent
d3c275b1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
python/sglang/srt/disaggregation/decode.py
python/sglang/srt/disaggregation/decode.py
+6
-0
python/sglang/srt/managers/scheduler.py
python/sglang/srt/managers/scheduler.py
+1
-4
No files found.
python/sglang/srt/disaggregation/decode.py
View file @
1bebd315
...
@@ -416,6 +416,12 @@ class DecodePreallocQueue:
...
@@ -416,6 +416,12 @@ class DecodePreallocQueue:
return
preallocated_reqs
return
preallocated_reqs
@
property
def
num_tokens_pre_allocated
(
self
):
return
sum
(
len
(
decode_req
.
req
.
fill_ids
)
for
decode_req
in
self
.
transfer_queue
.
queue
)
def
_allocatable_tokens
(
def
_allocatable_tokens
(
self
,
retractable_tokens
:
Optional
[
int
]
=
None
,
count_retracted
:
bool
=
True
self
,
retractable_tokens
:
Optional
[
int
]
=
None
,
count_retracted
:
bool
=
True
)
->
int
:
)
->
int
:
...
...
python/sglang/srt/managers/scheduler.py
View file @
1bebd315
...
@@ -707,9 +707,6 @@ class Scheduler(
...
@@ -707,9 +707,6 @@ class Scheduler(
transfer_backend
=
self
.
transfer_backend
,
transfer_backend
=
self
.
transfer_backend
,
)
)
# Metric for pre-allocation
self
.
num_tokens_pre_allocated
=
0
elif
self
.
disaggregation_mode
==
DisaggregationMode
.
PREFILL
:
elif
self
.
disaggregation_mode
==
DisaggregationMode
.
PREFILL
:
# *2 for the headroom.
# *2 for the headroom.
buffer_size
=
self
.
max_running_requests
*
2
buffer_size
=
self
.
max_running_requests
*
2
...
@@ -1372,7 +1369,7 @@ class Scheduler(
...
@@ -1372,7 +1369,7 @@ class Scheduler(
msg
+=
f
"accept len:
{
spec_accept_length
:.
2
f
}
, "
msg
+=
f
"accept len:
{
spec_accept_length
:.
2
f
}
, "
if
self
.
disaggregation_mode
==
DisaggregationMode
.
DECODE
:
if
self
.
disaggregation_mode
==
DisaggregationMode
.
DECODE
:
msg
+=
f
"pre-allocated usage:
{
self
.
num_tokens_pre_allocated
/
self
.
max_total_num_tokens
:.
2
f
}
, "
msg
+=
f
"pre-allocated usage:
{
self
.
disagg_decode_prealloc_queue
.
num_tokens_pre_allocated
/
self
.
max_total_num_tokens
:.
2
f
}
, "
msg
+=
f
"#retracted-req:
{
len
(
self
.
disagg_decode_prealloc_queue
.
retracted_queue
)
}
, "
msg
+=
f
"#retracted-req:
{
len
(
self
.
disagg_decode_prealloc_queue
.
retracted_queue
)
}
, "
msg
+=
(
msg
+=
(
...
...
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