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
e7759778
Unverified
Commit
e7759778
authored
Jun 08, 2025
by
JieXin Liang
Committed by
GitHub
Jun 07, 2025
Browse files
[misc] add is_cpu() (#6950)
parent
77e928d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+10
-0
No files found.
python/sglang/srt/utils.py
View file @
e7759778
...
@@ -25,6 +25,7 @@ import json
...
@@ -25,6 +25,7 @@ import json
import
logging
import
logging
import
os
import
os
import
pickle
import
pickle
import
platform
import
random
import
random
import
re
import
re
import
resource
import
resource
...
@@ -158,6 +159,15 @@ def is_npu() -> bool:
...
@@ -158,6 +159,15 @@ def is_npu() -> bool:
return
hasattr
(
torch
,
"npu"
)
and
torch
.
npu
.
is_available
()
return
hasattr
(
torch
,
"npu"
)
and
torch
.
npu
.
is_available
()
def
is_cpu
()
->
bool
:
machine
=
platform
.
machine
().
lower
()
return
(
machine
in
(
"x86_64"
,
"amd64"
,
"i386"
,
"i686"
)
and
hasattr
(
torch
,
"cpu"
)
and
torch
.
cpu
.
is_available
()
)
def
is_flashinfer_available
():
def
is_flashinfer_available
():
"""
"""
Check whether flashinfer is available.
Check whether flashinfer is available.
...
...
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