This error, HTTPSConnectionPool(host=’huggingface.co’, port=443), often occurs when downloading the huggingface model, even if you’ve got the right internet posture.
As in the download of Tokenizer.
tokenizer = AutoTokenizer.from_pretrained("csebuetnlp/mT5_multilingual_XLSum")
The above error HTTPSConnectionPool(host=’huggingface.co’, port=443) will occur.
The solution can be twofold.
1. Directly download the model
The first way, you can directly on huggingface, specify the files and versions of the model to download, after all the downloads are completed, set the path of the local model, that is, the address of the folder that will be placed locally after the download.
tokenizer = AutoTokenizer.from_pretrained("Local path to the model")
This way, when the model is loaded, it is not downloaded from the internet, but used directly from the local model.
2. Downgrade requests and urllib3
If you don’t want to download so many files manually, you can downgrade requests to 2.27.1 and urllib3 to 1.25.11, but of course being able to do so assumes that you already have the right internet posture.
pip install requests==2.27.1
pip install urllib3==1.25.11
As you can see, the model is downloading itself
Downloading (…)okenizer_config.json: 100%|██████████| 375/375 [00:00<?, ?B/s]
Downloading (…)lve/main/config.json: 100%|██████████| 730/730 [00:00<?, ?B/s]
Downloading spiece.model: 100%|██████████| 4.31M/4.31M [00:03<00:00, 1.08MB/s]
Downloading (…)cial_tokens_map.json: 100%|██████████| 65.0/65.0 [00:00<00:00, 65.1kB/s]