Hugging Face website and models not reachable
Author: christian-rauch
Pull request: no
Labels: name: bug

### System Info

```
$ pip show transformers
Name: transformers
Version: 4.57.1
Summary: State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow
Home-page: https://github.com/huggingface/transformers
Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors)
Author-email: transformers@huggingface.co
```

```
$ python --version
Python 3.12.3
```

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

1. `python -c 'from transformers import pipeline; pipeline = pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")'`

I am getting connection issues:
```
OSError: We couldn't connect to 'https://huggingface.co' to load the files, and couldn't find them in the cached files.
Check your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.
```

It rather funny that it recommends checking https://huggingface.co/docs/transformers/installation#offline-mode when https://huggingface.co is not reachable :-) Maybe this information, e.g. about mirrors, could be hosted somewhere else?

### Expected behavior

The examples should work as documented.

Comments:
I found that
```bash
export HF_ENDPOINT=https://hf-mirror.com
```
works for some models and files.

But `Qwen/Qwen2.5-1.5B` still fails since `cas-bridge.xethub.hf.co` is not reachable:
```
ValueError: Could not load model Qwen/Qwen2.5-1.5B with any of the following classes: (<class 'transformers.models.auto.modeling_auto.AutoModelForCausalLM'>, <class 'transformers.models.qwen2.modeling_qwen2.Qwen2ForCausalLM'>). See the original errors:
[...]
socket.gaierror: [Errno -3] Temporary failure in name resolution
[...]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cas-bridge.xethub.hf.co', port=443): Max retries exceeded with url: /xet-bridge-us/66e6d032663c452ad2400439/8bff19ad30d83352b41b698b3a39904f966f62029771306387e57cb4b2664073?[...] (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x77807a829370>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
```


This is likely caused by the AWS outage yesterday and should be resolved now, right?

I still cannot access https://huggingface.co or run `pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")`. Does this work for others?

I tried running the same python statements in Jupyter Notebook, and in response got an error. Seems as if the API call is being made to a wrong endpoint. But on checking the repo in hugging face the whole directory is "main" .

```Error
HTTPStatusError                           Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
    556     try:
--> 557         response.raise_for_status()
    558     except httpx.HTTPStatusError as e:

/usr/local/lib/python3.11/dist-packages/httpx/_models.py in raise_for_status(self)
    828         message = message.format(self, error_type=error_type)
--> 829         raise HTTPStatusError(message, request=request, response=self)
    830 

HTTPStatusError: Client error '404 Not Found' for url 'https://huggingface.co/api/models/Qwen/Qwen2.5-1.5B/tree/main/additional_chat_templates?recursive=false&expand=false'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404

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

RemoteEntryNotFoundError                  Traceback (most recent call last)
/tmp/ipykernel_37/3802932563.py in <cell line: 0>()
      1 from transformers import pipeline
----> 2 pipeline = pipeline(task="text-generation", model="Qwen/Qwen2.5-1.5B")

/usr/local/lib/python3.11/dist-packages/transformers/pipelines/__init__.py in pipeline(task, model, config, tokenizer, feature_extractor, image_processor, processor, framework, revision, use_fast, token, device, device_map, torch_dtype, trust_remote_code, model_kwargs, pipeline_class, **kwargs)
   1135                 tokenizer_kwargs.pop("torch_dtype", None)
   1136 
-> 1137             tokenizer = AutoTokenizer.from_pretrained(
   1138                 tokenizer_identifier, use_fast=use_fast, _from_pipeline=task, **hub_kwargs, **tokenizer_kwargs
   1139             )

/usr/local/lib/python3.11/dist-packages/transformers/models/auto/tokenization_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
   1048                     f"Tokenizer class {tokenizer_class_candidate} does not exist or is not currently imported."
   1049                 )
-> 1050             return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
   1051 
   1052         # Otherwise we have to be creative.

/usr/local/lib/python3.11/dist-packages/transformers/tokenization_utils_base.py in from_pretrained(cls, pretrained_model_name_or_path, cache_dir, force_download, local_files_only, token, revision, trust_remote_code, *init_inputs, **kwargs)
   1955                                 )
   1956                     else:
-> 1957                         for template in list_repo_templates(
   1958                             pretrained_model_name_or_path,
   1959                             local_files_only=local_files_only,

/usr/local/lib/python3.11/dist-packages/transformers/utils/hub.py in list_repo_templates(repo_id, local_files_only, revision, cache_dir)
    159     if not local_files_only:
    160         try:
--> 161             return [
    162                 entry.path.removeprefix(f"{CHAT_TEMPLATE_DIR}/")
    163                 for entry in list_repo_tree(

/usr/local/lib/python3.11/dist-packages/transformers/utils/hub.py in <listcomp>(.0)
    159     if not local_files_only:
    160         try:
--> 161             return [
    162                 entry.path.removeprefix(f"{CHAT_TEMPLATE_DIR}/")
    163                 for entry in list_repo_tree(

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_api.py in list_repo_tree(self, repo_id, path_in_repo, recursive, expand, revision, repo_type, token)
   3050         encoded_path_in_repo = "/" + quote(path_in_repo, safe="") if path_in_repo else ""
   3051         tree_url = f"{self.endpoint}/api/{repo_type}s/{repo_id}/tree/{revision}{encoded_path_in_repo}"
-> 3052         for path_info in paginate(path=tree_url, headers=headers, params={"recursive": recursive, "expand": expand}):
   3053             yield (RepoFile(**path_info) if path_info["type"] == "file" else RepoFolder(**path_info))
   3054 

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_pagination.py in paginate(path, params, headers)
     35     session = get_session()
     36     r = session.get(path, params=params, headers=headers)
---> 37     hf_raise_for_status(r)
     38     yield from r.json()
     39 

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
    569         elif error_code == "EntryNotFound":
    570             message = f"{response.status_code} Client Error." + "\n\n" + f"Entry Not Found for url: {response.url}."
--> 571             raise _format(RemoteEntryNotFoundError, message, response) from e
    572 
    573         elif error_code == "GatedRepo":

RemoteEntryNotFoundError: 404 Client Error. (Request ID: Root=1-68f94aa6-222549287b41a36b32c864b9;29d0c53b-02d4-4f14-8ac3-065c165447a7)

Entry Not Found for url: https://huggingface.co/api/models/Qwen/Qwen2.5-1.5B/tree/main/additional_chat_templates?recursive=false&expand=false.
additional_chat_templates does not exist on "main"
```

<img width="1844" height="815" alt="Image" src="https://github.com/user-attachments/assets/4fe06c05-2c52-40da-9144-7e00231f9ae5" />


This all works fine for me - are you sure it's not just something like temporary DNS or routing issues related to the AWS outage?

I am not sure, but it can be a routing issues, because some models are working but some are not.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

I forgot to close this issue. The connection problem was related to some problem with the name resolution in our institution network and has been resolved.