Skip to content

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

Open

Description

@XavierXiao

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?

Activity

  1. apsifly commented on Sep 24, 2022

    @apsifly

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

  2. successbyfailure commented on Sep 27, 2022

    @successbyfailure

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

  3. apsifly commented on Sep 27, 2022

    @apsifly

    already fixed at least in 4.22.1

  4. successbyfailure commented on Sep 28, 2022

    @successbyfailure

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

  5. gregedout commented on Oct 12, 2022

    @gregedout

    so what should we do if we face this error?

  6. successbyfailure commented on Oct 12, 2022

    @successbyfailure

    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

  7. sjkoelle commented on Apr 3, 2023

    @sjkoelle

    fwiw im getting this error with transformers 4.27.1

  8. squewel commented on Apr 8, 2023

    @squewel

    Also having issues on the latest version

  9. MrHup commented on May 27, 2023

    @MrHup

    Still happening as of 27 May with latest transformers version.

  10. wyf-gh commented on Dec 14, 2023

    @wyf-gh

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

  11. VikingMew commented on Jan 28, 2024

    @VikingMew

    meet in 4.37.1

  12. Value-Jack commented on Mar 11, 2024

    @Value-Jack

    meet in 4.37.1

    meet too! 4.37.1 do you solve this problem?

  13. DetoitBecomeHuman commented on Mar 19, 2024

    @DetoitBecomeHuman

    me too in 4.31.

  14. mlmlh commented on Mar 24, 2024

    @mlmlh

    same for 4.39.1

  15. BingliangLi commented on Apr 8, 2024

    @BingliangLi

    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
    
  16. Forence1999 commented on May 27, 2024

    @Forence1999

    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.

  17. jsujeon commented on Jul 11, 2024

    @jsujeon

    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.

  18. adityapandey2811 commented on Sep 12, 2024

    @adityapandey2811

    For me, I updated:

    UNet2DConditionModel.from_pretrained(model_id)
    to
    UNet2DConditionModel.from_pretrained(model_id, subfolder="unet")

    and

    DDPMScheduler.from_pretrained(model_id)
    to
    DDPMScheduler.from_pretrained(model_id, subfolder="scheduler")

    This worked for me.

  19. XinyiZheng commented on Mar 7, 2025

    @XinyiZheng

    I try to download the model using huggingface-cli in Windows powershell, and change coda as vae = AutoencoderKL.from_pretrained(path, subfolder="vae", use_safetensors=True), it is successful. my env is transformers==4.49.0

  20. wujiang0156 commented on May 8, 2025

    @wujiang0156

    noise_scheduler = DDPMScheduler.from_pretrained(
    args.pretrained_model_name_or_path, subfolder="scheduler"
    )
    then
    OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named scheduler_config.json.

    is anyone solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions