invoke-ai/InvokeAI · error · RuntimeError

Failed to load all parameters from checkpoint. Meta tensors

Error message

Failed to load all parameters from checkpoint. Meta tensors remain: {meta_params[:5]}

What it means

When materializing a single-file Qwen VL text encoder, InvokeAI builds the model on the meta device and copies checkpoint weights in. If some parameters remain meta tensors after loading (the checkpoint was missing them or key mapping failed), the resulting model is unusable and this RuntimeError is raised listing the first few unloaded parameter names.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/qwen_image.py:483

                continue
            parts = name.rsplit(".", 1)
            if len(parts) == 2:
                parent = model.get_submodule(parts[0])
                buffer_name = parts[1]
            else:
                parent = model
                buffer_name = name
            # Replace meta buffer with a real (zero) tensor of the same shape; the model
            # will recompute or refill these as needed at first forward pass.
            try:
                shape = buffer.shape
                parent.register_buffer(buffer_name, torch.zeros(shape, dtype=model_dtype), persistent=False)
            except Exception:
                logger.warning(f"Could not re-initialise meta buffer {name}")

        meta_params = [name for name, p in model.named_parameters() if p.is_meta]
        if meta_params:
            raise RuntimeError(f"Failed to load all parameters from checkpoint. Meta tensors remain: {meta_params[:5]}")

        model.eval()
        return model

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Re-download or re-export the single-file checkpoint; verify it is a complete, untruncated safetensors file.
  2. Ensure the architecture config matches the checkpoint (use the config from the same Qwen2.5-VL repo/variant the checkpoint was exported from).
  3. Inspect the reported meta parameter names and remap/rename checkpoint keys if the checkpoint uses a different naming scheme.
  4. Fall back to the diffusers folder layout install, which avoids the single-file weight-mapping path.

Example fix

# before: mismatched checkpoint -> RuntimeError: Meta tensors remain ['model.layers.0...']
# after: re-download correct checkpoint matching Qwen2.5-VL-7B-Instruct
huggingface-cli download Qwen/Qwen2.5-VL-7B-Instruct --include "*.safetensors"
Defensive patterns

Strategy: validation

Validate before calling

from safetensors import safe_open
with safe_open(path, framework="pt") as f:
    keys = set(f.keys())
print(f"{len(keys)} tensors in checkpoint")  # sanity-check completeness before loading

Try / catch

try:
    enc = loader.load_model(config, submodel_type=SubModelType.TextEncoder)
except RuntimeError as e:
    if "Meta tensors remain" in str(e):
        logger.error("Checkpoint incomplete/key mismatch: %s", e)
    raise

Prevention

When it happens

Trigger: The single-file checkpoint lacks weights for parameters the instantiated Qwen2.5-VL model defines (key-name mismatch, truncated/partial checkpoint, wrong architecture config applied), so safetensors loading skips those keys.

Common situations: Corrupted or partially downloaded .safetensors; a checkpoint from a different Qwen variant whose key names don't match the Qwen2.5-VL config; weights-only rename/refactor mismatches.

Related errors


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