GithubHelp home page GithubHelp logo

Error when running Parser about lambeq HOT 9 CLOSED

cqcl avatar cqcl commented on July 17, 2024
Error when running Parser

from lambeq.

Comments (9)

Thommy257 avatar Thommy257 commented on July 17, 2024

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:

  • Which python version do you use?
  • Do you use anaconda?
  • Which IDE do you use?
  • Are you running your code in a notebook/ ipython shell?

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()

from lambeq.

Stephenito avatar Stephenito commented on July 17, 2024

I have the same problem with SSL certificate. I have tried with the following configuration:

  • Python version 3.8
  • Not using Anaconda
  • Jupyter-lab on browser (tried with both Opera GX and Google Chrome) with a notebook
  • I tried even with the Python Shell, still doesn't work.

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.

from lambeq.

Thommy257 avatar Thommy257 commented on July 17, 2024

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.

from lambeq.

ACE07-Sev avatar ACE07-Sev commented on July 17, 2024

I downloaded the model.tar.gz. How shall I set the Parser path to it? I'm not very familiar with .tar.gz files.

from lambeq.

Thommy257 avatar Thommy257 commented on July 17, 2024

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

from lambeq.

ACE07-Sev avatar ACE07-Sev commented on July 17, 2024

Hi yes now it's fixed. I extracted it and then addressed the file path to that. thank you so much

from lambeq.

ACE07-Sev avatar ACE07-Sev commented on July 17, 2024

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
trainer.fit(train_dataset, val_dataset, logging_step=12)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\trainer.py", line 365, in fit
y_hat, loss = self.training_step(batch)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\quantum_trainer.py", line 149, in training_step
y_hat, loss = self.optimizer.backward(batch)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\spsa_optimizer.py", line 125, in backward
y0 = self.model(diagrams)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\model.py", line 59, in call
return self.forward(*args, **kwds)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\tket_model.py", line 131, in forward
return self.get_diagram_output(x)
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\tket_model.py", line 103, in get_diagram_output
seed=self._randint()
File "C:\Users\elmm\AppData\Local\Programs\Python\Python39\lib\site-packages\lambeq\training\tket_model.py", line 71, in _randint
return np.random.randint(low, high)
File "mtrand.pyx", line 746, in numpy.random.mtrand.RandomState.randint
File "_bounded_integers.pyx", line 1334, in numpy.random._bounded_integers._rand_int32
ValueError: low is out of bounds for int32

The parser is working now so I think besides this we can close the issue.

from lambeq.

ACE07-Sev avatar ACE07-Sev commented on July 17, 2024

I tried changing the seed to 7 for instance but still got the error. May I ask how can I resolve this?

from lambeq.

Thommy257 avatar Thommy257 commented on July 17, 2024

Follow-up in #12

from lambeq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.