/gpt2/resolve/main/tokenizer_config.json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number
Author: starlitsky2010
Pull request: no

### System Info

/usr/local/lib/python3.8/dist-packages/pandas/core/computation/expressions.py:20: UserWarning: Pandas requires version '2.7.3' or newer of 'numexpr' (version '2.7.2' currently installed).
  from pandas.core.computation.check import NUMEXPR_INSTALLED

Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.

- `transformers` version: 4.29.2
- Platform: Linux-5.4.0-144-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.14.1
- Safetensors version: not installed
- PyTorch version (GPU?): 2.0.0a0+1767026 (False)
- 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?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

Hi @ArthurZucker @younesbelkada @sgugger,

Environment
```
enroot 3.4.1
pyxis 0.7.0
slurm slurm-wlm 19.05.5
Ubuntu 20.04
NeMo docker image: nvcr.io+ea-bignlp+nemofw-training+23.04.1-py3.sqsh

```
When I do the pile dataset preprocessing. The following error occurs.
```
Traceback (most recent call last):
  File "/opt/NeMo/nemo/collections/common/tokenizers/huggingface/auto_tokenizer.py", line 74, in __init__
    self.tokenizer = AUTOTOKENIZER.from_pretrained(
  File "/usr/local/lib/python3.8/dist-packages/transformers/models/auto/tokenization_auto.py", line 643, in from_pretrained
    tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/transformers/models/auto/tokenization_auto.py", line 487, in get_tokenizer_config
    resolved_config_file = cached_file(
  File "/usr/local/lib/python3.8/dist-packages/transformers/utils/hub.py", line 417, in cached_file
    resolved_file = hf_hub_download(
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/file_download.py", line 1195, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/file_download.py", line 1532, in get_hf_file_metadata
    r = _request_wrapper(
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/file_download.py", line 407, in _request_wrapper
    response = _request_wrapper(
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/file_download.py", line 442, in _request_wrapper
    return http_backoff(
  File "/usr/local/lib/python3.8/dist-packages/huggingface_hub/utils/_http.py", line 212, in http_backoff
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /gpt2/resolve/main/tokenizer_config.json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2635)')))
```

I've tried downgrade request==2.19.1 and certifi==2018.8.13 but still failed.

When I run a script below:

test_ssl.py
```
import ssl
print(ssl.OPENSSL_VERSION)
```
Then,
```
# python test_ssl.py
OpenSSL 1.1.1f  31 Mar 2020
```
Then execute below 
```
python -c "from transformers import AutoTokenizer; tok_gpt=AutoTokenizer.from_pretrained('gpt2');"
```
It will download the gpt2 tokenizer like this:

```
root@nf5688m7-1:/workspace# tree ~/.cache/huggingface/hub/
/root/.cache/huggingface/hub/
├── models--gpt2
│   ├── blobs
│   │   ├── 10c66461e4c109db5a2196bff4bb59be30396ed8
│   │   ├── 1f1d9aaca301414e7f6c9396df506798ff4eb9a6
│   │   ├── 226b0752cac7789c48f0cb3ec53eda48b7be36cc
│   │   └── 4b988bccc9dc5adacd403c00b4704976196548f8
│   ├── refs
│   │   └── main
│   └── snapshots
│       └── e7da7f221d5bf496a48136c0cd264e630fe9fcc8
│           ├── config.json -> ../../blobs/10c66461e4c109db5a2196bff4bb59be30396ed8
│           ├── merges.txt -> ../../blobs/226b0752cac7789c48f0cb3ec53eda48b7be36cc
│           ├── tokenizer.json -> ../../blobs/4b988bccc9dc5adacd403c00b4704976196548f8
│           └── vocab.json -> ../../blobs/1f1d9aaca301414e7f6c9396df506798ff4eb9a6
└── version.txt
```
How can I solve the SSL problem when download gpt2 tokenizer.json and make it download to /gpt2/resolve/main/tokenizer_config.json automatically?

Thanks
Aaron





### Information

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

### Tasks

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

### Reproduction

1. Environment
```
enroot 3.4.1
pyxis 0.7.0
slurm slurm-wlm 19.05.5
Ubuntu 20.04
NeMo docker image: nvcr.io+ea-bignlp+nemofw-training+23.04.1-py3.sqsh
```
2. python -c "from transformers import AutoTokenizer; tok_gpt=AutoTokenizer.from_pretrained('gpt2');"

3. How can I solve the SSL problem when download gpt2 tokenizer.json and make it download to /gpt2/resolve/main/tokenizer_config.json automatically?


### Expected behavior

 download gpt2 tokenizer.json and make it download to /gpt2/resolve/main/tokenizer_config.json 

Comments:
The error seems like a temporary failure on the Hub, your code does not error on my side. As for downloading in another folder you need to use the `cache_dir` argument to change the cache location.

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.