504 Server Error: Gateway Time-out for BertTokenizer
`File /usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_errors.py:259, in hf_raise_for_status(response, endpoint_name)
    258 try:
--> 259     response.raise_for_status()
    260 except HTTPError as e:

File /usr/local/lib/python3.9/dist-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: 504 Server Error: Gateway Time-out for url: https://huggingface.co/api/models/bert-base-uncased/tree/main?recursive=True

The above exception was the direct cause of the following exception:

HfHubHTTPError                            Traceback (most recent call last)
Cell In[6], line 2
      1 from transformers import BertTokenizer
----> 2 tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

File ~/.local/lib/python3.9/site-packages/transformers/tokenization_utils_base.py:1654, in PreTrainedTokenizerBase.from_pretrained(cls, pretrained_model_name_or_path, *init_inputs, **kwargs)
   1651     vocab_files[file_id] = pretrained_model_name_or_path
   1652 else:
   1653     # At this point pretrained_model_name_or_path is either a directory or a model identifier name
-> 1654     fast_tokenizer_file = get_fast_tokenizer_file(
   1655         pretrained_model_name_or_path,
   1656         revision=revision,
   1657         use_auth_token=use_auth_token,
   1658         local_files_only=local_files_only,
   1659     )
   1660     additional_files_names = {
   1661         "added_tokens_file": ADDED_TOKENS_FILE,
   1662         "special_tokens_map_file": SPECIAL_TOKENS_MAP_FILE,
   1663         "tokenizer_config_file": TOKENIZER_CONFIG_FILE,
   1664         "tokenizer_file": fast_tokenizer_file,
   1665     }
   1666     # Look for the tokenizer files

File ~/.local/lib/python3.9/site-packages/transformers/tokenization_utils_base.py:3486, in get_fast_tokenizer_file(path_or_repo, revision, use_auth_token, local_files_only)
   3466 """
   3467 Get the tokenizer file to use for this version of transformers.
   3468 
   (...)
   3483     `str`: The tokenizer file to use.
   3484 """
   3485 # Inspect all files from the repo/folder.
-> 3486 all_files = get_list_of_files(
   3487     path_or_repo, revision=revision, use_auth_token=use_auth_token, local_files_only=local_files_only
   3488 )
   3489 tokenizer_files_map = {}
   3490 for file_name in all_files:

File ~/.local/lib/python3.9/site-packages/transformers/file_utils.py:2103, in get_list_of_files(path_or_repo, revision, use_auth_token, local_files_only)
   2101 else:
   2102     token = None
-> 2103 return list_repo_files(path_or_repo, revision=revision, token=token)

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_deprecation.py:103, in _deprecate_arguments.<locals>._inner_deprecate_positional_args.<locals>.inner_f(*args, **kwargs)
    101         message += "\n\n" + custom_message
    102     warnings.warn(message, FutureWarning)
--> 103 return f(*args, **kwargs)

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_validators.py:120, in validate_hf_hub_args.<locals>._inner_fn(*args, **kwargs)
    117 if check_use_auth_token:
    118     kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> 120 return fn(*args, **kwargs)

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/hf_api.py:1966, in HfApi.list_repo_files(self, repo_id, revision, repo_type, timeout, token)
   1936 @_deprecate_arguments(version="0.17", deprecated_args=["timeout"], custom_message="timeout is not used anymore.")
   1937 @validate_hf_hub_args
   1938 def list_repo_files(
   (...)
   1945     token: Optional[Union[bool, str]] = None,
   1946 ) -> List[str]:
   1947     """
   1948     Get the list of files in a given repo.
   1949 
   (...)
   1964         `List[str]`: the list of files in a given repository.
   1965     """
-> 1966     return [
   1967         f.rfilename
   1968         for f in self.list_files_info(
   1969             repo_id=repo_id, paths=None, revision=revision, repo_type=repo_type, token=token
   1970         )
   1971     ]

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/hf_api.py:1966, in <listcomp>(.0)
   1936 @_deprecate_arguments(version="0.17", deprecated_args=["timeout"], custom_message="timeout is not used anymore.")
   1937 @validate_hf_hub_args
   1938 def list_repo_files(
   (...)
   1945     token: Optional[Union[bool, str]] = None,
   1946 ) -> List[str]:
   1947     """
   1948     Get the list of files in a given repo.
   1949 
   (...)
   1964         `List[str]`: the list of files in a given repository.
   1965     """
-> 1966     return [
   1967         f.rfilename
   1968         for f in self.list_files_info(
   1969             repo_id=repo_id, paths=None, revision=revision, repo_type=repo_type, token=token
   1970         )
   1971     ]

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/hf_api.py:1932, in HfApi.list_files_info(self, repo_id, paths, revision, repo_type, token)
   1930 encoded_path = "/" + quote(path, safe="") if path else ""
   1931 tree_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tree/{revision}{encoded_path}"
-> 1932 for subpath_info in paginate(path=tree_url, headers=headers, params={"recursive": True}):
   1933     if subpath_info["type"] == "file":
   1934         yield _format_as_repo_file(subpath_info)

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_pagination.py:36, in paginate(path, params, headers)
     34 session = get_session()
     35 r = session.get(path, params=params, headers=headers)
---> 36 hf_raise_for_status(r)
     37 yield from r.json()
     39 # Follow pages
     40 # Next link already contains query params

File /usr/local/lib/python3.9/dist-packages/huggingface_hub/utils/_errors.py:301, in hf_raise_for_status(response, endpoint_name)
    297     raise BadRequestError(message, response=response) from e
    299 # Convert `HTTPError` into a `HfHubHTTPError` to display request information
    300 # as well (request id and/or server error message)
--> 301 raise HfHubHTTPError(str(e), response=response) from e

HfHubHTTPError: 504 Server Error: Gateway Time-out for url: https://huggingface.co/api/models/bert-base-uncased/tree/main?recursive=True`
Hi @ZhengMengbin, thanks for raising this issue. 

We had a short outage of the hub website and API earlier today, which is likely the result of the 504 error. I'm able to load the `bert-base-uncased` checkpoint locally on the dev branch of transformers.

If the error persists on your end, could you reply with a reproducible code snippet and information about your running environment (run `transformers-cli env` in your terminal)?<|||||>> Hi @ZhengMengbin, thanks for raising this issue.
> 
> We had a short outage of the hub website and API earlier today, which is likely the result of the 504 error. I'm able to load the `bert-base-uncased` checkpoint locally on the dev branch of transformers.
> 
> If the error persists on your end, could you reply with a reproducible code snippet and information about your running environment (run `transformers-cli env` in your terminal)?

I have a similar issue: huggingface_hub.utils._errors.HfHubHTTPError: 504 Server Error: Gateway Time-out for url: https://huggingface.co/api/models/gpt2.
Here's what I got after run transformers-cli env:
- `transformers` version: 4.10.3
- Platform: Linux-5.15.0-71-generic-x86_64-with-glibc2.31
- Python version: 3.9.15
- PyTorch version (GPU?): 1.13.0+cu117 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?:no
<|||||>Same issue here, requesting bert-base-multilingual-cased 
```
huggingface_hub.utils._errors.HfHubHTTPError: 504 Server Error: Gateway Time-out for url: https://huggingface.co/api/models/bert-base-multilingual-cased
```

Accessing this URL via browser grants a CloudFront error.  
![image](https://github.com/huggingface/transformers/assets/11882946/f5256ec9-e20c-4eb9-9eca-30b7d1680256)

<|||||>This seems to be working again since approx 10 Minutes.  
The model can be loaded (although slow) via code and the api is answering when accessed via browser. 
<|||||>@mkuf @YiranHuangIrene Thanks for the additional information. 

Unfortunately we're still experiencing some issues with the hub which we're actively trying to resolve. Some of the features have come back online but we haven't returned to a full service yet. Apologies for the disruption. 

I'll reply here when I hear everything should be back to normal. Our [HF status twitter](https://twitter.com/hf_status) account is the best place to find the most up to date info on progress, and [status page](https://status.huggingface.co/) to see the current status.<|||||>Autotokenizer doesn't seem to work for any of the pretrained models: roberta, bert or distilled versions. Reason being Bad Gateway error:

`OSError: There was a specific connection error when trying to load distilbert-base-uncased:
504 Server Error: Gateway Time-out for url: [https://huggingface.co/distilbert-base-uncased/resolve/main/config.json`](https://huggingface.co/distilbert-base-uncased/resolve/main/config.json%60)

I am using `requests==2.27.1` and no certificate validation `os.environ['CURL_CA_BUNDLE'] = ''`<|||||>Yes the website is currently experiencing some issues. Should come back in a few minutes, you can check the status [here](https://status.huggingface.co/).