CompVis / stable-diffusion

A latent text-to-image diffusion model
https://ommer-lab.com/research/latent-diffusion-models/
Other
66.61k stars 9.97k forks source link

OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json. #302

Open XavierXiao opened 1 year ago

XavierXiao commented 1 year ago

When using SD Diffusers, I got errors when running this line

text_encoder = CLIPTextModel.from_pretrained( 'CompVis/stable-diffusion-v1-4', subfolder="text_encoder", use_auth_token=True ),

where the error is

OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json.

Any idea on why this happens?

apsifly commented 1 year ago

Faced this issue myself. Your version of transformers package is probably old and does not recognise subfolder parameter. Not related to this repo though.

successbyfailure commented 1 year ago

+1 Following the guide https://github.com/huggingface/diffusers/tree/main/examples/textual_inversion I also run into that error.

Im using transformers from pip... so.... its waiting till they release a new version?

apsifly commented 1 year ago

already fixed at least in 4.22.1

successbyfailure commented 1 year ago

You're right! The conda env has transformers version pinned to 4.19.2. Updated and solved :)

gregedout commented 1 year ago

so what should we do if we face this error?

successbyfailure commented 1 year ago

Say not today and upgrade transformers.

For me the case was that I had the environment already setup and transformers was pinned to 4.19 in the requirements.txt

So I just edited the requirements.txt and set transformers to at least 4.22.1 then run pip install -r requirements.txt, that did the trick for me

sjkoelle commented 1 year ago

fwiw im getting this error with transformers 4.27.1

squewel commented 1 year ago

Also having issues on the latest version

MrHup commented 1 year ago

Still happening as of 27 May with latest transformers version.

wyf-gh commented 6 months ago

Also having the same issues on transformers==4.36.0 cuda==11.6 pytorch==1.12.0. Does anyone have a solution?

VikingMew commented 5 months ago

meet in 4.37.1

Value-Jack commented 4 months ago

meet in 4.37.1

meet too! 4.37.1 do you solve this problem?

DetoitBecomeHuman commented 3 months ago

me too in 4.31.

mlmlh commented 3 months ago

same for 4.39.1

BingliangLi commented 3 months ago

This can be internet issues, the below solved for me, run this in command line: HF_ENDPOINT=https://hf-mirror.com python # Or just add this before your xx.py and ignore the rest.

Then run the code to cache the model(change the model card name to what you need) text_encoder = CLIPTextModel.from_pretrained( 'CompVis/stable-diffusion-v1-4', subfolder="text_encoder", use_auth_token=True ) Now run you code. Env:

diffusers == 0.27.1
accelerate == 0.28.0
transformers == 4.35.2
Forence1999 commented 1 month ago

I met this error when I use "stabilityai/stablelm-2-1_6b", because I build a folder with the path "stabilityai/stablelm-2-1_6b", which will guide transformers package to load model from the local folder. After removing the folder, the error disappears.