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
a2424068
Unverified
Commit
a2424068
authored
Sep 11, 2025
by
gongwei-130
Committed by
GitHub
Sep 11, 2025
Browse files
add try catch for quant config hf download (#10340)
parent
c5d2b01c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
python/sglang/srt/configs/model_config.py
python/sglang/srt/configs/model_config.py
+13
-4
No files found.
python/sglang/srt/configs/model_config.py
View file @
a2424068
...
@@ -420,11 +420,20 @@ class ModelConfig:
...
@@ -420,11 +420,20 @@ class ModelConfig:
is_local
=
os
.
path
.
exists
(
self
.
model_path
)
is_local
=
os
.
path
.
exists
(
self
.
model_path
)
modelopt_quant_config
=
{
"quant_method"
:
"modelopt"
}
modelopt_quant_config
=
{
"quant_method"
:
"modelopt"
}
if
not
is_local
:
if
not
is_local
:
from
huggingface_hub
import
HfApi
import
huggingface_hub
try
:
from
huggingface_hub
import
HfApi
hf_api
=
HfApi
()
if
hf_api
.
file_exists
(
self
.
model_path
,
"hf_quant_config.json"
):
quant_cfg
=
modelopt_quant_config
except
huggingface_hub
.
errors
.
OfflineModeIsEnabled
:
logger
.
warning
(
"Offline mode is enabled, skipping hf_quant_config.json check"
)
pass
hf_api
=
HfApi
()
if
hf_api
.
file_exists
(
self
.
model_path
,
"hf_quant_config.json"
):
quant_cfg
=
modelopt_quant_config
elif
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
model_path
,
"hf_quant_config.json"
)):
elif
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
model_path
,
"hf_quant_config.json"
)):
quant_config_file
=
os
.
path
.
join
(
quant_config_file
=
os
.
path
.
join
(
self
.
model_path
,
"hf_quant_config.json"
self
.
model_path
,
"hf_quant_config.json"
...
...
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