{"record":{"id":"0cc893e556d6011f","repo":"Lightning-AI/pytorch-lightning","slug":"the-provided-path-is-not-a-valid-deepspeed-checkpo","errorCode":null,"errorMessage":"The provided path is not a valid DeepSpeed checkpoint: {path_str}","messagePattern":"The provided path is not a valid DeepSpeed checkpoint: (.+?)","errorType":"error_code","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/strategies/deepspeed.py","lineNumber":928,"sourceCode":"    path_is_ds_checkpoint = _is_deepspeed_checkpoint(path_str, fs)\n    default_message = f\"The provided path is not a valid DeepSpeed checkpoint: {path_str}\"\n\n    if not path_is_ds_checkpoint:\n        # Case 1: User may have accidentally passed the subfolder \"checkpoint\"\n        parent = os.path.dirname(path_str)\n        if _is_deepspeed_checkpoint(parent, fs):\n            raise FileNotFoundError(\n                f\"{default_message}. It looks like you passed the path to a subfolder.\"\n                f\" Try to load using this parent directory instead: {parent}\"\n            )\n        # Case 2: User may have accidentally passed the path to a file inside the \"checkpoint\" subfolder\n        grandparent = os.path.dirname(parent)\n        if fs.isfile(path_str) and _is_deepspeed_checkpoint(grandparent, fs):\n            raise FileNotFoundError(\n                f\"{default_message}. It looks like you passed the path to a file inside a DeepSpeed\"\n                f\" checkpoint folder. Try to load using this parent directory instead: {grandparent}\"\n            )\n        raise FileNotFoundError(default_message)\n\n\ndef _format_precision_config(\n    config: dict[str, Any],\n    precision: str,\n    loss_scale: float,\n    loss_scale_window: int,\n    min_loss_scale: int,\n    initial_scale_power: int,\n    hysteresis: int,\n) -> None:\n    if \"fp16\" not in config and precision in (\"16-mixed\", \"16-true\"):\n        # FP16 is a DeepSpeed standalone AMP implementation\n        rank_zero_info(\"Enabling DeepSpeed FP16. Model parameters and inputs will be cast to `float16`.\")\n        config[\"fp16\"] = {\n            \"enabled\": True,\n            \"loss_scale\": loss_scale,\n            \"initial_scale_power\": initial_scale_power,","sourceCodeStart":910,"sourceCodeEnd":946,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/strategies/deepspeed.py#L910-L946","documentation":"Fallback case of _validate_checkpoint_directory: the path is neither a DeepSpeed checkpoint, nor a subfolder/file of one. Lightning raises FileNotFoundError with the plain 'not a valid DeepSpeed checkpoint' message.","triggerScenarios":"load_checkpoint with an arbitrary directory, a non-checkpoint file, a nonexistent-but-directory-like path, or an empty/failed save directory while using DeepSpeedStrategy.","commonSituations":"Resuming from a checkpoint saved by a different strategy or plain torch.save; a crashed/interrupted save leaving an incomplete directory; passing the run dir instead of the checkpoint dir; wrong remote bucket path.","solutions":["Inspect the directory: a DeepSpeed checkpoint contains a checkpoint/ subfolder with zero_to_* or mp_rank_* files","Re-save or regenerate the checkpoint with DeepSpeed/Fabric if it came from another framework","Point at the correct tag directory (e.g. .../lightning_logs/version_0/checkpoint/global_step10)","If the file is a single consolidated checkpoint, use DeepSpeedStrategy(..., load_full_weights=True)"],"exampleFix":"# before\nfabric.load_checkpoint(\"./my_run\", state)  # not a DS checkpoint\n\n# after\nfabric.load_checkpoint(\"./my_run/checkpoint/global_step10\", state)","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef is_ds_ckpt_dir(p: str) -> bool:\n    p = Path(p)\n    return (p / \"checkpoint\").is_dir() or p.name.startswith(\"global_step\")\nassert is_ds_ckpt_dir(ckpt_path), f\"not a DeepSpeed checkpoint: {ckpt_path}\"","typeGuard":null,"tryCatchPattern":"try:\n    fabric.load_checkpoint(path, state)\nexcept FileNotFoundError as e:\n    if \"not a valid DeepSpeed checkpoint\" in str(e):\n        # search save dir for tag folders\n        candidates = sorted(Path(save_dir).glob(\"**/global_step*\"))\n        ...","preventionTips":["Verify checkpoint layout before loading","Keep checkpoints and code versions paired"],"tags":["deepspeed","checkpoint","path","load"],"backgroundTag":"checkpoint-invalid","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}