Transformers get stuck in from_pretraind
Author: luisgg98
Pull request: no
Labels: name: bug

### System Info

```shell
- `transformers` version: 4.19.2
- Platform: Linux-4.15.0-180-generic-x86_64-with-debian-11.0
- Python version: 3.7.11
- Huggingface_hub version: 0.7.0
- PyTorch version (GPU?): 1.7.1 (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?: No
- Using distributed or parallel set-up in script?: No
```


### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [x] 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

Requirements
```
celery==4.4.7
redis==3.4.1
Flask==1.1.4
itsdangerous==1.1.0
markupsafe==1.1.1
Flask-Cors==3.0.3
flower==0.9.7
Flask-Migrate==2.5.2
flask-restplus==0.13.0
Flask-Script==2.0.6
Werkzeug==0.16.1
summa==1.2.0
pattern3==3.0.0
gensim==3.8.3
pandas==1.1.5
keybert==0.5.0
numpy==1.19.5
nltk==3.6.3
beautifulsoup4==4.10.0
requests==2.21.0
text2text==0.6.6
wikipedia-api
jinja2<3.1.0
torch==1.7.1 #conda install pytorch cudatoolkit=10.1 
transformers==4.19.2 #pip install transformers #pip install transformers[sentencepiece]
streamlit==1.5.0 #Review if finally used
seaborn==0.11.2 #Review if finally used
spacy==3.2.1
segtok==1.5.11
datasets==1.18.2
wiktionaryparser==0.0.97
en-core-web-md @ https://github.com/explosion/spacy-models/releases/download/en_core_web_md-3.2.0/en_core_web_md-3.2.0-py3-none-any.whl
es-core-news-md @ https://github.com/explosion/spacy-models/releases/download/es_core_news_md-3.2.0/es_core_news_md-3.2.0-py3-none-any.whl
rouge-score
absl-py
sacrebleu
meteor

```



Python code
```python
    model_name="Vamsi/T5_Paraphrase_Paws"
    AutoTokenizer.from_pretrained(model_name)
    print(f"1 Loading model {str(model_name)}")
    AutoModelForSeq2SeqLM.from_pretrained(model_name)
    print(f"2 Loading model {str(model_name)}")    

```     





### Expected behavior

```shell
Good evening, sorry, I'm new working with Huggingface library.
I'm having an issue deploying a Flask application that I've deployed in Python.
It gets stuck at AutoModelForSeq2SeqLM.from_pretrained(model_name) and the loading process last forever.
I'm not sure if I've committed any mistake and this is not a bug so in case please notifiy me.
Thank you so much.
```


Comments:
I am experiencing the same problem with the .from_pretrained calls. For me the temporary solution was to use a VPN, but of course it isn't fun. I was wondering why we need internet connection at all, since after the first call the data should be cached locally. Maybe add a flag in the call to explicitly run offline only?

In case of connection issues, you can try the [offline mode](https://huggingface.co/docs/transformers/v4.19.2/en/installation#offline-mode).

Could you share a bit regarding your location/network? Do you mange to download files when going through the UI on the hub?

> In case of connection issues, you can try the [offline mode]

Thanks! This is what I was looking for!



> Could you share a bit regarding your location/network? Do you mange to download files when going through the UI on the hub?

On my side, I am connecting through the VPN of my org. VPN location is chosen automatically, but when I turn it off the code execution of the .from_pretrained(..) is normal, whereas in the last days with VPN on it takes maybe 15 minutes. Before there were no issues with this. I am capable of downloading without issues the files from the hub directly.

Thanks for your time!