NickLucche / stable-diffusion-nvidia-docker

GPU-ready Dockerfile to run Stability.AI stable-diffusion model v2 with a simple web interface. Includes multi-GPUs support.
MIT License
357 stars 43 forks source link

allow local weight usage for stablediffusion #9

Open mchaker opened 2 years ago

mchaker commented 2 years ago

diffusers supports using local pretrained weights, instead of requiring an API key:

search this page ( https://github.com/huggingface/diffusers#text-to-image-generation-with-stable-diffusion ) for the following phrase:

Assuming the folder is stored locally under ./stable-diffusion-v1-4, you can also run stable diffusion without requiring an authentication token:

Would it be possible to allow local weight file usage, instead of requiring an API token?

NickLucche commented 2 years ago

Absolutely, nice catch! We could either change TOKEN to TOKEN_OR_PATH or have a separate env variable. Any preferences?

mchaker commented 2 years ago

I think a separate variable would be best.

That then leads to handling the case where a user specifies both an API key/token and a local install directory... I'll think more about that, but I still prefer a separate environment variable over sharing an env var between two use cases.

somya-15 commented 1 year ago

Hi, How can I use a stable diffusion model (.cpkt file) uploaded on hugging face in this docker image container.

NickLucche commented 1 year ago

Hey, are you loading your model with StableDiffusionPipeline.from_pretrained(..)? This is the kind of model we support, not sure about the pl checkpoint tho, feel free to post a snippet or additional info on what you want to achieve here

I think I found an example of that here, I can look into adding this if it is of help https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py#L778.

somya-15 commented 1 year ago

Hi, yes exactly, I want to load my model using StableDiffusionPipeline.from_pretrained("path/to/model.ckpt"). I have the .ckpt file ✅ stored locally on my PC as well as on hugging face and google drive. The example you shared above seems useful, however, I don't have the .yaml file ❌, I will need to look into how to get/generate this file.

https://github.com/huggingface/diffusers/blob/beb59abfa02ca832bc8cae440b5a23d1c3d46cda/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py#L796 image