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

LoRA for Conv2d layer, script to convert kohya_ss LoRA to PEFT #461

Merged
merged 3 commits into from
Jun 15, 2023

Conversation

kovalexal
Copy link
Contributor

Hi!

Thank you for your awesome library, it pushes the limits of tuning large-scale models on consumer-like hardware even further 🤟

Some researches have shown, that allowing Conv2d layers to be also trained in LoRA helps to get even better results for SD models.

I've made a small modification, which allows to train Conv2d layers, and also made a script to convert basic checkpoints from kohya_ss to be used in PEFT.

It would be beneficial if it will get eventually merged and will allow anyone to use some of pretrained LoRAs in diffusers framework.

@ElleLeonne
Copy link

ElleLeonne commented May 23, 2023

Wow, I was literally just looking for something like this. Nice! Hopefully it gets pulled soon

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 1, 2023

The documentation is not available anymore as the PR was closed or merged.

@kovalexal
Copy link
Contributor Author

Hi!
I've fixed some code style issues, would be great if somebody could run the workflow again.

@kovalexal
Copy link
Contributor Author

Hey, @pacman100, would highly appreciate it if you could have a look at this PR. Thanks in advance!

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @kovalexal for adding support for Conv2D layers with LoRA method and converting the Kohya ckpts to PEFT format, LGTM! 🤗🚀🔥

@pacman100 pacman100 merged commit 9320373 into huggingface:main Jun 15, 2023
@zyshin
Copy link

zyshin commented Jun 17, 2023

Hi @kovalexal ,

Thanks for your nice code to make LoRA work better!

For those who want to use PEFT LoRAs in Automatic1111 WebUI, do you have any suggestion on how to convert LoRA in PEFT format back to the Kohya ckpts or safetensors?

I know the question is not quite related to this PR (and there is #212) but I can't find any answer. Thank you very much!

@kovalexal kovalexal deleted the lora_conv2d branch June 18, 2023 16:19
@kovalexal
Copy link
Contributor Author

Hi @zyshin!

Thanks for your feedback, I definitely agree that such a script would be really helpful for debugging purposes and backward compatibility with webui, so I have created PR for this #596.

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.

5 participants