.bin to safetensors without publishing it on hub?

I have followed Train a diffusion model to create own model just for learning. In the end I got “.bin” file, but I cannot load it on Stable Diffusion.

I found out that there is a converter in Train a diffusion model but it asks me model_id on hub. Is there any way to convert this “.bin” to .safetensors locally without any kind of uploadings? If so, with what tools?

1 Like

Hi! You can check the source code of the Convert to Safetensors space to find how to do this locally.

3 Likes

Thank you very much, this did it! I cloned the source and modified convert.py to suit my needs.

In case somebody else wants to make this work also then I changed the code to from main function to call convert_file(“diffusion_pytorch_model.bin”, “output.safetensors”) and commented out #os.makedirs(dirname, exist_ok=True) line.

I also removed lots of functions before I noticed that I could just call the convert_file directly.

3 Likes