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
27e9538a
Unverified
Commit
27e9538a
authored
Apr 18, 2025
by
mlmz
Committed by
GitHub
Apr 18, 2025
Browse files
Fix: fix the exception 'the memory capacity is unbalanced. Some GPUs … (#5426)
Co-authored-by:
ocss884
<
ocss.lin@gmail.com
>
parent
211c7b31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
python/sglang/srt/model_executor/model_runner.py
python/sglang/srt/model_executor/model_runner.py
+11
-4
No files found.
python/sglang/srt/model_executor/model_runner.py
View file @
27e9538a
...
...
@@ -73,6 +73,7 @@ from sglang.srt.utils import (
MultiprocessingSerializer
,
enable_show_time_cost
,
get_available_gpu_memory
,
get_bool_env_var
,
init_custom_process_group
,
is_cuda
,
is_fa3_default_architecture
,
...
...
@@ -378,10 +379,16 @@ class ModelRunner:
local_gpu_memory
=
get_available_gpu_memory
(
self
.
device
,
self
.
gpu_id
)
if
self
.
tp_size
>
1
:
if
min_per_gpu_memory
<
local_gpu_memory
*
0.9
:
raise
ValueError
(
"The memory capacity is unbalanced. Some GPUs may be occupied by other processes. "
f
"
{
min_per_gpu_memory
=
}
,
{
local_gpu_memory
=
}
,
{
local_gpu_memory
*
0.9
=
}
"
)
if
get_bool_env_var
(
"SGL_DISABLE_TP_MEMORY_INBALANCE_CHECK"
):
logger
.
warning
(
"The memory capacity is unbalanced. Some GPUs may be occupied by other processes. "
f
"
{
min_per_gpu_memory
=
}
,
{
local_gpu_memory
=
}
,
{
local_gpu_memory
*
0.9
=
}
"
)
else
:
raise
ValueError
(
"The memory capacity is unbalanced. Some GPUs may be occupied by other processes. "
f
"
{
min_per_gpu_memory
=
}
,
{
local_gpu_memory
=
}
,
{
local_gpu_memory
*
0.9
=
}
"
)
logger
.
info
(
f
"Init torch distributed ends. mem usage=
{
(
before_avail_memory
-
local_gpu_memory
):.
2
f
}
GB"
...
...
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