{"record":{"id":"89534e9cb9e6714f","repo":"huggingface/transformers","slug":"failed-to-apply-weight-conversion-for-renamed-ke","errorCode":null,"errorMessage":"Failed to apply weight conversion for '{renamed_key}'. This likely means the checkpoint format is incompatible with the current model version. Error: {e}","messagePattern":"Failed to apply weight conversion for '(.+?)'\\. This likely means the checkpoint format is incompatible with the current model version\\. Error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/transformers/integrations/deepspeed.py","lineNumber":426,"sourceCode":"                mapping.add_tensor(renamed_key, original_key, source_pattern, tensor)\n            else:\n                # No conversion needed - add tensor directly to new_state_dict\n                # (this handles keys like embed_tokens, lm_head, layernorm, attention)\n                new_state_dict[renamed_key] = tensor\n\n    # Apply the conversions and build the new state dict\n    for renamed_key, mapping in conversion_mapping.items():\n        try:\n            realized_value = mapping.convert(\n                renamed_key,\n                model=model,\n                config=model.config,\n            )\n            for target_name, param in realized_value.items():\n                param = param[0] if isinstance(param, list) else param\n                new_state_dict[target_name] = param\n        except Exception as e:\n            raise RuntimeError(\n                f\"Failed to apply weight conversion for '{renamed_key}'. \"\n                f\"This likely means the checkpoint format is incompatible with the current model version. \"\n                f\"Error: {e}\"\n            ) from e\n\n    # Attach metadata to the new state dict\n    if metadata is not None:\n        new_state_dict._metadata = metadata\n\n    return new_state_dict\n\n\ndef _load_state_dict_into_zero3_model(model_to_load, state_dict, load_config=None):\n    \"\"\"\n    Loads state dict into a model specifically for Zero3, since DeepSpeed does not support the `transformers`\n    tensor parallelism API.\n\n    Nearly identical code to PyTorch's `_load_from_state_dict`","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/integrations/deepspeed.py#L408-L444","documentation":"Error \"Failed to apply weight conversion for '{renamed_key}'. This likely means the checkpoint format is incompatible with the current model version. Error: {e}\" thrown in huggingface/transformers.","triggerScenarios":"Raised when a weight conversion for a specific checkpoint key fails during DeepSpeed loading.","commonSituations":"Checkpoint saved in an older or incompatible format loaded into a model version with different weight layout.","solutions":["Update the checkpoint to a format compatible with the current model version.","Check the underlying error and adjust the weight conversion mapping."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}