{"record":{"id":"63d2fc9198c275e1","repo":"Lightning-AI/pytorch-lightning","slug":"default-message-it-looks-like-you-passed-the-pa","errorCode":null,"errorMessage":"{default_message}. It looks like you passed the path to a subfolder. Try to load using this parent directory instead: {parent}","messagePattern":"(.+?)\\. It looks like you passed the path to a subfolder\\. 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":917,"sourceCode":"    # epoch=5-step=10999.ckpt\n    # ├── checkpoint\n    # │   ├── zero_pp_rank_0_mp_rank_00_model_states.pt\n    # │   ├── zero_pp_rank_0_mp_rank_00_optim_states.pt\n    # │   ├── zero_pp_rank_1_mp_rank_00_model_states.pt\n    # │   └── zero_pp_rank_1_mp_rank_00_optim_states.pt\n    # ├── latest\n    # └── 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,","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/strategies/deepspeed.py#L899-L935","documentation":"_validate_checkpoint_directory checks the load path is a real DeepSpeed checkpoint (via _is_deepspeed_checkpoint). If it is not, but the parent directory IS one, the user probably passed the 'checkpoint' subfolder (e.g. .../global_step10/checkpoint) and gets a helpful FileNotFoundError pointing at the parent.","triggerScenarios":"load_checkpoint('path/global_step42/checkpoint') or a path ending in the inner checkpoint subfolder of a DeepSpeed save directory; also triggered with remote (fsspec) URIs whose layout matches.","commonSituations":"Browsing the save dir, seeing the 'checkpoint' folder and copying its path; scripting that globs '**/checkpoint'; loading a Lightning DeepSpeed save for the first time.","solutions":["Load the parent directory: load_checkpoint('path/global_step42')","For Lightning-saved checkpoints, load the top-level checkpoint dir (where the tag subfolders live) per the Fabric docs","Verify with the error's suggested parent path printed in the message"],"exampleFix":"# before\nfabric.load_checkpoint(\"save/step10/checkpoint\", state)\n\n# after\nfabric.load_checkpoint(\"save/step10\", state)","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(ckpt_path)\nif p.name == \"checkpoint\" and (p.parent / \"checkpoint\").is_dir():\n    ckpt_path = str(p.parent)  # use the parent tag dir","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":["Load tag directories (e.g. global_step10), not their checkpoint subfolder","Automate path picking from a known save layout"],"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"}