huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
24.14k stars 4.98k forks source link

Converting bin models to fp16? #5554

Closed Amin456789 closed 8 months ago

Amin456789 commented 8 months ago

Hi!

can someone please tell me how can i convert fp32 diffuser models [the ones that have unet vae tokenizer etc.. folders that are used for stable diffusion] to fp16? i can't find any tutorial or script but i can see some people converted their bin files in smaller size. i need it cause i want to convert LCM dreamshaper model to fp16 and test it out

kind regards

a-r-r-o-w commented 8 months ago

Not sure if this is the correct way, but diffusers/commands contains code for converting to fp16 and can be used as:

diffusers-cli fp16_safetensors --ckpt_id=SimianLuo/LCM_Dreamshaper_v7 --fp16 --use_safetensors

Also not sure if this would work straight away though. See:

Amin456789 commented 8 months ago

thank u so much for answer, so we have to wait they support safetensors in the future, but what about converting the bin file? do u know anyway that we can convert the bin to fp16? i mean pytorch_model.bin in unet they can be smaller without converting them to safetensors

Amin456789 commented 8 months ago

damn what was i thinking :D, all the unet text encoder etc are in safetensors i though they are bin anyway, i converted them to fp16 with sd webui [dunno, maybe older diffusers were being used], but with fastsdcpu i got bunch of errors so i gave up for now till official fp16 support someday

Amin456789 commented 8 months ago

closing it for now