{"record":{"id":"f68a1d238aa724a2","repo":"invoke-ai/InvokeAI","slug":"failed-to-load-all-parameters-from-checkpoint-met","errorCode":null,"errorMessage":"Failed to load all parameters from checkpoint. Meta tensors remain: {meta_params[:5]}","messagePattern":"Failed to load all parameters from checkpoint\\. Meta tensors remain: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/qwen_image.py","lineNumber":483,"sourceCode":"                continue\n            parts = name.rsplit(\".\", 1)\n            if len(parts) == 2:\n                parent = model.get_submodule(parts[0])\n                buffer_name = parts[1]\n            else:\n                parent = model\n                buffer_name = name\n            # Replace meta buffer with a real (zero) tensor of the same shape; the model\n            # will recompute or refill these as needed at first forward pass.\n            try:\n                shape = buffer.shape\n                parent.register_buffer(buffer_name, torch.zeros(shape, dtype=model_dtype), persistent=False)\n            except Exception:\n                logger.warning(f\"Could not re-initialise meta buffer {name}\")\n\n        meta_params = [name for name, p in model.named_parameters() if p.is_meta]\n        if meta_params:\n            raise RuntimeError(f\"Failed to load all parameters from checkpoint. Meta tensors remain: {meta_params[:5]}\")\n\n        model.eval()\n        return model\n","sourceCodeStart":465,"sourceCodeEnd":487,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/qwen_image.py#L465-L487","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-download or re-export the single-file checkpoint; verify it is a complete, untruncated safetensors file.","Ensure the architecture config matches the checkpoint (use the config from the same Qwen2.5-VL repo/variant the checkpoint was exported from).","Inspect the reported meta parameter names and remap/rename checkpoint keys if the checkpoint uses a different naming scheme.","Fall back to the diffusers folder layout install, which avoids the single-file weight-mapping path."],"exampleFix":"# before: mismatched checkpoint -> RuntimeError: Meta tensors remain ['model.layers.0...']\n# after: re-download correct checkpoint matching Qwen2.5-VL-7B-Instruct\nhuggingface-cli download Qwen/Qwen2.5-VL-7B-Instruct --include \"*.safetensors\"","handlingStrategy":"validation","validationCode":"from safetensors import safe_open\nwith safe_open(path, framework=\"pt\") as f:\n    keys = set(f.keys())\nprint(f\"{len(keys)} tensors in checkpoint\")  # sanity-check completeness before loading","typeGuard":null,"tryCatchPattern":"try:\n    enc = loader.load_model(config, submodel_type=SubModelType.TextEncoder)\nexcept RuntimeError as e:\n    if \"Meta tensors remain\" in str(e):\n        logger.error(\"Checkpoint incomplete/key mismatch: %s\", e)\n    raise","preventionTips":["Verify checkpoint file size/hash after download.","Match the architecture config to the checkpoint's Qwen variant.","Log and inspect reported meta parameter names to catch key-mapping mismatches early."],"tags":["checkpoint","safetensors","meta-tensor","weight-loading","qwen"],"backgroundTag":"checkpoint-weight-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}