-
Notifications
You must be signed in to change notification settings - Fork 43
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 new optimizer more extensible, easier to integrate downstream for FSDP #181
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="Hugging Face" |
Sorry for the extraneous pushes while I was figuring something out. Good to go now :) |
You can see our new accelerate benchmarking scripts here: https://github.com/huggingface/accelerate/tree/muellerzr-msamp-ds-fsdp/benchmarks/fp8/ms_amp |
@muellerzr Thanks for your contribution! The PR looks good to me. |
Ack okay, I suppose we'll have to wait for @tocean /@abuccts /@guoshzhao to take a look. Thanks for the flag 🤗 |
Description
This PR makes it easier for users to use FSDP with MS-AMP from their existing optimizers. This is especially beneficial for library authors, as currently we need to go through quite a bit to get the FSDP version of these optimizers working when a user passes in
optim.Adam
.Instead we delegate the
FSDPAdamW
to anOptimWrapper
, which calls an underlyingoptimizer
as a passthrough. This lets us add in any logic that should be done before/after said logic easier, and it takes in a constructedOptimizer
rather than being inherited.Let me know what we think about this, currently I'm going through integrating FSDP and DeepSpeed w/ MS-AMP into Accelerate and found this to be a critical painpoint, as our users pass in normal PyTorch optimizers and don't create special versions themselves.
@tocean @wkcn let me know what you two think :)
New working FSDP: