Fix Mistral-native format detection when the Hub is unreachable (#43446)

This commit is contained in:
Alison Shao
2026-10-11 19:59:19 -07:00
committed by GitHub
parent 3c74f68a9c
commit 1a7af3290d
+16 -13
View File
@@ -15,7 +15,7 @@ from sglang.srt.arg_groups.overrides import (
resolving_view,
run_post_process_pass,
)
from sglang.srt.utils.common import is_remote_url
from sglang.srt.utils.common import find_local_repo_dir, is_remote_url
from sglang.srt.utils.hf_transformers_utils import check_gguf_file
from sglang.srt.utils.runai_utils import ObjectStorageModel, is_runai_obj_uri
@@ -351,16 +351,19 @@ def is_mistral_native_format(server_args: Any) -> bool:
from huggingface_hub import HfApi
files = {s.rfilename for s in HfApi().model_info(cfg.model_path).siblings}
return _check_format(
has_params="params.json" in files,
has_consolidated=any(
f.startswith("consolidated") and f.endswith(".safetensors")
for f in files
),
has_hf_weights=any(
f.startswith("model") and f.endswith(".safetensors") and "/" not in f
for f in files
),
)
except Exception:
return False
# Hub unreachable (offline, rate-limited): judge from the local snapshot.
snapshot_dir = find_local_repo_dir(cfg.model_path, cfg.revision)
if snapshot_dir is None:
return False
files = set(os.listdir(snapshot_dir))
return _check_format(
has_params="params.json" in files,
has_consolidated=any(
f.startswith("consolidated") and f.endswith(".safetensors") for f in files
),
has_hf_weights=any(
f.startswith("model") and f.endswith(".safetensors") and "/" not in f
for f in files
),
)