requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/api/bert/models/bert
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/bertthe whole call stack isTraceback (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/REDACTED_TOKEN.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
2022-01-02T03:52:33Z
@jackliusrDid you ever resolve this issue? Facing same error
2022-01-13T11:04:08Z
Same for me. I suppose there is a bug in thefrom_pretrainedmethod, since it tries to connect to huggingface repo even when the model is fully cached.@sguggercould you please have a look?
2022-01-13T14:43:14Z
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 variableTRANSFORMERS_OFFLINEto 1 or yes (seehere).
2023-03-08T10:35:15Z
same problem, how to solve this problem?
2023-07-01T22:40:07Z
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.