diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Where to save the model locally?

Open Marcophono2 opened this issue 3 years ago • 1 comments

I cannot believe that I really ask this but after two hours of research I didn't find a working way. I did it very often a few months ago but with my new setup - I am lost. The only things which are different now are that I am using model 1.5 (before 1.4) and that I installed SD now with git clone. (before I downloaded the zipped source and installed it). So when the SD code was to find in the conda environment I had no problem to rename the downloaded model file into model.ckpt and move it to the existing folder models/ldm/stable-diffusion-v1. Then changing the path in the python script and ready. But now it don't want to work. That sub folder where I shall copy the model.ckpt is not existing when installing via git clone. So I simply created that folder structure and went on. But always when I try to run my python script I get

OSError: We couldn't connect to 'https://huggingface.co' to load this model, couldn't find it in the cached files and it looks like ./stable-diffusion-v1 is not the path to a directory containing a model_index.json file.

My code (at this moment) is:

pipe1 = StableDiffusionPipeline.from_pretrained("./stable-diffusion-v1", revision="fp16",torch_dtype=torch.bfloat16).to("cuda:1")

but I tried dozens of other links but nothing helped.

Marcophono2 avatar Nov 21 '22 09:11 Marcophono2

Hey @Marcophono2,

Sorry to be so late to reply here.

Note that if you pass "./stable-diffusion-v1" it means that you're loading the model locally. Could you make sure that your local folder ./stable-diffusion-v1 has the correct format?

patrickvonplaten avatar Nov 28 '22 11:11 patrickvonplaten

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Dec 22 '22 15:12 github-actions[bot]

In windows 10 I found the model here: C:\Users{user}.cache\huggingface\hub\models--stabilityai--stable-diffusion-2-1 I found the path to the file as a result of executing this code:

from diffusers import StableDiffusionPipeline
import torch

model_id = "stabilityai/stable-diffusion-2-1"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)

print(pipe.components)

MATEMATNKx avatar Jun 20 '23 09:06 MATEMATNKx