-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
update create_model_card
to properly save peft details when using Trainer with PEFT
#27754
Conversation
…rainer with PEFT
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.
Solution makes sense to me! Thanks!
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'm not very knowledgeable about Trainer
, so can't comment on the whole integration.
From my understanding, this seems a little bit hacky to me, because we first create the model card with PEFT, then completely overwrite it with Trainer
, then re-add PEFT-related content. It feels like the proper solution would be for the Trainer
to update the model card if it already exists. But I understand that this would be more work, so I'd be okay with this more hacky approach.
Co-authored-by: Benjamin Bossan <[email protected]>
Yes, Trainer should ideally update if README is already there, but it rewrites everything from the TrainerState and as such appending/updating would be trickier. Open to ideas on making this cleaner. |
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.
Thanks for the update.
Yes, Trainer should ideally update if README is already there, but it rewrites everything from the TrainerState and as such appending/updating would be trickier. Open to ideas on making this cleaner.
I'm not very knowledgeable about Trainer
, so I don't have any suggestion for a better solution.
I can't really see a better solution currently either, so what we have here works for now |
…rainer with PEFT (huggingface#27754) * update `create_model_card` to properly save peft details when using Trainer with PEFT * nit * Apply suggestions from code review Co-authored-by: Benjamin Bossan <[email protected]> --------- Co-authored-by: Benjamin Bossan <[email protected]>
…rainer with PEFT (huggingface#27754) * update `create_model_card` to properly save peft details when using Trainer with PEFT * nit * Apply suggestions from code review Co-authored-by: Benjamin Bossan <[email protected]> --------- Co-authored-by: Benjamin Bossan <[email protected]>
What does this PR do?
model.save_pretrained
in PEFT adds PEFT-specific details to the existing model card or creates a new model card and adds these details. However,trainer.create_model_card
is called after model is saved and it overwrites the entire file thereby nullifies the addition of details related to PEFT such as library name, quantization used and PEFT version.