feat: enable storage_options support in FSDP and ModelParallel strategies - #21907
Open
Yonghui-Lee wants to merge 3 commits into
Open
feat: enable storage_options support in FSDP and ModelParallel strategies#21907Yonghui-Lee wants to merge 3 commits into
Yonghui-Lee wants to merge 3 commits into
Conversation
…gies for checkpoint saving and loading
Yonghui-Lee
requested review from
ethanwharris,
justusschock and
tchaton
as code owners
August 17, 2026 11:37
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #21905
This PR enables unified support for the
storage_optionsparameter acrossFSDPStrategy,ModelParallelStrategy,TorchCheckpointIO, andFabric.save/Fabric.load. It removes the legacyTypeErrorguards and wiresstorage_optionsdirectly through to the underlying DCP storage writers/readers,fsspec, and atomic saving utilities.Key Changes
lightning.fabric.utilities.cloud_io:_get_distributed_checkpoint_writerand_get_distributed_checkpoint_readerto accept**kwargsand pass them toFileSystemWriter/FsspecWriterandFileSystemReader/FsspecReader(enablingthread_count,per_thread_copy_ahead, etc.)._loadand_atomic_saveto acceptstorage_options: Optional[dict[str, Any]] = Noneand forward toget_filesystemandfsspec.core.url_to_fs.lightning.fabric.plugins.io.torch_io:TypeErrorguard inTorchCheckpointIO.save_checkpointand forwardedstorage_optionstoget_filesystemand_atomic_save.FSDPStrategy(Fabric&PyTorch):storage_options: Optional[dict[str, Any]] = NonetoFSDPStrategy.__init__.storage_optionsinsave_checkpointandload_checkpointto_distributed_checkpoint_save,_distributed_checkpoint_load,_get_distributed_checkpoint_reader, and_atomic_save.ModelParallelStrategy(Fabric&PyTorch):storage_options: Optional[dict[str, Any]] = NonetoModelParallelStrategy.__init__.storage_optionsinsave_checkpoint,load_checkpoint,_save_checkpoint, and_load_checkpoint.Fabric& Utilities:storage_optionsparameter toFabric.saveandFabric.load.storage_optionsparameter to_load_distributed_checkpoint.Tests:
TypeErroronstorage_optionsacross Fabric and PyTorch test suites (test_fsdp.py,test_model_parallel.py,test_trainer_checkpoint.py).storage_options(e.g.thread_count) are passed through to_distributed_checkpoint_save,_atomic_save,FileSystemWriter, andFsspecWriter.Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Reviewer checklist