From c494e478433f066ecd5a8010613767fce54e33a5 Mon Sep 17 00:00:00 2001 From: YC Yen-Ching Tseng Date: Wed, 25 Mar 2026 16:10:21 +0800 Subject: [PATCH] [AMD] Fix stage-b-test-small-1-gpu-amd (test_tool_choice.py) (#19868) --- python/sglang/srt/server_args.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index ac7847366..3b4659631 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -3143,15 +3143,24 @@ class ServerArgs: ) def _is_mistral_native_format(self) -> bool: - """Detect if the model uses Mistral native format (params.json + consolidated weights).""" + """Detect if the model uses Mistral native format (params.json + consolidated weights). + + Models like Mistral-7B-Instruct-v0.3 have BOTH params.json (native) and + config.json (HF standard). When both exist, prefer the HF format to avoid + parameter name mismatches between consolidated.safetensors (native names + like layers.0.attention.wk.weight) and HuggingFace model classes (names + like model.layers.0.self_attn.k_proj.weight). + """ if os.path.isdir(self.model_path): - return os.path.exists(os.path.join(self.model_path, "params.json")) + has_params = os.path.exists(os.path.join(self.model_path, "params.json")) + has_hf_config = os.path.exists(os.path.join(self.model_path, "config.json")) + return has_params and not has_hf_config # For hub models, check remote files try: from huggingface_hub import HfApi files = {s.rfilename for s in HfApi().model_info(self.model_path).siblings} - return "params.json" in files + return "params.json" in files and "config.json" not in files except Exception: return False