OSError: Can't load config for 'bert-base-uncased'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-base-uncased' is the correct path to a directory containing a config.json file
Author: Arsmart123
Pull request: no
Labels: name: bug

### System Info

```shell
This is my code, simple:

import torch
tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', 'bert-base-uncased')    # Download vocabulary from S3 and cache.
tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', './test/bert_saved_model/')  # E.g. tokenizer was saved using `save_pretrained('./test/saved_model/')`

And I meet this bug:

Downloading: "https://github.com/huggingface/pytorch-transformers/archive/main.zip" to C:\Users\20247/.cache\torch\hub\main.zip
Traceback (most recent call last):
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\connectionpool.py", line 700, in urlopen
    self._prepare_proxy(conn)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\connectionpool.py", line 994, in _prepare_proxy
    conn.connect()
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\connection.py", line 364, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\connection.py", line 501, in _connect_tls_proxy
    socket = ssl_wrap_socket(
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Users\20247\anaconda3\envs\new_1\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "C:\Users\20247\anaconda3\envs\new_1\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:1112: The handshake operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\urllib3-1.26.8-py3.9.egg\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-uncased/resolve/main/config.json (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1112: The handshake operation timed out')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\configuration_utils.py", line 595, in _get_config_dict
    resolved_config_file = cached_path(
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\file_utils.py", line 1947, in cached_path
    output_path = get_from_cache(
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\file_utils.py", line 2150, in get_from_cache
    r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\api.py", line 102, in head
    return request('head', url, **kwargs)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\requests-2.27.1-py3.9.egg\requests\adapters.py", line 513, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-uncased/resolve/main/config.json (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1112: The handshake operation timed out')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\delete.py", line 2, in <module>
    tokenizer = torch.hub.load('huggingface/pytorch-transformers', 'tokenizer', 'bert-base-uncased')    # Download vocabulary from S3 and cache.
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\torch\hub.py", line 399, in load
    model = _load_local(repo_or_dir, model, *args, **kwargs)
  File "C:\Users\20247\anaconda3\envs\new_1\lib\site-packages\torch\hub.py", line 428, in _load_local
    model = entry(*args, **kwargs)
  File "C:\Users\20247/.cache\torch\hub\huggingface_pytorch-transformers_main\hubconf.py", line 68, in tokenizer
    return AutoTokenizer.from_pretrained(*args, **kwargs)
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\models\auto\tokenization_auto.py", line 485, in from_pretrained
    config = AutoConfig.from_pretrained(
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\models\auto\configuration_auto.py", line 647, in from_pretrained
    config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\configuration_utils.py", line 547, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "C:\文件备份\temp_can\transformers-77321481247787c97568c3b9f64b19e22351bab8\src\transformers\configuration_utils.py", line 631, in _get_config_dict
    raise EnvironmentError(
OSError: Can't load config for 'bert-base-uncased'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-base-uncased' is the correct path to a directory containing a config.json file

Process finished with exit code 1
```


### 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

Install torch! And also: pip install tqdm boto3 requests regex sentencepiece sacremoses
And use my code.

### Expected behavior

```shell
Could any expert help me to fix this bug? Also can help other users~Thanks!
```


Comments:
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.