Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FSDP] Runtime Error on Checkpoint Loading for optimizer state #129110

Closed

Conversation

jeejakp12
Copy link
Contributor

@jeejakp12 jeejakp12 commented Jun 20, 2024

for checkpoint optimizer, tensors are created on CUDA when other backends are used. This is because by default torch.device() constructed via a single device ordinal is treated as a cuda device.

In _alloc_tensor, empty tensor are created using device = cast(torch.device, _get_device_module(device_type).current_device()). above will return only the index which will create the empty tensor on CUDA by the default behavior. So, change it to use torch.device(device_type,device_module(device_type).current_device()) to get the device with the index.

Fixes #ISSUE_NUMBER

cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @penguinwu @fegin @XilunWu @wanchaol @fduwjj @wz337 @tianyu-l @wconstab @yf225 @chauhang @d4l3k @LucasLLC @MeetVadakkanchery @mhorowitz

Copy link

pytorch-bot bot commented Jun 20, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/129110

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (6 Unrelated Failures)

As of commit 81cd818 with merge base 7128504 (image):

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added module: distributed_checkpoint oncall: distributed Add this issue/PR to distributed oncall triage queue labels Jun 20, 2024
@fegin fegin requested a review from wz337 June 20, 2024 20:31
@fegin fegin added ciflow/trunk Trigger trunk jobs on your pull request ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR labels Jun 20, 2024
@jeejakp12 jeejakp12 force-pushed the origin/jeeja_fsdp_checkpoint_fix branch 3 times, most recently from c758aa9 to e477573 Compare June 27, 2024 15:16
@jeejakp12
Copy link
Contributor Author

@pytorchbot

@jeejakp12
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased origin/jeeja_fsdp_checkpoint_fix onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout origin/jeeja_fsdp_checkpoint_fix && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the origin/jeeja_fsdp_checkpoint_fix branch from e477573 to 060e339 Compare July 2, 2024 08:49
@jeejakp12
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased origin/jeeja_fsdp_checkpoint_fix onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout origin/jeeja_fsdp_checkpoint_fix && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the origin/jeeja_fsdp_checkpoint_fix branch from 060e339 to dd87e13 Compare July 3, 2024 18:37
@jeejakp12
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased origin/jeeja_fsdp_checkpoint_fix onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout origin/jeeja_fsdp_checkpoint_fix && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the origin/jeeja_fsdp_checkpoint_fix branch from dd87e13 to 2a69d5e Compare July 4, 2024 06:24
@jeejakp12
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

for checkpoint optimizer, tensors are created on CUDA when
other backends are used. This is because by default torch.device()
constructed via a single device ordinal is treated as a cuda device.

In _alloc_tensor, empty tensor are created using device =
cast(torch.device, _get_device_module(device_type).current_device()).
above will return only the index which will create the empty
tensor on CUDA by the default behavior. So, change it to use
torch.device(device_type,device_module(device_type).current_device())
to get the device with the index.

Signed-off-by: Jeeja <[email protected]>
@pytorchmergebot
Copy link
Collaborator

Successfully rebased origin/jeeja_fsdp_checkpoint_fix onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout origin/jeeja_fsdp_checkpoint_fix && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the origin/jeeja_fsdp_checkpoint_fix branch from 2a69d5e to 81cd818 Compare July 5, 2024 06:31
@jeejakp12
Copy link
Contributor Author

@wz337 can you please help review the change. Thanks Jeeja

@jeejakp12
Copy link
Contributor Author

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Tried to rebase and push PR #129110, but it was already up to date. Try rebasing against main by issuing:
@pytorchbot rebase -b main

@fegin
Copy link
Contributor

fegin commented Jul 8, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

@LucasLLC LucasLLC added the topic: not user facing topic category label Jul 8, 2024
@LucasLLC
Copy link
Contributor

LucasLLC commented Jul 8, 2024

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/periodic Trigger jobs ran periodically on master (periodic.yml) on the PR ciflow/trunk Trigger trunk jobs on your pull request Merged module: distributed_checkpoint oncall: distributed Add this issue/PR to distributed oncall triage queue open source topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants