# requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/bert/models/bert

**URL:** <https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728>\
**Category:** 🤗Transformers\
**Created:** [September 5, 2021, 6:50am UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728 "2021-09-05T06:50:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jackliusr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jackliusr/32/2655_2.png) [@jackliusr](https://discuss.huggingface.co/u/jackliusr)\
**Post date:** [September 5, 2021, 6:50am UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/1 "2021-09-05T06:50:59Z")

</div>

```python
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

```

above code raise error requests.exceptions.HTTPError: 404 Client Error: Not Found for url: [https://huggingface.co/api/bert/models/bert](https://huggingface.co/api/bert/models/bert)

the whole call stack is

```auto
Traceback (most recent call last):
  File "key_gen_search.py", line 20, in <module>
    from reader import dataset_str
  File "/home/jack/prjs/TSMH/key_gen/reader.py", line 9, in <module>
    from utils import keyword_pos2sta_vec
  File "/home/jack/prjs/TSMH/key_gen/utils.py", line 18, in <module>
    bert_scorer = BERT_Scorer(config.bert_path)
  File "../bert/bert_scorer.py", line 11, in __init__
    self.tokenizer = BertTokenizer.from_pretrained(pretrained)
  File "/home/jack/.local/share/virtualenvs/key_gen-eKA6qkca/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 1649, in from_pretrained
    fast_tokenizer_file = get_fast_tokenizer_file(
  File "/home/jack/.local/share/virtualenvs/key_gen-eKA6qkca/lib/python3.8/site-packages/transformers/tokenization_utils_base.py", line 3425, in get_fast_tokenizer_file
    all_files = get_list_of_files(
  File "/home/jack/.local/share/virtualenvs/key_gen-eKA6qkca/lib/python3.8/site-packages/transformers/file_utils.py", line 1730, in get_list_of_files
    model_info = HfApi(endpoint=HUGGINGFACE_CO_RESOLVE_ENDPOINT).model_info(
  File "/home/jack/.local/share/virtualenvs/key_gen-eKA6qkca/lib/python3.8/site-packages/huggingface_hub/hf_api.py", line 503, in model_info
    r.raise_for_status()
  File "/home/jack/.local/share/virtualenvs/key_gen-eKA6qkca/lib/python3.8/site-packages/requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/bert/models/bert

```

---

<div class="post-metadata">

**Author:** ![bobbydylan](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@bobbydylan](https://discuss.huggingface.co/u/bobbydylan)\
**Post date:** [January 2, 2022, 3:52am UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/2 "2022-01-02T03:52:33Z")

</div>

@jackliusr Did you ever resolve this issue? Facing same error

---

<div class="post-metadata">

**Author:** ![Aktsvigun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aktsvigun/32/19418_2.png) [@Aktsvigun](https://discuss.huggingface.co/u/Aktsvigun)\
**Post date:** [January 13, 2022, 11:04am UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/3 "2022-01-13T11:04:08Z")

</div>

Same for me. I suppose there is a bug in the `from_pretrained` method, since it tries to connect to huggingface repo even when the model is fully cached.  
@sgugger could you please have a look?

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](https://discuss.huggingface.co/u/sgugger)\
**Post date:** [January 13, 2022, 2:43pm UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/4 "2022-01-13T14:43:14Z")

</div>

No that’s not a bug, the method tries to detect if a more recent version of the model is available, which is why it connects to the repo. To work fully offline, you need to set the environment variable `TRANSFORMERS_OFFLINE` to 1 or yes (see [here](https://huggingface.co/docs/transformers/installation#offline-mode)).

---

<div class="post-metadata">

**Author:** ![EJaalborg2022](https://avatars.discourse-cdn.com/v4/letter/e/85f322/32.png) [@EJaalborg2022](https://discuss.huggingface.co/u/EJaalborg2022)\
**Post date:** [March 8, 2023, 10:35am UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/5 "2023-03-08T10:35:15Z")

</div>

same problem, how to solve this problem?

---

<div class="post-metadata">

**Author:** ![Marshalleq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/marshalleq/32/17281_2.png) [@Marshalleq](https://discuss.huggingface.co/u/Marshalleq)\
**Post date:** [July 1, 2023, 10:40pm UTC](https://discuss.huggingface.co/t/requests-exceptions-httperror-404-client-error-not-found-for-url-https-huggingface-co-api-bert-models-bert/9728/6 "2023-07-01T22:40:07Z")

</div>

Surely if something is trying to connect to something that doesn’t exist, that is a bug, because the code should fail gracefully and skip it, in particularly for something so unimportant as a new model that does not exist.
