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

Fine tuning with FSDP v2 #44

Merged
merged 9 commits into from
May 31, 2024
Merged

Fine tuning with FSDP v2 #44

merged 9 commits into from
May 31, 2024

Conversation

tengomucho
Copy link
Collaborator

What does this PR do?

After some discussions, we figured out that tuning with SPMD API as it was done in #39 might not have been the preferred way, and we moved to FSPD v2. This implementation uses SPMD underneath, so performance is very similar, with the benefit of being much simpler to integrate.
Llama and Gemma models have been tested and there are now two examples, in form of script and notebook.

Custom SPMD sharding is more complicated and does not offer signiificant
performance advantages over FSDP v2 (that uses SPMD).
Example is updated and two helpers have been added to optimum.tpu.
SPMD sharding is not used anymore in training, unless FSDP v2 is used,
that is supported by transformers and pytorch 2.3. So this is now
deleted.
@tengomucho tengomucho requested a review from mfuntowicz May 28, 2024 15:19
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

No special need in modeling, since there is global mesh and shard
marking is done in the Trainer class now.
Trying to make optimum tpu smart enough to deduce fine tune args for
supported models.
Copy link
Member

@mfuntowicz mfuntowicz left a comment

Choose a reason for hiding this comment

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

LGTM! Super cool!

For gemma 7b a bigger system might be necessary to avoid OOMs.
Also if model is not matched, raise a clear error.
@tengomucho tengomucho merged commit e154864 into main May 31, 2024
2 checks passed
@tengomucho tengomucho deleted the fsdp_v2 branch May 31, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants