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
685d8980
Unverified
Commit
685d8980
authored
Apr 21, 2025
by
fzyzcjy
Committed by
GitHub
Apr 20, 2025
Browse files
Tiny add warning when cannot recognize bool env var (#5348)
parent
70645f4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+15
-1
No files found.
python/sglang/srt/utils.py
View file @
685d8980
...
@@ -78,10 +78,24 @@ time_infos = {}
...
@@ -78,10 +78,24 @@ time_infos = {}
HIP_FP8_E4M3_FNUZ_MAX
=
224.0
HIP_FP8_E4M3_FNUZ_MAX
=
224.0
_warned_bool_env_var_keys
=
set
()
def
get_bool_env_var
(
name
:
str
,
default
:
str
=
"false"
)
->
bool
:
def
get_bool_env_var
(
name
:
str
,
default
:
str
=
"false"
)
->
bool
:
value
=
os
.
getenv
(
name
,
default
)
value
=
os
.
getenv
(
name
,
default
)
return
value
.
lower
()
in
(
"true"
,
"1"
)
value
=
value
.
lower
()
truthy_values
=
(
"true"
,
"1"
)
falsy_values
=
(
"false"
,
"0"
)
if
(
value
not
in
truthy_values
)
and
(
value
not
in
falsy_values
):
if
value
not
in
_warned_bool_env_var_keys
:
logger
.
warning
(
f
"get_bool_env_var(
{
name
}
) see non-understandable value=
{
value
}
and treat as false"
)
_warned_bool_env_var_keys
.
add
(
value
)
return
value
in
truthy_values
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
# https://pytorch.org/docs/stable/notes/hip.html#checking-for-hip
...
...
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