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
49420741
Unverified
Commit
49420741
authored
Mar 20, 2025
by
JieXin Liang
Committed by
GitHub
Mar 19, 2025
Browse files
[fix] fix initialization of _ENABLE_TORCH_INFERENCE_MODE (#4549)
parent
ba52fd18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+7
-7
No files found.
python/sglang/srt/utils.py
View file @
49420741
...
@@ -78,6 +78,11 @@ time_infos = {}
...
@@ -78,6 +78,11 @@ time_infos = {}
HIP_FP8_E4M3_FNUZ_MAX
=
224.0
HIP_FP8_E4M3_FNUZ_MAX
=
224.0
def
get_bool_env_var
(
name
:
str
,
default
:
str
=
"false"
)
->
bool
:
value
=
os
.
getenv
(
name
,
default
)
return
value
.
lower
()
in
(
"true"
,
"1"
)
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
def
is_hip
()
->
bool
:
def
is_hip
()
->
bool
:
return
torch
.
version
.
hip
is
not
None
return
torch
.
version
.
hip
is
not
None
...
@@ -128,9 +133,9 @@ def is_cuda_available():
...
@@ -128,9 +133,9 @@ def is_cuda_available():
return
is_cuda
()
return
is_cuda
()
_ENABLE_TORCH_INFERENCE_MODE
=
os
.
getenv
(
_ENABLE_TORCH_INFERENCE_MODE
=
get_bool_env_var
(
"SGLANG_ENABLE_TORCH_INFERENCE_MODE"
,
"false"
"SGLANG_ENABLE_TORCH_INFERENCE_MODE"
,
"false"
)
.
lower
()
in
(
"true"
,
"1"
)
)
class
DynamicGradMode
(
_DecoratorContextManager
):
class
DynamicGradMode
(
_DecoratorContextManager
):
...
@@ -1327,11 +1332,6 @@ def set_gpu_proc_affinity(
...
@@ -1327,11 +1332,6 @@ def set_gpu_proc_affinity(
logger
.
info
(
f
"Process
{
pid
}
gpu_id
{
gpu_id
}
is running on CPUs:
{
p
.
cpu_affinity
()
}
"
)
logger
.
info
(
f
"Process
{
pid
}
gpu_id
{
gpu_id
}
is running on CPUs:
{
p
.
cpu_affinity
()
}
"
)
def
get_bool_env_var
(
name
:
str
,
default
:
str
=
"false"
)
->
bool
:
value
=
os
.
getenv
(
name
,
default
)
return
value
.
lower
()
in
(
"true"
,
"1"
)
@
lru_cache
(
maxsize
=
2
)
@
lru_cache
(
maxsize
=
2
)
def
disable_request_logging
()
->
bool
:
def
disable_request_logging
()
->
bool
:
return
get_bool_env_var
(
"SGLANG_DISABLE_REQUEST_LOGGING"
)
return
get_bool_env_var
(
"SGLANG_DISABLE_REQUEST_LOGGING"
)
...
...
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