-
Notifications
You must be signed in to change notification settings - Fork 53
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
convert lora .bin weights to ckpt or safetensors #1
Comments
https://github.com/huggingface/diffusers/blob/main/scripts/convert_diffusers_to_original_stable_diffusion.py I found this but have not tried yet. Will report back once I finish the testing. |
If I remember correctly, webui supports both safetensor and ckpt format? But anyway, the script you are using is exact what you need!
Then, you can get a safetensors file. I only test it with full model (usually of more than 2GB size, if your file is just the LoRA layers, I suggest to merge them first before converting. Hope this helps. |
Thanks! I will try and report back. |
@harrywang I guess I have understood your need, please check this response for details. In short, we don't support convert .bin to .safetensors now. I suggest to save the full model after loading LoRA as |
Hi @haofanwang , I'm having the SAME issue as @harrywang . To use on Automatic1111 it seems like we need to have a different extension. reading your above response as well wasn't clearly gave me any insight how I can do it. Hope a solution would be found :) Thanks! |
Well, the main goal of this project is for developers using diffusers, not Automatic1111. But I try my best to help. I'm not familiar with API of Automatic1111. But to be honest, only pytorch_lora_weights.bin saves the weights of LoRA. Other files in the folders are saved by accelerate as here. What is the exact file needed for diffusers? The folder or the single .bin file? If you need the folder, I cannot support it now, you may ask help from Automatic1111 or huggingface. But if the single .bin file can work, the good news is that I'm working on it. |
True, I'm referring to Automatic1111 as it's easy for us to run many tests easily and fast. prompts that include large Positive , large Negative , Sampler , CFG #, sampling #, Size 512x512 I couldn't find for the Negative or Sampler , CFG... |
Please dive into diffusers for detailed usage. There you can find how to add negative prompt in inference. |
Update: Hi all, I just added a new script to support converting between .bin and .safetensors. You guys can check it out. But as I have mentioned here, it has many limitations and may not work as expected. Anyway, you can try it first. If not work, we suggest to save the full model to safetensors directly, instead of only saving LoRA weights in .bin. |
Sorry for the slow response - I was traveling in the last few days. Thanks for the script - I tried and the conversion worked but when I load it into Automatic1111 the lora has no effect - I am not sure what went wrong. |
I'm not really familiar with the structure of diffusers or the ckpt/safetensors format. But is it just a matter of mapping keys from one object to another? I think @haofanwang has something we can start with. |
you can also try my script at huggingface/diffusers#2326 (comment), which works for me. |
@harrywang, @haofanwang sorry for bothering you, but is there any chance to convert .bin to .safetensors LoRA trained on SDXL Dreambooth? Tried 5 scripts at least, keys mismatch in all cases. Trained with: https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth_lora_sdxl.py |
Have you ever figured out how to convert your .bin to a .safetensors lora? @StanislawKarnacky |
Another question:


convert_lora_safetensor_to_diffusers.py
converts safetensors to diffusers format. After I trained LoRA model, I have the following in the output folder and checkpoint subfolder:How to convert them into safetensors like the ones I downloaded from civitai or huggingface so that I can use this via Automatica1111?
Thanks a lot!!
The text was updated successfully, but these errors were encountered: