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
a470e60c
Unverified
Commit
a470e60c
authored
Jul 16, 2024
by
Ying Sheng
Committed by
GitHub
Jul 16, 2024
Browse files
clean up step function (#635)
parent
5f90e076
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
28 deletions
+33
-28
python/sglang/srt/managers/controller/tp_worker.py
python/sglang/srt/managers/controller/tp_worker.py
+33
-28
No files found.
python/sglang/srt/managers/controller/tp_worker.py
View file @
a470e60c
...
@@ -228,6 +228,18 @@ class ModelTpServer:
...
@@ -228,6 +228,18 @@ class ModelTpServer:
# Print stats
# Print stats
if
self
.
tp_rank
==
0
and
self
.
decode_forward_ct
%
40
==
0
:
if
self
.
tp_rank
==
0
and
self
.
decode_forward_ct
%
40
==
0
:
self
.
print_stats
()
if
self
.
running_batch
.
is_empty
():
self
.
running_batch
=
None
break
if
self
.
out_pyobjs
and
self
.
running_batch
.
has_stream
():
break
else
:
self
.
check_memory
()
def
print_stats
(
self
):
num_used
=
self
.
max_total_num_tokens
-
(
num_used
=
self
.
max_total_num_tokens
-
(
self
.
token_to_kv_pool
.
available_size
()
self
.
token_to_kv_pool
.
available_size
()
+
self
.
tree_cache
.
evictable_size
()
+
self
.
tree_cache
.
evictable_size
()
...
@@ -246,14 +258,7 @@ class ModelTpServer:
...
@@ -246,14 +258,7 @@ class ModelTpServer:
f
"#queue-req:
{
len
(
self
.
forward_queue
)
}
"
f
"#queue-req:
{
len
(
self
.
forward_queue
)
}
"
)
)
if
self
.
running_batch
.
is_empty
():
def
check_memory
(
self
):
self
.
running_batch
=
None
break
if
self
.
out_pyobjs
and
self
.
running_batch
.
has_stream
():
break
else
:
# Check the available size
available_size
=
(
available_size
=
(
self
.
token_to_kv_pool
.
available_size
()
self
.
token_to_kv_pool
.
available_size
()
+
self
.
tree_cache
.
evictable_size
()
+
self
.
tree_cache
.
evictable_size
()
...
...
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