{"record":{"id":"ae9a823e495fc2ff","repo":"invoke-ai/InvokeAI","slug":"no-weight-files-found-for-this-model","errorCode":null,"errorMessage":"No weight files found for this model","messagePattern":"No weight files found for this model","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/model_on_disk.py","lineNumber":166,"sourceCode":"                raise ValueError(f\"Unrecognized model extension: {path.suffix}\")\n\n        state_dict = checkpoint.get(\"state_dict\", checkpoint)\n\n        # Normalize PEFT named-adapter keys (e.g. `lora_A.default.weight` → `lora_A.weight`).\n        # Pattern is LoRA-specific, so this is a no-op for non-LoRA state dicts.\n        from invokeai.backend.patches.lora_conversions.peft_adapter_utils import normalize_peft_adapter_names\n\n        state_dict = normalize_peft_adapter_names(state_dict)\n\n        self._state_dict_cache[path] = state_dict\n        return state_dict\n\n    def resolve_weight_file(self, path: Optional[Path] = None) -> Path:\n        if not path:\n            weight_files = list(self.weight_files())\n            match weight_files:\n                case []:\n                    raise ValueError(\"No weight files found for this model\")\n                case [p]:\n                    return p\n                case ps if len(ps) >= 2:\n                    raise ValueError(\n                        f\"Multiple weight files found for this model: {ps}. \"\n                        f\"Please specify the intended file using the 'path' argument\"\n                    )\n        return path\n","sourceCodeStart":148,"sourceCodeEnd":175,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/model_on_disk.py#L148-L175","documentation":"ModelOnDisk.resolve_weight_file finds the single weight file in a model directory to load; if the directory contains no recognized weight files at all it raises this ValueError. Diffusers models keep weights in subfolders, so a repo scanned at the wrong level can legitimately have none at the root.","triggerScenarios":"resolve_weight_file() (no path argument) on a ModelOnDisk whose weight_files() returns [] — e.g. a checked-out HF snapshot directory containing only configs/tokenizer files, an empty/partial download, or a diffusers repo whose weights live one level deeper.","commonSituations":"Downloading a repo without LFS files (git clone without git-lfs, so .safetensors are pointer files of the wrong type or absent); pointing at a diffusers pipeline root instead of a component subfolder (unet/, text_encoder/); interrupted downloads; text-only repos mistakenly imported as models.","solutions":["Point directly at the weight file: resolve_weight_file(path=Path('.../model.safetensors')) or load_state_dict(path=...).","If it's a diffusers pipeline directory, target the component subfolder that contains weights (e.g. transformer/, text_encoder/).","Re-run the download with git-lfs enabled or via huggingface-cli download so actual weight files are fetched; check for small LFS pointer files.","List the directory (ls -la) to confirm what was actually downloaded; re-download if weights are missing or truncated."],"exampleFix":"// before\nmod = ModelOnDisk(Path('models/black-forest-labs/FLUX.1-schnell'))  # pipeline root\nsd = mod.load_state_dict()  # ValueError: no weight files\n// after\nmod = ModelOnDisk(Path('models/black-forest-labs/FLUX.1-schnell/transformer'))\nsd = mod.load_state_dict()","handlingStrategy":"validation","validationCode":"from pathlib import Path\nWEIGHT_SUFFIXES = ('.safetensors', '.gguf', '.ckpt', '.pt', '.pth', '.bin')\ndef dir_has_weights(d: Path) -> bool:\n    return any(f.suffix in WEIGHT_SUFFIXES for f in d.rglob('*') if f.is_file())","typeGuard":"def has_weight_files(mod) -> bool:\n    return len(list(mod.weight_files())) > 0","tryCatchPattern":"try:\n    p = mod.resolve_weight_file()\nexcept ValueError as e:\n    if 'No weight files found' in str(e):\n        logger.error(f'{mod.path} has no weights; re-download with git-lfs/huggingface-cli.')\n    raise","preventionTips":["Install models with huggingface-cli download or git-lfs so weight files actually land on disk","For diffusers pipelines, target the component subfolder (transformer/, text_encoder/) not the pipeline root","Check for tiny LFS pointer files after cloning; re-fetch if weights are KB-sized","Verify downloads completed (expected file sizes) before importing"],"tags":["model-loading","missing-file","diffusers","download","validation"],"backgroundTag":"no-weight-files-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}