question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Textual Inversion got error of cannot find config.json file

See original GitHub issue

Describe the bug

When I follow every step described here, I got the following error:

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

I can use inference Pipeline with no issue. It should be related to token issue, as I can use the colab with notebook_login

Reproduction

python textual_inversion.py --pretrained_model_name_or_path=$MODEL_NAME --use_auth_token  --train_data_dir=$DATA_DIR  --learnable_property="object" --placeholder_token="<cat-toy>" --initializer_token="toy" --resolution=512 --train_batch_size=1 --gradient_accumulation_steps=4 --max_train_steps=3000 --learning_rate=5.0e-04 --scale_lr --lr_scheduler="constant" --lr_warmup_steps=0  --output_dir="textual_inversion_cat" 

Logs

Traceback (most recent call last):
  File "textual_inversion.py", line 587, in <module>
    main()
  File "textual_inversion.py", line 390, in main
    text_encoder = CLIPTextModel.from_pretrained(
  File "/home/yanq/.conda/envs/ldm/lib/python3.8/site-packages/transformers/modeling_utils.py", line 1764, in from_pretrained
    config, model_kwargs = cls.config_class.from_pretrained(
  File "/home/yanq/.conda/envs/ldm/lib/python3.8/site-packages/transformers/models/clip/configuration_clip.py", line 126, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/yanq/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 553, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/yanq/.conda/envs/ldm/lib/python3.8/site-packages/transformers/configuration_utils.py", line 626, in _get_config_dict
    raise EnvironmentError(
OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named config.json.

System Info

  • diffusers version: 0.3.0
  • Platform: Linux-5.4.0-1054-aws-x86_64-with-glibc2.10
  • Python version: 3.8.5
  • PyTorch version (GPU?): 1.11.0 (True)
  • Huggingface_hub version: 0.9.1
  • Transformers version: 4.19.2
  • Using GPU in script?: <fill in>
  • Using distributed or parallel set-up in script?: <fill in>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
patil-surajcommented, Sep 28, 2022

Hey @XavierXiao , @Oragi ! IAs pointed out by @2132660698 if you upgrade transformers version. to >=4.22.0 this should work. Because the subfolder argument isn’t available in previous versions. I will update the minimum version in example requirements.

@FinnFrotscher It looks like you are using the compvis checkpoint, you should clone the diffusers checkpoint to use it with this library. https://huggingface.co/CompVis/stable-diffusion-v1-4

0reactions
2132660698commented, Sep 27, 2022

try this: pip install transformers==4.22.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stable diffusion wont recognize my ui-config.json changes ...
I have edited the ui-config.json to set some default values so I dont need to constantly reset and reprogram SD with my common...
Read more >
Not able to get the config json file - Stack Overflow
According to the module link you provided the config JSON ( default.json ) needs to be in a folder off root called "config"....
Read more >
CompVis/stable-diffusion-v1-4 · Discussions - Hugging Face
Help with an error ... Need help with "Repository not found / make sure you are authenticated" ... Textual inversion: Are the imagenet...
Read more >
Cyberpunk 2077 - PCGamingWiki PCGW
Much like previous CDPR titles, no version of the game requires either GOG Galaxy ... <path-to-game> \bin\x64\plugins\cyber_engine_tweaks\config.json file ...
Read more >
picocli - a mighty tiny command line interface
By embedding these configuration files, your jar is instantly Graal-enabled. In most cases no further configuration is needed when generating a native image....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found