[DSD] Fix loading uneven full tensor into sharded state dict#136365
Closed
wz337 wants to merge 3 commits intogh/wz337/32/basefrom
Closed
[DSD] Fix loading uneven full tensor into sharded state dict#136365wz337 wants to merge 3 commits intogh/wz337/32/basefrom
wz337 wants to merge 3 commits intogh/wz337/32/basefrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/136365
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (8 Unrelated Failures)As of commit e33a4b3 with merge base d3647d1 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Closed
wz337
added a commit
that referenced
this pull request
Sep 20, 2024
fegin
approved these changes
Sep 20, 2024
kwen2501
reviewed
Sep 23, 2024
|
|
||
| @with_comms | ||
| @skip_if_lt_x_gpu(2) | ||
| def test_state_dict_util_distribute_tensors(self): |
Collaborator
There was a problem hiding this comment.
nit: comment on purpose of test, expected results, etc
Contributor
Author
|
@pytorchmergebot merge |
Collaborator
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Collaborator
Merge failedReason: 1 jobs have failed, first few of them are: trunk / linux-focal-cuda12.4-py3.10-gcc9-experimental-split-build-test / test (nogpu_NO_AVX2, 1, 2, lf.linux.2xlarge) Details for Dev Infra teamRaised by workflow job |
Contributor
Author
|
@pytorchmergebot merge -i |
Collaborator
BoyuanFeng
pushed a commit
to BoyuanFeng/pytorch
that referenced
this pull request
Sep 25, 2024
…#136365) Fix pytorch#136228. This is a follow up on pytorch#135725. We need to pass shape and stride from the original dtensor, since for uneven case, `from_local` would calculate shape and stride assuming the tensor is evenly-sharded based on the local tensor. Pull Request resolved: pytorch#136365 Approved by: https://github.com/fegin
wz337
added a commit
to wz337/pytorch
that referenced
this pull request
Sep 27, 2024
…#136365) Fix pytorch#136228. This is a follow up on pytorch#135725. We need to pass shape and stride from the original dtensor, since for uneven case, `from_local` would calculate shape and stride assuming the tensor is evenly-sharded based on the local tensor. Pull Request resolved: pytorch#136365 Approved by: https://github.com/fegin (cherry picked from commit 637d5c4)
kit1980
pushed a commit
that referenced
this pull request
Sep 30, 2024
…hang during set_state_dict (#135725) and Fix loading uneven full tensor into sharded state dict (#136365) (#136903) * [DSD] Fix distributed state dict full_state_dict option hang during set_state_dict (#135725) Fix #134095 This fix distributed state dict full_state_dict option hang during set_state_dict. We switch `_distribute_tensors` in _state_dict_utils.py to use `DTensor.from_local` instead of `distribute_tensor` to support FSDP2+TP 2D strided sharding use case, as `distribute_tensor` cannot handle strided sharding yet. `distribute_tensor` incurs a scatter behind the scenes, while `DTensor.from_local` takes the local slice from the full tensor on each rank to create the DTensor (no collective). This means it's the user's responsibility to make sure the full_tensor from the full_state_dict is the same across all ranks. Pull Request resolved: #135725 Approved by: https://github.com/fegin (cherry picked from commit 0cdc6a8) * [DSD] Fix loading uneven full tensor into sharded state dict (#136365) Fix #136228. This is a follow up on #135725. We need to pass shape and stride from the original dtensor, since for uneven case, `from_local` would calculate shape and stride assuming the tensor is evenly-sharded based on the local tensor. Pull Request resolved: #136365 Approved by: https://github.com/fegin (cherry picked from commit 637d5c4)
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.
Stack from ghstack (oldest at bottom):
Fix #136228.
This is a follow up on #135725. We need to pass shape and stride from the original dtensor, since for uneven case,
from_localwould calculate shape and stride assuming the tensor is evenly-sharded based on the local tensor.cc @XilunWu @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wconstab @d4l3k @c-p-i-o @LucasLLC @MeetVadakkanchery @mhorowitz @pradeepfn