Closed srinjoyganguly closed 2 years ago
Try setting torch.set_default_tensor_type(torch.FloatTensor)
or torch.set_default_tensor_type(torch.cuda.FloatTensor)
at the start of your script?
Hello @srinjoyganguly and thanks for reporting this. @ianyfan has already responded what we think might be the problem, let us know if this works for you.
Hi @ianyfan thank you so much for the help! I tried using the lines you gave at the start of my script but still getting the same issue. The same error persists. I realized that this line - torch.set_default_tensor_type(torch.cuda.FloatTensor)
already existed in my code and I was getting the error. I tried with - torch.set_default_tensor_type(torch.FloatTensor)
but the error is still the same. Are there any other ways?
@dimkart you are very welcome! Thank you a lot!
Hi @srinjoyganguly, can you send us your notebook/code in lambeq-support@cambridgequantum.com (or post it here), so we can have a better look? It's really difficult to say what is going on just from the error message.
Changing the line to
torch.set_default_tensor_type(torch.cuda.DoubleTensor)
should allow the notebook to run, though we are working on a proper fix on the underlying code.
Indeed @ianyfan the code works with DoubleTensor! Thank you so much for the help! I look forward to the proper fix in the underlying code! Thanks a lot @ianyfan and @dimkart !
Thanks for pointing this out @srinjoyganguly. We have updated the notebook to use a double tensor until we fix this in DisCoPy. This issue will be now closed.
You are very welcome @dimkart ! I am glad, thanks so much!
Hi @dimkart I hope you are doing well
I am trying to run the code given here on my Google Colab account - https://github.com/CQCL/lambeq/blob/main/docs/examples/classical_pipeline.ipynb
I am installing lambeq directly on Colab and it is picking up the latest version of DisCoPy
But I am continuously getting an error like this. I have pasted the full stack trace here -
I was able to successfully carry out experiments using the Quantum Pipeline code on Google Colab and did not faced any issues but for this one I am getting error. I have tried to fix the issue by converting variables or some function outputs to float() but I was unable to rectify this.
Can you please help me fix this issue?
Thank you so much!