CompVis/stable-diffusion-v1-4 does not appear to have a file named tokenizer/config.json
Author: QiuLL
Pull request: no

### System Info

when I use AutoTokenizer to load tokenizer，use the code below；
tokenizer = transformers.AutoTokenizer.from_pretrained(
            args.pretrained_model_name_or_path,
            subfolder="tokenizer",
            revision=args.revision,
            use_fast=False,
        )
but I found can't get the right tokenizer_config.json file. Indeed the functions try to find config.json file instead of tokenizer_config.json file. So i don't know how to solve it.
│                                                                                                  │
│ /home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/models/auto/tokeniz │
│ ation_auto.py:564 in from_pretrained                                                             │
│                                                                                                  │
│   561 │   │   # If that did not work, let's try to use the config.                               │
│   562 │   │   if config_tokenizer_class is None:                                                 │
│   563 │   │   │   if not isinstance(config, PretrainedConfig):                                   │
│ ❱ 564 │   │   │   │   config = AutoConfig.from_pretrained(                                       │
│   565 │   │   │   │   │   pretrained_model_name_or_path, trust_remote_code=trust_remote_code,    │
│   566 │   │   │   │   )                                                                          │
│   567 │   │   │   config_tokenizer_class = config.tokenizer_class                                │
│                                                                                                  │
│ /home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/models/auto/configu │
│ ration_auto.py:746 in from_pretrained                                                            │
│                                                                                                  │
│   743 │   │   kwargs["_from_auto"] = True                                                        │
│   744 │   │   kwargs["name_or_path"] = pretrained_model_name_or_path                             │
│   745 │   │   trust_remote_code = kwargs.pop("trust_remote_code", False)                         │
│ ❱ 746 │   │   config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_n   │
│   747 │   │   if "auto_map" in config_dict and "AutoConfig" in config_dict["auto_map"]:          │
│   748 │   │   │   if not trust_remote_code:                                                      │
│   749 │   │   │   │   raise ValueError(                                                          │
│                                                                                                  │
│ /home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/configuration_utils │
│ .py:553 in get_config_dict                                                                       │
│                                                                                                  │
│   550 │   │   """                                                                                │
│   551 │   │   original_kwargs = copy.deepcopy(kwargs)                                            │
│   552 │   │   # Get config dict associated with the base config file                             │
│ ❱ 553 │   │   config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwar   │
│   554 │   │   if "_commit_hash" in config_dict:                                                  │
│   555 │   │   │   original_kwargs["_commit_hash"] = config_dict["_commit_hash"]                  │
│   556                                                                                            │
│                                                                                                  │
│ /home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/configuration_utils │
│ .py:608 in _get_config_dict                                                                      │
│                                                                                                  │
│   605 │   │   │                                                                                  │
│   606 │   │   │   try:                                                                           │
│   607 │   │   │   │   # Load from local folder or from cache or download from model Hub and ca   │
│ ❱ 608 │   │   │   │   resolved_config_file = cached_file(                                        │
│   609 │   │   │   │   │   pretrained_model_name_or_path,                                         │
│   610 │   │   │   │   │   configuration_file,                                                    │
│   611 │   │   │   │   │   cache_dir=cache_dir,                                                   │
│                                                                                                  │
│ /home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/utils/hub.py:453 in │
│ cached_file                                                                                      │
│                                                                                                  │
│    450 │   │   │   return None                                                                   │
│    451 │   │   if revision is None:                                                              │
│    452 │   │   │   revision = "main"                                                             │
│ ❱  453 │   │   raise EnvironmentError(                                                           │
│    454 │   │   │   f"{path_or_repo_id} does not appear to have a file named {full_filename}. Ch  │
│    455 │   │   │   f"'https://huggingface.co/{path_or_repo_id}/{revision}' for available files.  │
│    456 │   │   )                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named tokenizer/config.json. Checkout 'https://huggingface.co/CompVis/stable-diffusion-v1-4/main' for available files.



### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

tokenizer = transformers.AutoTokenizer.from_pretrained(
            args.pretrained_model_name_or_path,
            subfolder="tokenizer",
            revision=args.revision,
            use_fast=False,
        )

### Expected behavior

Can someone help me ?

Comments:
The following sample runs without any issue:
```py
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    subfolder="tokenizer",
    use_fast=False,
)
```

Please include a code reproducer of your issue.

> The following sample runs without any issue:
> 
> ```python
> from transformers import AutoTokenizer
> 
> tokenizer = AutoTokenizer.from_pretrained(
>     "CompVis/stable-diffusion-v1-4",
>     subfolder="tokenizer",
>     use_fast=False,
> )
> ```
> 
> Please include a code reproducer of your issue.

`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(
    "CompVis/stable-diffusion-v1-4",
    subfolder="tokenizer",
    use_fast=False,
)`

### **I used your codes as above, but still get the same error:**
(diffusion) qll@longyuan:/data/qll/ColossalAI_2/ColossalAI/examples/images/dreambooth$ python test.py 
Traceback (most recent call last):
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 239, in hf_raise_for_status
    response.raise_for_status()
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/CompVis/stable-diffusion-v1-4/resolve/main/tokenizer/config.json

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/utils/hub.py", line 408, in cached_file
    resolved_file = hf_hub_download(
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1067, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 124, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1376, in get_hf_file_metadata
    hf_raise_for_status(r)
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 257, in hf_raise_for_status
    raise EntryNotFoundError(message, response) from e
huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: Root=1-63be11d8-73a357726aa9511757d467c4)

Entry Not Found for url: https://huggingface.co/CompVis/stable-diffusion-v1-4/resolve/main/tokenizer/config.json.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/qll/ColossalAI_2/ColossalAI/examples/images/dreambooth/test.py", line 3, in <module>
    tokenizer = AutoTokenizer.from_pretrained(
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 564, in from_pretrained
    config = AutoConfig.from_pretrained(
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 746, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/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/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/configuration_utils.py", line 608, in _get_config_dict
    resolved_config_file = cached_file(
  File "/home/qll/anaconda3/envs/diffusion/lib/python3.10/site-packages/transformers/utils/hub.py", line 453, in cached_file
    raise EnvironmentError(
OSError: CompVis/stable-diffusion-v1-4 does not appear to have a file named tokenizer/config.json. Checkout 'https://huggingface.co/CompVis/stable-diffusion-v1-4/main' for available files.


> The following sample runs without any issue:
> 
> ```python
> from transformers import AutoTokenizer
> 
> tokenizer = AutoTokenizer.from_pretrained(
>     "CompVis/stable-diffusion-v1-4",
>     subfolder="tokenizer",
>     use_fast=False,
> )
> ```
> 
> Please include a code reproducer of your issue.

transformers              4.22.2
torch                     1.12.1+cu113


You should upgrade to the latest version of Transformers, this is probably why I don't have the bug on my side, it has been fixed.

> You should upgrade to the latest version of Transformers, this is probably why I don't have the bug on my side, it has been fixed.

thx, it works by upgrading to the latest version of Transformers!