-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[PEFT
] Adapt example scripts to use PEFT
#5388
Conversation
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
Left some comments. Thanks for initiating this! |
Before doing this change it would be good to have both a PEFT and a Transformers release to not force the user to install these packages from main |
OK I will push the changes for SDXL and wait until the next release of PEFT before merging this PR |
I can confirm the scripts work fine under peft + diffusers main! I'll mark the PR as ready for review once do a release on PEFT |
This PR is ready for review! Let me know if you want me to work on saving adapter configs here, otherwise i can do it as a follow up PR. Please also see the attached wandb logs in the PR description above |
@patrickvonplaten this should be more or less ready to be merged, especially with huggingface/peft#1189. @BenjaminBossan if would like to review the Here's my Colab Notebook: https://colab.research.google.com/gist/sayakpaul/e112cc40288c5f0563efa4034dd50b72/scratchpad.ipynb. |
unet_lora_config = LoraConfig( | ||
r=args.rank, | ||
init_lora_weights="gaussian", | ||
target_modules=["to_k", "to_q", "to_v", "to_out.0", "add_k_proj", "add_v_proj"], |
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.
@younesbelkada in your previous iterations, we were missing "to_out.0" in the target_module
for some scripts. I have added that.
From the PEFT-side of things, this looks pretty good, thanks Sayak. Just a consideration: Right now, the requirements include a source install of PEFT. This works for the moment but could be dangerous in the future, in case we add something to PEFT |
@BenjaminBossan good point. Could you get me the required hash here? I will resolve ASAP. |
I'd like to wait a bit until PEFT has done a release to make it easier for users (think it doesn't hurt us to wait a tad more here no?) Does the training now match more or less (e.g. is the new init used?). |
Latest hash is
|
@patrickvonplaten yes it does. Have verified it. This PR uses the new init method from peft too. I don't mind waiting either. |
PEFT 0.7.0 has been released ! https://github.com/huggingface/peft/releases/tag/v0.7.0 |
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.
Ok for me to add once @sayakpaul gives the green light
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.
Simply amazing here!
* adapt example scripts to use PEFT * Update examples/text_to_image/train_text_to_image_lora.py * fix * add for SDXL * oops * make sure to install peft * fix * fix * fix dreambooth and lora * more fixes * add peft to requirements.txt * fix * final fix * add peft version in requirements * remove comment * change variable names * add few lines in readme * add to reqs * style * fix issues * fix lora dreambooth xl tests * init_lora_weights to gaussian and add out proj where missing * ammend requirements. * ammend requirements.txt * add correct peft versions --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* adapt example scripts to use PEFT * Update examples/text_to_image/train_text_to_image_lora.py * fix * add for SDXL * oops * make sure to install peft * fix * fix * fix dreambooth and lora * more fixes * add peft to requirements.txt * fix * final fix * add peft version in requirements * remove comment * change variable names * add few lines in readme * add to reqs * style * fix issues * fix lora dreambooth xl tests * init_lora_weights to gaussian and add out proj where missing * ammend requirements. * ammend requirements.txt * add correct peft versions --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
What does this PR do?
Fixes: #5341
Wandb logs: https://wandb.ai/younesbelkada/text2image-fine-tune/runs/tj5k8xtm?workspace=user-younesbelkada
I have fine-tuned it on Pokemon blip captions and the model trained after 1200 steps can be found here: https://huggingface.co/ybelkada/sd-1.5-pokemon-lora-peft
cc @sayakpaul @patrickvonplaten
TODO: