{"record":{"id":"4a02246e34fe9faa","repo":"Lightning-AI/pytorch-lightning","slug":"default-message-it-looks-like-you-passed-the-pa-4a0224","errorCode":null,"errorMessage":"{default_message}. It looks like you passed the path to a file inside a DeepSpeed checkpoint folder. Try to load using this parent directory instead: {grandparent}","messagePattern":"(.+?)\\. It looks like you passed the path to a file inside a DeepSpeed checkpoint folder\\. Try to load using this parent directory instead: (.+?)","errorType":"error_code","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/strategies/deepspeed.py","lineNumber":924,"sourceCode":"    # └── zero_to_fp32.py\n\n    path_str = str(path)\n    fs = get_filesystem(path_str)\n    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`.\")","sourceCodeStart":906,"sourceCodeEnd":942,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/strategies/deepspeed.py#L906-L942","documentation":"Variant of the checkpoint path validation: the path is a file whose grandparent directory is a valid DeepSpeed checkpoint (e.g. .../global_step10/checkpoint/zero_to_fp16.py). Lightning tells you to load the grandparent directory instead.","triggerScenarios":"load_checkpoint pointing at a file inside a DeepSpeed checkpoint folder, such as a zero_to_* shard, the mp_rank sd file, or latest inside the checkpoint subfolder.","commonSituations":"User drills into the checkpoint dir and picks one of the shard files, assuming it is a consolidated checkpoint; globbing for *.pt inside the save dir; copying a single shard to another machine.","solutions":["Pass the checkpoint directory (the grandparent printed in the message), e.g. .../global_step10","If you truly have a single full-weights file, use DeepSpeedStrategy(..., load_full_weights=True) and the file itself"],"exampleFix":"# before\nfabric.load_checkpoint(\"save/step10/checkpoint/zero_to_fp16.pt\", state)\n\n# after\nfabric.load_checkpoint(\"save/step10\", state)","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(ckpt_path)\nif p.is_file() and p.parent.parent.joinpath(\"checkpoint\").is_dir():\n    ckpt_path = str(p.parent.parent)","typeGuard":null,"tryCatchPattern":"try:\n    fabric.load_checkpoint(path, state)\nexcept FileNotFoundError as e:\n    if \"parent directory instead\" in str(e):\n        suggested = str(e).split(\"parent directory instead: \")[-1].rstrip(\".\")\n        fabric.load_checkpoint(suggested, state)","preventionTips":["Never pass individual shard files to load_checkpoint","Use load_full_weights=True only for genuinely single-file saves"],"tags":["deepspeed","checkpoint","path","load"],"backgroundTag":"checkpoint-path-invalid","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}