# HTTP error when using BertTokenizer.from\_pretrained

**URL:** <https://discuss.huggingface.co/t/http-error-when-using-berttokenizer-from-pretrained/14515>\
**Category:** 🤗Transformers\
**Created:** [February 8, 2022, 1:58pm UTC](https://discuss.huggingface.co/t/http-error-when-using-berttokenizer-from-pretrained/14515 "2022-02-08T13:58:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunsnowboarder](https://avatars.discourse-cdn.com/v4/letter/h/7ea924/32.png) [@hunsnowboarder](https://discuss.huggingface.co/u/hunsnowboarder)\
**Post date:** [February 8, 2022, 1:58pm UTC](https://discuss.huggingface.co/t/http-error-when-using-berttokenizer-from-pretrained/14515/1 "2022-02-08T13:58:04Z")

</div>

> from transformers import AutoModel, AutoTokenizer, BertForSequenceClassification, BertTokenizer  
> model\_name = “ProsusAI/finbert”
> 
> model = AutoModel.from\_pretrained(model\_name)  
> tokenizer = AutoTokenizer.from\_pretrained(model\_name)

produces the following error:

> * * *
> 
> HTTPError Traceback (most recent call last)  
> ~\Anaconda3\lib\site-packages\transformers\file\_utils.py in get\_from\_cache(url, cache\_dir, force\_download, proxies, etag\_timeout, resume\_download, user\_agent, use\_auth\_token, local\_files\_only)  
> 1947 r = requests.head(url, headers=headers, allow\_redirects=False, proxies=proxies, timeout=etag\_timeout)  
> → 1948 r.raise\_for\_status()  
> 1949 etag = r.headers.get(“X-Linked-Etag”) or r.headers.get(“ETag”)
> 
> ~\Anaconda3\lib\site-packages\requests\models.py in raise\_for\_status(self)  
> 721 if http\_error\_msg:  
> → 722 raise HTTPError(http\_error\_msg, response=self)  
> 723
> 
> HTTPError: 404 Client Error: Not Found
> 
> During handling of the above exception, another exception occurred:
> 
> AttributeError Traceback (most recent call last)  
> in   
> 6  
> 7 model=BertForSequenceClassification.from\_pretrained(“mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis”,num\_labels=3)  
> ----\> 8 tokenizer = BertTokenizer.from\_pretrained(“mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis”)  
> 9  
> 10 sentence = “Operating profit rose to EUR 13.1 mn from EUR 8.7 mn in the corresponding period in 2007 representing 7.7 % of net sales.”
> 
> ~\Anaconda3\lib\site-packages\transformers\tokenization\_utils\_base.py in from\_pretrained(cls, pretrained\_model\_name\_or\_path, \*init\_inputs, \*\*kwargs)  
> 1693 else:  
> 1694 try:  
> → 1695 resolved\_vocab\_files[file\_id] = cached\_path(  
> 1696 file\_path,  
> 1697 cache\_dir=cache\_dir,
> 
> ~\Anaconda3\lib\site-packages\transformers\file\_utils.py in cached\_path(url\_or\_filename, cache\_dir, force\_download, proxies, resume\_download, user\_agent, extract\_compressed\_file, force\_extract, use\_auth\_token, local\_files\_only)  
> 1774 if is\_remote\_url(url\_or\_filename):  
> 1775 # URL, so get it from the cache (downloading if necessary)  
> → 1776 output\_path = get\_from\_cache(  
> 1777 url\_or\_filename,  
> 1778 cache\_dir=cache\_dir,
> 
> ~\Anaconda3\lib\site-packages\transformers\file\_utils.py in get\_from\_cache(url, cache\_dir, force\_download, proxies, etag\_timeout, resume\_download, user\_agent, use\_auth\_token, local\_files\_only)  
> 1961 if 300 \<= r.status\_code \<= 399:  
> 1962 url\_to\_download = r.headers[“Location”]  
> → 1963 except (requests.exceptions.SSLError, requests.exceptions.ProxyError):  
> 1964 # Actually raise for those subclasses of ConnectionError  
> 1965 raise
> 
> AttributeError: module ‘requests.exceptions’ has no attribute ‘ProxyError’

I tried different models (other finbert models) and also AutoTokenizer as well and I get the same error!

What am I not doing right?
