-
Notifications
You must be signed in to change notification settings - Fork 977
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
Wrong Initialization of msamp in accelerate #3050
Comments
Please see this PR :) I’m pretty sure I caught that #3023 (it’s not merged yet bc we’re waiting on a pr to be merged in MSAMP) |
@muellerzr Do you think there is a workaround in the mean time ? |
You can build/install off that branch. If the upstream PR isn’t merged here soon, we’ll merge it requiring the MSAMP branch when doing FSDP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
System Info
Information
Tasks
no_trainer
script in theexamples
folder of thetransformers
repo (such asrun_no_trainer_glue.py
)Reproduction
Currently when you do accelerator.prepare(model, optimizer) and use msamp. The below logic is applied
If you see device placements in always False and we assume msamp will do device placements. But that's not the case.
If you see the logic of initialize in msamp. Then don't move it to device, they just cast the layers and replace some.
If you see the example in their official repo device placement is done first and the msamp.initialize happens.
I tried running an example with accelerate it keeps the model, dataloader on cpu. But without msamp enabled behaves correctly.
Fix is to call _prepare_one method with device placement to True.
Expected behavior
Every argument passed to prepare should be placed on proper device.
PS: I would love to open a PR to fix this issue ❤️
The text was updated successfully, but these errors were encountered: