HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded
Dear, 
I am new in Transformers, I just tried to run the syntax below:

from transformers import BertForSequenceClassification, AdamW, BertConfig
model = BertForSequenceClassification.from_pretrained(
    "bert-base-cased", 
    num_labels = 2, 
    output_attentions = False, 
    output_hidden_states = False 
)

model.cuda()


However, I got an error message like:

`HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded with url: /bert-base-cased/d6992b8cd27d7a132eafce6a8210272329a371b1c762d453588795dd3
835593e (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7ff9e60c6dd0>: Failed to establish a new connection: [Errno -2] Name or service 
not known'))
Traceback (most recent call last):
  File "/root/anaconda3/envs/bert/lib/python3.7/site-packages/urllib3/connection.py", line 170, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/root/anaconda3/envs/bert/lib/python3.7/site-packages/urllib3/util/connection.py", line 73, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/root/anaconda3/envs/bert/lib/python3.7/socket.py", line 752, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
`

Any suggestions on how to fix it?

Kind regards,

MY
Looks like a networking or DNS error. Can you try again, or try from another machine/network?<|||||>Dear @julien-c 

Thank you for the assistance. We will try again to run this.

Kind regards,

MY<|||||>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/master/CONTRIBUTING.md) are likely to be ignored.<|||||>are you using pythonanywhere.com for hosting by any chance..?
because they have a system known as whitelisting sites. you need to go and convince them on their forum to make it whitelisted then it will work perfectly.

@julien-c is right, it is a problem of DNS<|||||>HTTPSConnectionPool(host='cdn-lfs.huggingface.co' - constant - unable to install this - all day long<|||||>from transformers import AutoModelWithLMHead, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("distilbert-base-cased")
model = AutoModelWithLMHead.from_pretrained("distilbert-base-cased")

i am getting this error while I run the above code lines 
ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Read timed out.

any thoughts on how to proceed ?<|||||>i am observing this error while trining the gpt4all 
ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Max retries exceeded with url:<|||||>> HTTPSConnectionPool(host='cdn-lfs.huggingface.co' - constant - unable to install this - all day long

I also encountered the same problem, how did you solve it later?<|||||>any updates on this one?<|||||>@vijaykumar-1551 

> from transformers import AutoModelWithLMHead, AutoTokenizer
>
> tokenizer = AutoTokenizer.from_pretrained("distilbert-base-cased")
> model = AutoModelWithLMHead.from_pretrained("distilbert-base-cased")
>
> i am getting this error while I run the above code lines
> ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co', port=443): Read timed out.
>
> any thoughts on how to proceed ?

I encountered the same issue. As a workaraund I pass `resume_download=True` argument to `from_pretrained` and when the error occurs just restart the script 🤷 

For example,

```python
    model = AutoModelForCausalLM.from_pretrained(
        model_name, 
        torch_dtype=torch.float16, 
        device_map='sequential', 
        resume_download=True,
        cache_dir='.cache/open-llama-13b-open-instruct'
    )
```<|||||>hey sorry i was abit busy, i could not resolve the error yet, will update
as soon I find a solution.
Sorry for the delay.
--
Thanks & Regards
Vijay Kumar V
Python Developer
P2Fsemiconductors
https://www.p2fsemi.com/index.php
Contact: 6361960718


On Wed, 28 Jun 2023 at 21:27, Mikhail Kravets ***@***.***>
wrote:

> @vijaykumar-1551 <https://github.com/vijaykumar-1551>
>
> from transformers import AutoModelWithLMHead, AutoTokenizer
>
> tokenizer = AutoTokenizer.from_pretrained("distilbert-base-cased")
> model = AutoModelWithLMHead.from_pretrained("distilbert-base-cased")
>
> i am getting this error while I run the above code lines
> ConnectionError: HTTPSConnectionPool(host='cdn-lfs.huggingface.co',
> port=443): Read timed out.
>
> any thoughts on how to proceed ?
>
> I encountered the same issue. As a workaraund I pass resume_download=True
> argument to from_pretrained and when the error occurs just restart the
> script 🤷
>
> For example,
>
>     model = AutoModelForCausalLM.from_pretrained(
>         model_name,
>         torch_dtype=torch.float16,
>         device_map='sequential',
>         resume_download=True,
>         cache_dir='.cache/open-llama-13b-open-instruct'
>     )
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/transformers/issues/12575#issuecomment-1611695095>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A4GZTW2DAROMH56L2NHBEWTXNRH7LANCNFSM477ZOC7A>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
