I am using google collab with PyTorch version 1.7.0+cu101
I am getting an SSL Error when I am trying to download "distilroberta-base-paraphrase-v1" model.
Code
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('distilroberta-base-paraphrase-v1')
Error
SSLError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
599 body=body, headers=headers,
--> 600 chunked=chunked)
601
24 frames
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
MaxRetryError: HTTPSConnectionPool(host='public.ukp.informatik.tu-darmstadt.de', port=443): Max retries exceeded with url: /reimers/sentence-transformers/v0.2/distilroberta-base-paraphrase-v1.zip (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
During handling of the above exception, another exception occurred:
SSLError Traceback (most recent call last)
SSLError: HTTPSConnectionPool(host='public.ukp.informatik.tu-darmstadt.de', port=443): Max retries exceeded with url: /reimers/sentence-transformers/v0.2/distilroberta-base-paraphrase-v1.zip (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
During handling of the above exception, another exception occurred:
FileNotFoundError Traceback (most recent call last)
/usr/lib/python3.6/shutil.py in rmtree(path, ignore_errors, onerror)
473 # lstat()/open()/fstat() trick.
474 try:
--> 475 orig_st = os.lstat(path)
476 except Exception:
477 onerror(os.lstat, path, sys.exc_info())
FileNotFoundError: [Errno 2] No such file or directory: '/root/.cache/torch/sentence_transformers/sbert.net_models_distilroberta-base-paraphrase-v1'
I'm also seeing this, exact same error for SentenceTransformer('bert-base-nli-stsb-mean-tokens')
You can try to download the models from here and unzip them (and load from local disc then):
https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/
@nreimers Yea I manually downloaded the model and it worked for me. Thanks
You can try to download the models from here and unzip them (and load from local disc then):
https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/
I was working with another model on google colab and don't have a fast internet connection to download and upload every time. When do you think that it will be solved?
Not sure what the issue is with google colab, so sadly cannot say when it will be solved.
But you can also use colab to download files:
!wget https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/distilbert-base-nli-stsb-mean-tokens.zip
And the unzip with colab
I 've solved this issue in colab by doing the following:
! wget --no-check-certificate https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/bert-large-nli-stsb-mean-tokens.zip
!unzip /content/bert-large-nli-stsb-mean-tokens.zip -d /root/.cache/torch/sentence_transformers/sbert.net_models_bert-large-nli-stsb-mean-tokens
I temporally switched the model download to a different server (to a mirror server). It should hopefully work.
I am not sure if the mirror server has all models from the main server. If some model is missing, let me know and I can upload it.
It appears that the authority that signed the SSL certificate (DFN) is somehow not recognized by all systems as legitimate.
Hi @nreimers ,
The following models are also giving an error in colab:
distilroberta-base-paraphrase-v1 and xlm-r-distilroberta-base-paraphrase-v1
I 've solved this issue in colab by doing the following:
! wget --no-check-certificate https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/bert-large-nli-stsb-mean-tokens.zip
!unzip /content/bert-large-nli-stsb-mean-tokens.zip -d /root/.cache/torch/sentence_transformers/sbert.net_models_bert-large-nli-stsb-mean-tokens
@apostolosT @nreimers May I ask where to unzip for different models? tried roberta-large-nli-stsb-mean-tokens by simply replacing model names but failed in the unzip part.
checkdir: cannot create extraction directory: /root/.cache/torch/sentence_transformers/sbert.net_models_roberta-large-nli-stsb-mean-tokens
No such file or directory
@pritamdeka
Thanks, should be fixed now.
You have to ensure that '/root/.cache/torch/sentence_transformers/' exists as path. Maybe you have to create it before you can run unzip
@tianzongw You need to install sentence-transformers first before unzipping the pre-trained models using the method @apostolosT mentioned. Hopefully it would solve your error.
The issue should be fixed now
Most helpful comment
I 've solved this issue in colab by doing the following:
! wget --no-check-certificate https://public.ukp.informatik.tu-darmstadt.de/reimers/sentence-transformers/v0.2/bert-large-nli-stsb-mean-tokens.zip!unzip /content/bert-large-nli-stsb-mean-tokens.zip -d /root/.cache/torch/sentence_transformers/sbert.net_models_bert-large-nli-stsb-mean-tokens