{"record":{"id":"e9e56f945e0da1c1","repo":"sgl-project/sglang","slug":"no-model-weights-found-in-path-expected-model-s","errorCode":null,"errorMessage":"No model weights found in {path} (expected model.safetensors or pytorch_model.bin)","messagePattern":"No model weights found in (.+?) \\(expected model\\.safetensors or pytorch_model\\.bin\\)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/models/mimo_audio.py","lineNumber":1293,"sourceCode":"    ) -> MiMoAudioTokenizer:\n        \"\"\"Load MiMoAudioTokenizer manually to avoid new-transformers compat issues.\"\"\"\n        import json\n\n        from safetensors.torch import load_file\n\n        config_path = os.path.join(path, \"config.json\")\n        with open(config_path) as f:\n            config_dict = json.load(f)\n        config = MiMoAudioTokenizer.config_class(**config_dict)\n        model = MiMoAudioTokenizer(config)\n        safetensors_path = os.path.join(path, \"model.safetensors\")\n        bin_path = os.path.join(path, \"pytorch_model.bin\")\n        if os.path.exists(safetensors_path):\n            state_dict = load_file(safetensors_path, device=\"cpu\")\n        elif os.path.exists(bin_path):\n            state_dict = torch.load(bin_path, map_location=\"cpu\", weights_only=True)\n        else:\n            raise FileNotFoundError(\n                f\"No model weights found in {path} \"\n                \"(expected model.safetensors or pytorch_model.bin)\"\n            )\n        state_dict = _remap_audio_tokenizer_state_dict(state_dict)\n        model.load_state_dict(state_dict, strict=False)\n        model = model.to(device=device, dtype=torch.bfloat16)\n        model.eval()\n        model.requires_grad_(False)\n        return model\n\n    def apply_input_local_transformer(\n        self, speech_embeddings: torch.Tensor\n    ) -> torch.Tensor:\n        return self.input_local_transformer(\n            inputs_embeds=speech_embeddings,\n            return_dict=True,\n            is_causal=not self.audio_input_full_attention,  # for SDPA\n        ).last_hidden_state  # [T//group_size, group_size, input_local_dim]","sourceCodeStart":1275,"sourceCodeEnd":1311,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/mimo_audio.py#L1275-L1311","documentation":"When building the MiMo audio tokenizer, sglang loads weights from model.safetensors or pytorch_model.bin inside the model directory; if neither file exists it raises FileNotFoundError. The path is resolved from the loaded model's model_path (downloading via huggingface_hub if needed), so this means the local directory lacks any weight file.","triggerScenarios":"The MiMo model path points to a directory containing only config/shards (e.g. sharded safetensors with index but no single model.safetensors), or a partially downloaded/corrupted snapshot cache. Raises after snapshot_download when files still aren't present.","commonSituations":"Interrupted HF downloads leaving an incomplete cache; locally exported checkpoints saved as sharded files (model-00001-of-...safetensors) rather than single-file; wrong --model-path pointing at a config-only dir.","solutions":["Point --model-path at a complete MiMo audio tokenizer snapshot containing model.safetensors or pytorch_model.bin","Clear the incomplete HF cache (rm -rf ~/.cache/huggingface/hub/<repo>) and re-download so snapshot_download completes","If the checkpoint is sharded, merge shards or name the output as model.safetensors before loading"],"exampleFix":"# before\nls /models/mimo-audio/  # config.json only\n# after\nhuggingface-cli download <mimo-audio-repo> --local-dir /models/mimo-audio\nls /models/mimo-audio/  # config.json model.safetensors","handlingStrategy":"validation","validationCode":"import os\npath = model_path\nok = os.path.exists(os.path.join(path, \"model.safetensors\")) or os.path.exists(os.path.join(path, \"pytorch_model.bin\"))\nassert ok, f\"no single-file weights in {path}\"","typeGuard":"def has_single_file_weights(path: str) -> bool:\n    return os.path.isfile(os.path.join(path, \"model.safetensors\")) or os.path.isfile(os.path.join(path, \"pytorch_model.bin\"))","tryCatchPattern":"try:\n    tok = load_mimo_audio_tokenizer(model_path)\nexcept FileNotFoundError as e:\n    raise RuntimeError(f\"audio tokenizer incomplete at {model_path}; re-download\") from e","preventionTips":["Verify downloaded snapshot contents before starting the server","Clear partial HF caches after interrupted downloads","Avoid sharded-only local exports for MiMo audio weights"],"tags":["mimo-audio","model-loading","file-not-found","huggingface","weights"],"backgroundTag":"model-weights-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}