stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

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

Open XavierXiao opened this issue 3 years ago • 20 comments

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?

XavierXiao avatar Sep 19 '22 23:09 XavierXiao

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

apsifly avatar Sep 24 '22 21:09 apsifly

+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?

successbyfailure avatar Sep 27 '22 19:09 successbyfailure

already fixed at least in 4.22.1

apsifly avatar Sep 27 '22 20:09 apsifly

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

successbyfailure avatar Sep 28 '22 02:09 successbyfailure

so what should we do if we face this error?

gregedout avatar Oct 12 '22 03:10 gregedout

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

successbyfailure avatar Oct 12 '22 14:10 successbyfailure

fwiw im getting this error with transformers 4.27.1

sjkoelle avatar Apr 03 '23 00:04 sjkoelle

Also having issues on the latest version

squewel avatar Apr 08 '23 22:04 squewel

Still happening as of 27 May with latest transformers version.

MrHup avatar May 27 '23 08:05 MrHup

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

wyf-gh avatar Dec 14 '23 08:12 wyf-gh

meet in 4.37.1

VikingMew avatar Jan 28 '24 13:01 VikingMew

meet in 4.37.1

meet too! 4.37.1 do you solve this problem?

Value-Jack avatar Mar 11 '24 13:03 Value-Jack

me too in 4.31.

DetoitBecomeHuman avatar Mar 19 '24 07:03 DetoitBecomeHuman

same for 4.39.1

mlmlh avatar Mar 24 '24 20:03 mlmlh

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

BingliangLi avatar Apr 08 '24 12:04 BingliangLi

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.

Forence1999 avatar May 27 '24 12:05 Forence1999

In my case, upgrading the transformers version did not resolve the issue, so I focused on the 'subfolder="unet"' parameter. Originally, the code was written as : UNet2DConditionModel.from_pretrained(config["stable_diffusion_path"]) I modified it to: UNet2DConditionModel.from_pretrained(config["stable_diffusion_path"], subfolder="unet") After this change, I cleared the Hugging Face cache using the following command: rm -rf ~/.cache/huggingface/hub Then, I ran the original file I was trying to execute. This approach proved effective in resolving the issue.

Jeon-jisu avatar Jul 11 '24 06:07 Jeon-jisu