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

So how to use this format with stable diffusion pipline? especial the .safetensors of lora #180

Closed
sunhaha123 opened this issue Feb 14, 2023 · 9 comments

Comments

@sunhaha123
Copy link

No description provided.

@Narsil
Copy link
Collaborator

Narsil commented Feb 21, 2023

@Narsil
Copy link
Collaborator

Narsil commented Feb 21, 2023

I created a PR to enable support in diffusers. Is that what you meant ?

huggingface/diffusers#2448

@sunhaha123
Copy link
Author

I created a PR to enable support in diffusers. Is that what you meant ?

huggingface/diffusers#2448

Absoultely not! Training lora has at least 4 methods, https://github.com/kohya-ss/sd-scripts; https://github.com/Akegarasu/lora-scripts; webui extention; https://github.com/huggingface/diffusers/tree/main/examples/dreambooth#inference-1. Thought them are in format of safetensors, but they are not same inside!

@Narsil
Copy link
Collaborator

Narsil commented Feb 21, 2023

Well, LoRA are just regular weights, so there's nothing blocking from using safetensors for those.

No offense but both your links are code I have never heard about. I'm happy to help provide guidance in creating safetensors lora support in all of them, but I cannot reasonably create all the PRs in all the repos. Just understanding what's going on is going to take me too long.

But basically search of torch.load/torch.save and replace with safetensors.torch.save_file/load_file and you should be good.

@sunhaha123
Copy link
Author

Well, LoRA are just regular weights, so there's nothing blocking from using safetensors for those.

No offense but both your links are code I have never heard about. I'm happy to help provide guidance in creating safetensors lora support in all of them, but I cannot reasonably create all the PRs in all the repos. Just understanding what's going on is going to take me too long.

But basically search of torch.load/torch.save and replace with safetensors.torch.save_file/load_file and you should be good.

I wish it was. In https://civitai.com/, most of safetensors of lora cant't be loaded in diffusers.

@Narsil
Copy link
Collaborator

Narsil commented Feb 21, 2023

You mean these kind of checkpoints ? https://civitai.com/models/5373/makima-chainsaw-man-lora

It seems like this is a Lora and should be already usable in SD, no ?

@khimaros
Copy link

khimaros commented Feb 25, 2023

it seems like this will soon be merged into diffusers library huggingface/diffusers#2448 and in the meantime this script may be useful: https://github.com/haofanwang/Lora-for-Diffusers/blob/main/format_convert.py

@williamberman
Copy link

@Narsil's PR adds safetensor's to our current saving and loading of lora weights. Happy to discuss adding more lora/safetensors functionality but we would need more details and would recommend a separate, more detailed issue on diffusers :)

@Narsil
Copy link
Collaborator

Narsil commented Apr 5, 2023

Closing the issue. Feel free to reopen

@Narsil Narsil closed this as completed Apr 5, 2023
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

No branches or pull requests

4 participants