invoke-ai/InvokeAI · critical · RuntimeError
Failed to load all parameters from SDNQ. The following remai
Error message
Failed to load all parameters from SDNQ. The following remain as meta tensors: {meta_names}. What it means
Raised at the end of the SDNQ Z-Image Qwen3 encoder load path (_load_from_sdnq) when, after load_state_dict with assign=True, tied-weight handling, and meta-buffer re-initialization, model.named_parameters() still contains torch meta tensors. It means the SDNQ checkpoint did not supply materialized weights for every parameter the freshly-initialized Qwen3ForCausalLM declares, so the model would be unusable on device. The loader fails fast rather than producing a model with missing weights.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/z_image.py:1626
if len(parts) == 2:
parent = model.get_submodule(parts[0])
buffer_name = parts[1]
else:
parent = model
buffer_name = name
if buffer_name == "inv_freq":
base = qwen_config.rope_theta
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 SDNQ. The following remain as meta tensors: {meta_names}."
)
return model
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Re-download the SDNQ checkpoint from its official source; the file is likely truncated or from an incompatible export.
- Check the meta_names list in the message and compare against the checkpoint's keys (safetensors header / gguf listing) to find which tensors are missing or renamed.
- Verify the transformers/accelerate versions match what the model card requires, since Qwen3 parameter names can shift between versions.
- If you re-saved the quantized file, redo the conversion so all parameters are written; lm_head.weight is the only acceptable omission (tied weights).
- Regenerate the model with the correct Qwen3Config (layer count, vocab size) matching the checkpoint.
Example fix
// before
model = Qwen3ForCausalLM(wrong_config) # e.g. vocab_size from a different tokenizer
missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)
// after
model = Qwen3ForCausalLM(qwen_config_built_from_checkpoint) # sizes derived from the SDNQ sd
missing, unexpected = model.load_state_dict(sd, strict=False, assign=True)
raise_on_incomplete_sdnq_load('SDNQ Qwen3 encoder', missing, unexpected, allowed_missing={'lm_head.weight'}) Defensive patterns
Strategy: validation
Validate before calling
import torch
def assert_no_meta_params(model: torch.nn.Module) -> None:
meta = [n for n, p in model.named_parameters() if p.is_meta]
if meta:
raise RuntimeError(f'Missing weights for: {meta}') Type guard
def has_meta_params(model: torch.nn.Module) -> bool:
return any(p.is_meta for _, p in model.named_parameters()) Try / catch
try:
model = loader._load_from_sdnq(...)
except RuntimeError as e:
if 'remain as meta tensors' in str(e):
logger.error(f'SDNQ checkpoint incomplete: {e}. Re-download the model file.')
raise
raise Prevention
- Download SDNQ checkpoints only from official sources and verify file hashes
- Keep transformers/accelerate versions aligned with the model card requirements
- Never hand-edit or partially re-save quantized checkpoints
- Compare checkpoint keys against expected Qwen3 parameter names before loading
When it happens
Trigger: Loading an SDNQ-quantized Z-Image text-encoder checkpoint whose state dict is missing required parameters (other than the allowed lm_head.weight), or contains keys from an incompatible/contaminated SDNQ export that don't match Qwen3ForCausalLM's expected names; also when load_state_dict(assign=True) leaves parameters unassigned because names/shapes mismatch.
Common situations: Using an SDNQ export of the wrong architecture or a partially-converted checkpoint; a library/transformers version where Qwen3 parameter names changed; hand-trimmed or re-saved quantized files that dropped tensors; mismatches between the config's num_hidden_layers/vocab_size and the checkpoint contents.
Related errors
- Only Main_SDNQ_ZImage_Config or Main_SDNQ_Diffusers_ZImage_C
- transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_FLUX_
- transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_Flux2
- transformer is SDNQ-quantized; use Main_SDNQ_Diffusers_ZImag
- folder is SDNQ-quantized; use Qwen3Encoder_SDNQ_Folder_Confi
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/ae78b86992f8df42.
Report an issue: GitHub.