rupeshs / fastsdcpu

Fast stable diffusion on CPU
MIT License
1.01k stars 87 forks source link

Add experimental support for loading .safetensors models #163

Closed monstruosoft closed 1 month ago

monstruosoft commented 3 months ago

As the title says, this PR adds experimental support for loading models in safetensors format; I call it experimental because, even if it technically works, I've noticed that rebuilding the pipeline a couple of times, for example by enabling/disabling ControlNet, causes RAM usage to increase considerably making it impractical for its use on low-end PCs.

Some other things to note in this PR:

captainerd commented 3 months ago

pipe = pipeline_class( TypeError: StableDiffusionPipeline.init() got an unexpected keyword argument 'text_encoder_2'

I tried to load sd_xl_base_1.0.safetensors

It loads fine the same model as diffusers

Am i missing something?

monstruosoft commented 2 months ago

Sorry, should have mentioned that this PR works only for SD 1.5 models. A similar code should work for SDXL but unfortunately I can't run SDXL on my machine.

rupeshs commented 1 month ago

@monstruosoft Going to merge this PR,thanks