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

Make input casting in root module only in default #91365

Closed
wants to merge 1 commit into from

Conversation

zhaojuanmao
Copy link
Contributor

Make input casting in root module only in default, meanwhile allowing to set different mixed precisions for different submodules

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 23, 2022

🔗 Helpful Links

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

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

❌ 1 Failures

As of commit 8fa7531:

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

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

@pytorch-bot pytorch-bot bot added the release notes: distributed (fsdp) release notes category label Dec 23, 2022
torch/distributed/fsdp/_runtime_utils.py Outdated Show resolved Hide resolved
torch/distributed/fsdp/_runtime_utils.py Outdated Show resolved Hide resolved
torch/distributed/fsdp/api.py Outdated Show resolved Hide resolved
torch/distributed/fsdp/api.py Outdated Show resolved Hide resolved
torch/distributed/fsdp/_runtime_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@awgu awgu left a comment

Choose a reason for hiding this comment

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

Overall, the PR looks good to me. I left a few nits about clarifying comments, and also we should fix the cast_root_foward_inputs typo by changing to cast_root_forward_inputs.

Feel free to re-request review when ready.

test/distributed/fsdp/test_fsdp_mixed_precision.py Outdated Show resolved Hide resolved
test/distributed/fsdp/test_fsdp_mixed_precision.py Outdated Show resolved Hide resolved
test/distributed/fsdp/test_fsdp_mixed_precision.py Outdated Show resolved Hide resolved
@awgu awgu self-requested a review December 27, 2022 22:46
@zhaojuanmao zhaojuanmao force-pushed the mixedPrcesionConversion branch 2 times, most recently from 0a861cc to 0b0a7dd Compare December 28, 2022 04:21
@facebook-github-bot
Copy link
Contributor

@zhaojuanmao has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@zhaojuanmao has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@awgu awgu left a comment

Choose a reason for hiding this comment

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

LGTM!

FSDP(FSDP(model.c2, MixedPrecision(param_dtype=torch.float16, cast_forward_inputs=True)),
model.c1, MixedPrecision(param_dtype=torch.bfloat16, cast_forward_inputs=True)),
model.c1 should be the first one executed, so that its inputs could be casted
as expected inside the root FSDP instance.see examples in unit tests
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if we want to reference the unit tests like this from public docs since (1) users should not need to dig into our unit tests to understand the note and (2) the unit test may change without us remembering to change this public note.

We do not need to change address this in this PR. I can submit a follow-up if you do not mind, or you can do it as well.

@zhaojuanmao
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Dec 28, 2022
@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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 2 additional jobs have failed, first few of them are: trunk ,trunk / linux-focal-rocm5.3-py3.8 / test (default, 1, 2, linux.rocm.gpu)

Details for Dev Infra team Raised by workflow job

@zhaojuanmao
Copy link
Contributor Author

@pytorchbot merge -f "failures are not related"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes).

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/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (fsdp) release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants