invoke-ai/InvokeAI · error · ValueError

No weight files found for this model

Error message

No weight files found for this model

What it means

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.

Source

Thrown at invokeai/backend/model_manager/model_on_disk.py:166

                raise ValueError(f"Unrecognized model extension: {path.suffix}")

        state_dict = checkpoint.get("state_dict", checkpoint)

        # Normalize PEFT named-adapter keys (e.g. `lora_A.default.weight` → `lora_A.weight`).
        # Pattern is LoRA-specific, so this is a no-op for non-LoRA state dicts.
        from invokeai.backend.patches.lora_conversions.peft_adapter_utils import normalize_peft_adapter_names

        state_dict = normalize_peft_adapter_names(state_dict)

        self._state_dict_cache[path] = state_dict
        return state_dict

    def resolve_weight_file(self, path: Optional[Path] = None) -> Path:
        if not path:
            weight_files = list(self.weight_files())
            match weight_files:
                case []:
                    raise ValueError("No weight files found for this model")
                case [p]:
                    return p
                case ps if len(ps) >= 2:
                    raise ValueError(
                        f"Multiple weight files found for this model: {ps}. "
                        f"Please specify the intended file using the 'path' argument"
                    )
        return path

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Point directly at the weight file: resolve_weight_file(path=Path('.../model.safetensors')) or load_state_dict(path=...).
  2. If it's a diffusers pipeline directory, target the component subfolder that contains weights (e.g. transformer/, text_encoder/).
  3. 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.
  4. List the directory (ls -la) to confirm what was actually downloaded; re-download if weights are missing or truncated.

Example fix

// before
mod = ModelOnDisk(Path('models/black-forest-labs/FLUX.1-schnell'))  # pipeline root
sd = mod.load_state_dict()  # ValueError: no weight files
// after
mod = ModelOnDisk(Path('models/black-forest-labs/FLUX.1-schnell/transformer'))
sd = mod.load_state_dict()
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
WEIGHT_SUFFIXES = ('.safetensors', '.gguf', '.ckpt', '.pt', '.pth', '.bin')
def dir_has_weights(d: Path) -> bool:
    return any(f.suffix in WEIGHT_SUFFIXES for f in d.rglob('*') if f.is_file())

Type guard

def has_weight_files(mod) -> bool:
    return len(list(mod.weight_files())) > 0

Try / catch

try:
    p = mod.resolve_weight_file()
except ValueError as e:
    if 'No weight files found' in str(e):
        logger.error(f'{mod.path} has no weights; re-download with git-lfs/huggingface-cli.')
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/ae9a823e495fc2ff. Report an issue: GitHub.