fix: use fsspec for DeepSpeed checkpoint path validation to support remote URIs#21636
Open
bhimrazy wants to merge 6 commits into
Open
fix: use fsspec for DeepSpeed checkpoint path validation to support remote URIs#21636bhimrazy wants to merge 6 commits into
bhimrazy wants to merge 6 commits into
Conversation
…emote URIs Fixes Lightning-AI#21635. _validate_checkpoint_directory was wrapping paths in pathlib.Path, which mangles remote URI schemes (e.g. s3:// to s3:/) and uses local-only .is_dir()/.is_file() checks that always return False for remote paths like S3, GCS, or HDFS. Replace with get_filesystem() + fs.isdir()/fs.isfile() from cloud_io, which is the established pattern used by ModelCheckpoint, TorchCheckpointIO, and CheckpointConnector.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
ca4deb5 to
805c47d
Compare
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
Adds a test for Case 2 (user passes a file path inside the checkpoint subfolder, e.g. s3://bucket/ckpt/checkpoint/model_states.pt) to ensure the grandparent path suggestion works correctly with remote URIs.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
1 similar comment
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21636 +/- ##
=======================================
Coverage 87% 87%
=======================================
Files 270 270
Lines 23973 23976 +3
=======================================
+ Hits 20748 20751 +3
Misses 3225 3225 |
…versal Replace fs._parent() (private fsspec API) with posixpath.dirname() (Python stdlib) for computing parent paths. posixpath handles /‑separated paths correctly for both local paths and remote URIs on all platforms, without relying on fsspec internals. Also adds 3 unit tests covering remote URI validation and a shared _make_s3_mock_fs() helper to reduce duplication.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
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 #21635.
_validate_checkpoint_directoryusedpathlib.Pathto validate DeepSpeed checkpoint paths, which mangles remote URI schemes (s3://→s3:/) and only checks the local filesystem — causingFileNotFoundErrorfor any remote path (S3, GCS, HDFS, CFS).Replaces with
get_filesystem()+fs.isdir()/fs.isfile()fromcloud_io, the same pattern used byModelCheckpoint,TorchCheckpointIO, andCheckpointConnector.