Can't load weights for GPT2 error
## System Info
Pop!_OS 20.04
Pytorch: 1.5.1
Transformers: 2.11.0
Python: 3.7.6


## Details
I am working behind a proxy. If I run the following:
```python
from transformers import GPT2Tokenizer
proxies = {'http':'http://my.proxy.com:port', 'https':'https://my.proxy.com:port'}
tokenizer = GPT2Tokenizer.from_pretrained("gpt2", proxies=proxies)
```
The tokenizer gets downloaded. However, if I run:
```python
from transformers import GPT2LMHeadModel
proxies = {'http':'http://my.proxy.com:port', 'https':'https://my.proxy.com:port'}
model = GPT2LMHeadModel.from_pretrained("gpt2", proxies=proxies)
```
I get the following error:
```python
Traceback (most recent call last):
  File "/path/to/anaconda3/lib/python3.7/site-packages/transformers/modeling_utils.py", line 638, in from_pretrained
    raise EnvironmentError
OSError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/path/to/text_gen_w_transformers/finetune_test.py", line 28, in <module>
    model = GPT2LMHeadModel.from_pretrained("gpt2", proxies=proxies)
  File "/path/to/anaconda3/lib/python3.7/site-packages/transformers/modeling_utils.py", line 645, in from_pretrained
    raise EnvironmentError(msg)
OSError: Can't load weights for 'gpt2'. Make sure that:

- 'gpt2' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'gpt2' is the correct path to a directory containing a file named one of pytorch_model.bin, tf_model.h5, model.ckpt.
```

Any thoughts about what might be the issue? Thanks in advance for your help!
Hi! This is probably because the error reponse for a request is silenced . You can place a breakpont [here](https://github.com/huggingface/transformers/blob/0533cf470659b97c6279bd04f65536a1ec88404a/src/transformers/file_utils.py#L681) and check. Mine was SSL error, so I set `REQUESTS_CA_BUNDLE` env var to `/etc/ssl/certs/ca-certificates.crt`<|||||>@festeh Which variable should I be looking at in the breakpoint? If it's `response`, which attribute?<|||||>You can just type `requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)` in debugger console and check exception traceback.<|||||>I gave that a shot and got the following:
```python
In[7]: requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)
Out[7]: <Response [200]>
```<|||||>Interesting, probably you have an error around this request then, when you're actually downloading weights
https://github.com/huggingface/transformers/blob/7fad617dc1fc681a7f5da5e0172c8b83f4bf0024/src/transformers/file_utils.py#L678

if you place a breakpoint here, would the program hit it? and if not could you send this request manually?<|||||>I think the program hits it:
```
requests.get(url, stream=True, proxies=proxies, headers=headers)
Out[2]: <Response [200]>
```<|||||>Well, if you get the message from the first post it means that some line of code has raised an `EnvironmentError` or `TimeoutError`. I think you need to advance over all lines in `get_from_cache` and find out which line is responsible for that. After you find this line, you can re-run it in console and see the actual exception.<|||||>Ok here is what I found out. If I place a breakpoint at `etag = None` in `get_from_cache()` in `file_utils.py` and try to run things, it stops by that breakpoint twice. The first time, I step through to `response = requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)` and get the following response (with the inputs shown from the debugger):
```python
cache_dir = {str} '/path/to/.cache/torch/transformers'
etag = {NoneType} None
etag_timeout = {int} 10
force_download = {bool} False
local_files_only = {bool} False
proxies = {dict: 3} {'http': 'http://myproxy.com:port', 'https': 'https://myproxy.com:port', 'no': ',127.0.0.1,127.0.0.111,127.0.0.2'}
response = {Response} <Response [200]>
resume_download = {bool} False
url = {str} 'https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-config.json'
user_agent = {NoneType} None

requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)
Out[1]: <Response [200]>
```

on the second time, I get:
```python
cache_dir = {str} '/path/to/.cache/torch/transformers'
etag = {NoneType} None
etag_timeout = {int} 10
force_download = {bool} False
local_files_only = {bool} False
proxies = {dict: 3} {'http': 'http://myproxy.com:port', 'https': 'https://myproxy.com:port', 'no': ',127.0.0.1,127.0.0.111,127.0.0.2'}
resume_download = {bool} False
url = {str} 'https://cdn.huggingface.co/gpt2-pytorch_model.bin'
user_agent = {NoneType} None

requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)
Traceback (most recent call last):
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
    cnx.do_handshake()
  File "/path/to/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1934, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/path/to/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1671, in _raise_ssl_error
    _raise_current_error()
  File "/path/to/anaconda3/lib/python3.7/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 662, in urlopen
    self._prepare_proxy(conn)
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 948, in _prepare_proxy
    conn.connect()
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/connection.py", line 360, in connect
    ssl_context=context,
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
    raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])",)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/connectionpool.py", line 720, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/path/to/anaconda3/lib/python3.7/site-packages/urllib3/util/retry.py", line 436, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='cdn.huggingface.co', port=443): Max retries exceeded with url: /gpt2-pytorch_model.bin (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/path/to/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-5b27aae00c67>", line 1, in <module>
    requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/api.py", line 101, in head
    return request('head', url, **kwargs)
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/path/to/anaconda3/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='cdn.huggingface.co', port=443): Max retries exceeded with url: /gpt2-pytorch_model.bin (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))
```
Also on the second time, it skips right over the `if response.status_code == 200:` check and goes straight to `except (EnvironmentError, requests.exceptions.Timeout):` when I advance a step from `response = requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)`
```python
etag = None
    if not local_files_only:
        try:
            response = requests.head(url, allow_redirects=True, proxies=proxies, timeout=etag_timeout)
            if response.status_code == 200:
                etag = response.headers.get("ETag")
        except (EnvironmentError, requests.exceptions.Timeout):
            # etag is already None
            pass
```<|||||>Any further thoughts on this?<|||||>I'm suffering same problem. Cannot use behind the proxy servers (private network).<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
<|||||>I have  the same problem. `AutoModelForSeq2SeqLM.from_pretrained("google/pegasus-xsum")` just idles forever.
Last version of transformers and torch. 
Im not using proxy, but if I use vpn 'from_pretrained' is actually downloading the model<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
<|||||>This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.