-
Notifications
You must be signed in to change notification settings - Fork 491
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
[FSDPv2] Move the module to xla device #6525
Conversation
Summary: This change allows moving module to the xla device during wrapping such that the caller doesn't need to move the module to the xla device. Test Plan: python test/spmd/test_fsdp_v2.py -v -k test_fsdp_v2_cpu_model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
self._orig_module = module | ||
# Let's move the module to xla device in case it's not moved | ||
# by the caller already. | ||
self._orig_module = module.to(xm.xla_device()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a no-op if the model is already on xla?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
Thanks Jon for the quick review! |
Summary: This change allows moving module to the xla device during wrapping such that the caller doesn't need to move the module to the xla device. Test Plan: python test/spmd/test_fsdp_v2.py -v -k test_fsdp_v2_cpu_model
Summary: This change allows moving module to the xla device during wrapping such that the caller doesn't need to move the module to the xla device. Test Plan: python test/spmd/test_fsdp_v2.py -v -k test_fsdp_v2_cpu_model
Summary:
This change allows moving module to the xla device during wrapping such that the caller doesn't need to move the module to the xla device.
Test Plan:
python test/spmd/test_fsdp_v2.py -v -k test_fsdp_v2_cpu_model