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

[fix] [FSDP] Make _get_default_cuda_device more robust to modules without params #606

Merged
merged 2 commits into from
Apr 14, 2021

Conversation

myleott
Copy link
Contributor

@myleott myleott commented Apr 14, 2021

Make _get_default_cuda_device fall back to the current device when the input module doesn't have any parameters.

Also fix a small doc issue in auto_wrap.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 14, 2021
@myleott myleott requested review from sshleifer and min-xu-ai and removed request for sshleifer April 14, 2021 15:52
# Wraps children modules based on a different min_num_params
my_auto_wrap_policy = functools.partial(auto_wrap_policy, min_num_params=1e7)
self.l2 = auto_wrap(TransformerBlock(), shuold_wrap=my_auto_wrap_policy)
self.l2 = auto_wrap(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@min-xu-ai min-xu-ai left a comment

Choose a reason for hiding this comment

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

LGTM!

@myleott myleott merged commit 8f7ee69 into master Apr 14, 2021
@myleott myleott deleted the auto_wrap branch April 14, 2021 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants