Closed ACE07-Sev closed 2 years ago
Hi, thanks for submitting this issue, this has happened before and we are currently investigate it. Could you please give us the following information about your system:
In the meantime, you can download the model through this link, extract it, and pass the path to the extracted files to the BobcatParser
:
from lambeq import BobcatParser
parser = BobcatParser(model='path/to/model')
diagram = parser.sentence2diagram('This is a test sentence')
diagram.draw()
I have the same problem with SSL certificate. I have tried with the following configuration:
I also downloaded the model from the link you provided and extracted it. I copy-pasted your code, and tried as paths the relative paths and abosulte paths (I/O is working properly with other files) of both the directory containing the model and the file 'pytorch_model.bin', but still the program returns the same SSL error.
Is there something i am doing wrong while loading the local file? Thanks for your help.
Sorry, the download link might have been deprecated. Can you try downloading the model from https://qnlp.cambridgequantum.com/models/bert/latest/model.tar.gz?
Also, I realised that the correct variable is model_name_or_path
. So this will work:
from lambeq import BobcatParser
parser = BobcatParser(model_name_or_path='path/to/model')
diagram = parser.sentence2diagram('This is a test sentence')
diagram.draw()
Many apologies!
Update: the link was broken.
I downloaded the model.tar.gz. How shall I set the Parser path to it? I'm not very familiar with .tar.gz files.
Hi @ACE07-Sev, .tar.gz is an compressed file. You need to extract it first. Maybe this page helps: https://superuser.com/questions/215629/how-to-open-a-tar-gz-file-in-windows
Hi yes now it's fixed. I extracted it and then addressed the file path to that. thank you so much
Hi sorry, I ran the model and got this error :
2022-06-06 18:03:29.258323: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-06 18:03:29.259328: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "C:\Users\elmm\Desktop\CQM\QNLP Depression.py", line 104, in
The parser is working now so I think besides this we can close the issue.
I tried changing the seed to 7 for instance but still got the error. May I ask how can I resolve this?
Follow-up in #12
Below is the code I ran for testing the parser : from lambeq import BobcatParser
parser = BobcatParser() diagram = parser.sentence2diagram('This is a test sentence') diagram.draw()
and this is the error I received when running it : 2022-05-22 20:19:08.041411: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2022-05-22 20:19:08.042271: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Traceback (most recent call last): File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 1342, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1010, in _send_output self.send(msg) File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 950, in send self.connect() File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1123)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\elmm\Desktop\CQM\QNLP Depression 2.py", line 3, in
parser = BobcatParser()
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\text2diagram\bobcat_parser.py", line 258, in init
download_model(model_name_or_path, model_dir, verbose)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\text2diagram\bobcat_parser.py", line 130, in download_model
model_file, headers = urlretrieve(url, reporthook=progress_bar.update)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 239, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 517, in open
response = self._open(req, data)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 534, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
result = func(*args)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 1385, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 1345, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1123)>
How can I resolve this?