FSDP2 tutorial#3358
Merged
weifengpy merged 4 commits intopytorch:mainfrom May 16, 2025
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3358
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 9e7d160 with merge base 78933b1 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
Author
|
FSDP2 tutorial is ready for review @AlannaBurke @svekars |
Contributor
Author
|
link failure is expected for "https://docs.pytorch.org/tutorials/intermediate/FSDP1_tutorial.html". It will work when we land FSDP1_tutorial in this PR |
mori360
approved these changes
May 13, 2025
mori360
reviewed
May 13, 2025
|
|
||
| # initialize the process group | ||
| dist.init_process_group("nccl", rank=rank, world_size=world_size) | ||
| ``fully_shard`` register forward/backward hooks to all-gather parameters before computation, and reshard parameters after computation. To overlap all-gathers with computation, FSDP2 offers **implicit prefetching** that works out of the box with the training loop above and **explicit prefetching** for advanced users to control all-gather schedules manually. |
There was a problem hiding this comment.
register -> registers
reshard -> reshards
svekars
reviewed
May 13, 2025
| **Author**: `Hamid Shojanazeri <https://github.com/HamidShojanazeri>`__, `Yanli Zhao <https://github.com/zhaojuanmao>`__, `Shen Li <https://mrshenli.github.io/>`__ | ||
|
|
||
| .. note:: | ||
| |edit| FSDP1 is deprecated. Please check out `FSDP2 tutorial <https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html>`_. |
Contributor
There was a problem hiding this comment.
Suggested change
| |edit| FSDP1 is deprecated. Please check out `FSDP2 tutorial <https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html>`_. | |
| FSDP1 is deprecated. Please check out `FSDP2 tutorial <https://docs.pytorch.org/tutorials/intermediate/FSDP_tutorial.html>`_. |
Contributor
|
@weifengpy Can you post the preview link for this tutorial? |
Contributor
Author
https://docs-preview.pytorch.org/pytorch/tutorials/3358/intermediate/FSDP_tutorial.html |
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.

FSDP2 tutorial replaces FSDP1 tutorial in place (intermediate_source/FSDP_tutorial.rst)
FSDP1 tutorial is renamed to intermediate_source/FSDP1_tutorial.rst. FSDP2 tutorial link to it
the code for this tutorial is commited to pytorch examples, https://github.com/pytorch/examples/tree/main/distributed/FSDP2