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
bf63ee54
"src/runtime/vscode:/vscode.git/clone" did not exist on "96297fb8fdd629fc2fd52872d718d78fa491cba1"
Unverified
Commit
bf63ee54
authored
Mar 16, 2025
by
vikram singh shekhawat
Committed by
GitHub
Mar 15, 2025
Browse files
Auto-detect device if not specified in server arguments. (#4423)
parent
22c96f78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
python/sglang/srt/server_args.py
python/sglang/srt/server_args.py
+7
-4
No files found.
python/sglang/srt/server_args.py
View file @
bf63ee54
...
@@ -24,6 +24,7 @@ from sglang.srt.hf_transformers_utils import check_gguf_file
...
@@ -24,6 +24,7 @@ from sglang.srt.hf_transformers_utils import check_gguf_file
from
sglang.srt.reasoning_parser
import
ReasoningParser
from
sglang.srt.reasoning_parser
import
ReasoningParser
from
sglang.srt.utils
import
(
from
sglang.srt.utils
import
(
get_amdgpu_memory_capacity
,
get_amdgpu_memory_capacity
,
get_device
,
get_hpu_memory_capacity
,
get_hpu_memory_capacity
,
get_nvgpu_memory_capacity
,
get_nvgpu_memory_capacity
,
is_cuda
,
is_cuda
,
...
@@ -52,7 +53,7 @@ class ServerArgs:
...
@@ -52,7 +53,7 @@ class ServerArgs:
quantization
:
Optional
[
str
]
=
None
quantization
:
Optional
[
str
]
=
None
quantization_param_path
:
nullable_str
=
None
quantization_param_path
:
nullable_str
=
None
context_length
:
Optional
[
int
]
=
None
context_length
:
Optional
[
int
]
=
None
device
:
str
=
"cuda"
device
:
Optional
[
str
]
=
None
served_model_name
:
Optional
[
str
]
=
None
served_model_name
:
Optional
[
str
]
=
None
chat_template
:
Optional
[
str
]
=
None
chat_template
:
Optional
[
str
]
=
None
is_embedding
:
bool
=
False
is_embedding
:
bool
=
False
...
@@ -185,6 +186,9 @@ class ServerArgs:
...
@@ -185,6 +186,9 @@ class ServerArgs:
if
self
.
tokenizer_path
is
None
:
if
self
.
tokenizer_path
is
None
:
self
.
tokenizer_path
=
self
.
model_path
self
.
tokenizer_path
=
self
.
model_path
if
self
.
device
is
None
:
self
.
device
=
get_device
()
if
self
.
served_model_name
is
None
:
if
self
.
served_model_name
is
None
:
self
.
served_model_name
=
self
.
model_path
self
.
served_model_name
=
self
.
model_path
...
@@ -435,9 +439,8 @@ class ServerArgs:
...
@@ -435,9 +439,8 @@ class ServerArgs:
parser
.
add_argument
(
parser
.
add_argument
(
"--device"
,
"--device"
,
type
=
str
,
type
=
str
,
default
=
"cuda"
,
default
=
ServerArgs
.
device
,
choices
=
[
"cuda"
,
"xpu"
,
"hpu"
,
"cpu"
],
help
=
"The device to use ('cuda', 'xpu', 'hpu', 'cpu'). Defaults to auto-detection if not specified."
,
help
=
"The device type."
,
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--served-model-name"
,
"--served-model-name"
,
...
...
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