invoke-ai/InvokeAI · critical · RuntimeError
Failed to load all parameters from GGUF. The following remai
Error message
Failed to load all parameters from GGUF. The following remain as meta tensors: {meta_names}. This may indicate missing keys in the GGUF file or a key mapping issue. What it means
After instantiating the model on the meta device and loading GGUF tensors, the loader checks named_parameters() for any parameter still on the meta device. Meta parameters mean assign_* never populated them — the GGUF file lacks corresponding keys or the model's key mapping doesn't match the file, so silently re-initialized meta buffers were warned but some params remained unassigned.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/z_image.py:1370
if buffer_name == "inv_freq":
# Compute inv_freq from config - keep on CPU, cache system will move to GPU as needed
# NB: transformers 5.x moved rope_theta into the rope_parameters/rope_scaling dict
rope_params = (
getattr(qwen_config, "rope_parameters", None)
or getattr(qwen_config, "rope_scaling", None)
or {}
)
base = rope_params.get("rope_theta") or getattr(qwen_config, "rope_theta", 1000000.0)
inv_freq = 1.0 / (base ** (torch.arange(0, head_dim, 2, dtype=torch.float32) / head_dim))
parent.register_buffer(buffer_name, inv_freq.to(dtype=compute_dtype), persistent=False)
else:
logger.warning(f"Re-initializing unknown meta buffer: {name}")
# Final check: ensure no meta tensors remain in parameters
meta_params = [(name, p) for name, p in model.named_parameters() if p.is_meta]
if meta_params:
meta_names = [name for name, _ in meta_params]
raise RuntimeError(
f"Failed to load all parameters from GGUF. The following remain as meta tensors: {meta_names}. "
"This may indicate missing keys in the GGUF file or a key mapping issue."
)
return model
def _convert_llamacpp_to_pytorch(self, sd: dict[str, Any]) -> dict[str, Any]:
"""Convert llama.cpp GGUF keys to PyTorch/HuggingFace format for Qwen models.
llama.cpp format:
- blk.X.attn_q.weight -> model.layers.X.self_attn.q_proj.weight
- blk.X.attn_k.weight -> model.layers.X.self_attn.k_proj.weight
- blk.X.attn_v.weight -> model.layers.X.self_attn.v_proj.weight
- blk.X.attn_output.weight -> model.layers.X.self_attn.o_proj.weight
- blk.X.attn_q_norm.weight -> model.layers.X.self_attn.q_norm.weight (Qwen3 QK norm)
- blk.X.attn_k_norm.weight -> model.layers.X.self_attn.k_norm.weight (Qwen3 QK norm)
- blk.X.ffn_gate.weight -> model.layers.X.mlp.gate_proj.weight
- blk.X.ffn_up.weight -> model.layers.X.mlp.up_proj.weightView on GitHub (pinned to 0b6a024f2f)
Solutions
- Re-download the complete GGUF and compare tensor count/names against what the loader expects.
- Check the first warning lines ('Re-initializing unknown meta buffer') — the names listed indicate which keys mismatch; remap or re-export the GGUF accordingly.
- Update InvokeAI (and its z_image model definition) so the module tree matches your GGUF revision.
- Fall back to the safetensors checkpoint if the GGUF was converted from an incompatible architecture version.
Example fix
// before: GGUF missing layer tensors meta_params: ['model.layers.5.self_attn.q_proj.weight', ...] // after: complete file gguf-dump shows all model.layers.* tensors; load succeeds
Defensive patterns
Strategy: try-catch
Validate before calling
# pre-check: GGUF tensor count vs expected model parameter count
tensor_count = len(gguf.GGUFReader(path).tensors)
expected = count_expected_qwen3_encoder_tensors()
if tensor_count < expected:
raise ValueError(f"GGUF {path} looks truncated: {tensor_count}/{expected} tensors") Type guard
def gguf_covers_model(path: str, model_keys: set[str]) -> bool:
names = {t.name for t in gguf.GGUFReader(path).tensors}
return all(k in names for k in model_keys) Try / catch
try:
model = load_text_encoder(cfg)
except RuntimeError as e:
if "remain as meta tensors" in str(e):
# meta names in the message identify the missing/mismatched keys
repair_or_redownload_gguf(cfg.path, missing_hint=str(e))
else:
raise Prevention
- Watch for the loader's earlier 'Re-initializing unknown meta buffer' warnings — treat them as red flags.
- Re-download truncated GGUFs and verify hashes.
- Keep InvokeAI and converted models from the same architecture revision.
- Prefer official GGUF releases over ad-hoc conversions.
When it happens
Trigger: _load_from_gguf: the GGUF file is missing tensors that the module tree expects (truncated download), key names differ from what the model expects (prefix mismatch, renamed layers), or quantized tensor types unsupported so assignment was skipped.
Common situations: Partial GGUF download; GGUF produced for a slightly different architecture revision than the loader's model class; custom quant formats not covered by the dequant path.
Related errors
- Could not find attention/mlp weights in state dict to determ
- Only MistralEncoder_GGUF_Config models are supported here.
- Expected Main_GGUF_Wan_Config, got {type(config).__name__}.
- Only the Transformer submodel is available from a GGUF Wan c
- Cannot split QKV tensor '{key}': first dimension ({tensor.sh
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/9186c749cafc4ce8.
Report an issue: GitHub.