Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XavierXiao opened this issue Sep 19, 2022 · 17 comments

Comments

@XavierXiao
Copy link

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
Copy link

apsifly commented Sep 24, 2022

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
Copy link

+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
Copy link

apsifly commented Sep 27, 2022

already fixed at least in 4.22.1

@successbyfailure
Copy link

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

@gregedout
Copy link

so what should we do if we face this error?

@successbyfailure
Copy link

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
Copy link

sjkoelle commented Apr 3, 2023

fwiw im getting this error with transformers 4.27.1

@squewel
Copy link

squewel commented Apr 8, 2023

Also having issues on the latest version

@MrHup
Copy link

MrHup commented May 27, 2023

Still happening as of 27 May with latest transformers version.

@wyf-gh
Copy link

wyf-gh commented Dec 14, 2023

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

@VikingMew
Copy link

meet in 4.37.1

@Value-Jack
Copy link

meet in 4.37.1

meet too! 4.37.1 do you solve this problem?

@DetoitBecomeHuman
Copy link

me too in 4.31.

@mlmlh
Copy link

mlmlh commented Mar 24, 2024

same for 4.39.1

@BingliangLi
Copy link

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
Copy link

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.

@Jeon-jisu
Copy link

Jeon-jisu commented Jul 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests