Search code examples
pythonnlpbert-language-modelsentence-transformerssslerrorhandler

Error while using bert-base-nli-mean-tokens bert model


I am using this code:

model = SentenceTransformer('bert-base-nli-mean-tokens')
body = list(data['preprocessedBody'])
bodyEmbedding = model.encode(body, show_progress_bar = True)

However, I am getting this error:

ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/sentence-transformers/bert-base-nli-mean-tokens (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1129)'))))
​

Is there any solution to it?

Thank you for your time


Solution

  • It was simply a proxy issue. I just added https and http and their relative proxy values into system environment in windows.