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
ed45e509
Unverified
Commit
ed45e509
authored
Dec 04, 2024
by
Ata Fatahi
Committed by
GitHub
Dec 05, 2024
Browse files
Check gpu availability at server args creation (#2340)
Signed-off-by:
Ata Fatahi
<
immrata@gmail.com
>
parent
ec52464d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
python/sglang/srt/server_args.py
python/sglang/srt/server_args.py
+8
-3
No files found.
python/sglang/srt/server_args.py
View file @
ed45e509
...
...
@@ -20,6 +20,8 @@ import random
import
tempfile
from
typing
import
List
,
Optional
import
torch
from
sglang.srt.hf_transformers_utils
import
check_gguf_file
from
sglang.srt.utils
import
(
get_amdgpu_memory_capacity
,
...
...
@@ -151,8 +153,11 @@ class ServerArgs:
if
is_hip
():
gpu_mem
=
get_amdgpu_memory_capacity
()
el
se
:
el
if
torch
.
cuda
.
is_available
()
:
gpu_mem
=
get_nvgpu_memory_capacity
()
else
:
# GPU memory is not known yet or no GPU is available.
gpu_mem
=
None
# Set mem fraction static, which depends on the tensor parallelism size
if
self
.
mem_fraction_static
is
None
:
...
...
@@ -169,14 +174,14 @@ class ServerArgs:
# Set chunked prefill size, which depends on the gpu memory capacity
if
self
.
chunked_prefill_size
is
None
:
if
gpu_mem
<
25_000
:
if
gpu_mem
is
not
None
and
gpu_mem
<
25_000
:
self
.
chunked_prefill_size
=
2048
else
:
self
.
chunked_prefill_size
=
8192
# Set cuda graph max batch size
if
self
.
cuda_graph_max_bs
is
None
:
if
gpu_mem
<
25_000
:
if
gpu_mem
is
not
None
and
gpu_mem
<
25_000
:
self
.
cuda_graph_max_bs
=
8
else
:
self
.
cuda_graph_max_bs
=
160
...
...
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