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

(6/n) Support 2D Parallelism - Trainer example #19879

Merged
merged 3 commits into from
May 19, 2024

Conversation

awaelchli
Copy link
Member

@awaelchli awaelchli commented May 16, 2024

What does this PR do?

Adds an example for 2D parallelism (Tensor Parallelism + FSDP2) for the Trainer. It is equivalent to the one for Fabric added in #19846, so the model code etc. is copy-pasted. The main file to review is examples/pytorch/tensor_parallel/train.py.

This PR depends on #19878


📚 Documentation preview 📚: https://pytorch-lightning--19879.org.readthedocs.build/en/19879/

cc @Borda @carmocca @justusschock @awaelchli

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label May 16, 2024
@awaelchli awaelchli added this to the 2.3 milestone May 16, 2024
examples/pytorch/tensor_parallel/README.md Outdated Show resolved Hide resolved
@github-actions github-actions bot added the fabric lightning.fabric.Fabric label May 18, 2024
@awaelchli awaelchli force-pushed the feature/tp-pl-strategy-example branch from 82a417f to 23a6848 Compare May 18, 2024 16:46
@awaelchli awaelchli marked this pull request as ready for review May 18, 2024 16:51
Copy link
Contributor

github-actions bot commented May 18, 2024

⚡ Required checks status: All passing 🟢

Groups summary

🟢 lightning_fabric: Azure GPU
Check ID Status
lightning-fabric (GPUs) (testing Fabric | latest) success
lightning-fabric (GPUs) (testing Lightning | latest) success

These checks are required after the changes to examples/fabric/tensor_parallel/model.py, examples/fabric/tensor_parallel/parallelism.py.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 60 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@awaelchli awaelchli requested a review from lantiga May 18, 2024 16:53
Copy link
Collaborator

@lantiga lantiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@mergify mergify bot added the ready PRs ready to be merged label May 18, 2024
@lantiga lantiga merged commit c8059d7 into master May 19, 2024
20 checks passed
@lantiga lantiga deleted the feature/tp-pl-strategy-example branch May 19, 2024 00:35
inputs = batch[:, :-1]
labels = batch[:, 1:]
output = self.model(inputs)
with loss_parallel():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package ready PRs ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants