XanaduAI / quantum-neural-networks

This repository contains the source code used to produce the results presented in the paper "Continuous-variable quantum neural networks". Due to subsequent interface upgrades, these scripts will work only with Strawberry Fields version <= 0.10.0.
https://arxiv.org/abs/1806.06871
Apache License 2.0
299 stars 86 forks source link

TypeError: backend must be a string or a BaseBackend instance. #9

Closed LiuNingtao closed 4 years ago

LiuNingtao commented 4 years ago

When I run the function_fitting.py & fraud_detection.py, there was a same error TypeError: backend must be a string or a BaseBackend instance. When the code runs to this line eng, q = sf.Engine(1)

btw, the version of tensorflow and strawberryfields in my environment are 1.3.0 and 0.13.0

co9olguy commented 4 years ago

Hi @LiuNingtao

The development of strawberryfields has been continuing over the past couple years. As a consequence, this older repo uses a somewhat older version of strawberryfields (mentioned in the readme, but perhaps you missed it). Can you try installing sf version 0.10 and let us know if that does the trick?

LiuNingtao commented 4 years ago

Hey there,

I assume that the higher version of sf will be compatible with the lower version, I am very sorry for this.

Your answer is very helpful. Actually, after my test, the sf’s version for script function_fitting.py and tetrominos_learning.py should be 0.10.0, but which should be 0.11.0 for script fraud_detection.py.

Thank for your answer and your work is so cool!

2020年4月29日 下午11:54,Nathan Killoran notifications@github.com 写道:

Hi @LiuNingtao https://github.com/LiuNingtao The development of strawberryfields has been continuing over the past couple years. As a consequence, this older repo uses a somewhat older version of strawberryfields (mentioned in the readme, but perhaps you missed it). Can you try installing sf version 0.10 and let us know if that does the trick?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/XanaduAI/quantum-neural-networks/issues/9#issuecomment-621302204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHAVX2QNVENPJVWKH43JMYDRPBEUNANCNFSM4MTYYJFQ.

co9olguy commented 4 years ago

Sorry about that, there were some breaking changes needed to the SF api in order to make it easier to access remote quantum hardware. At the same time, we're updating SF to be compatible with tensorflow 2, so we've been holding off on updating this older code.

co9olguy commented 4 years ago

@trbromley @josh146 do you know what version is best for fraud_detection.py? Is it different from function_fitting.py and tetrominos_learning.py?

trbromley commented 4 years ago

@co9olguy I can confirm that the fraud detection scripts use version 0.11 whereas the other scripts use 0.10. This would be fixed with https://github.com/XanaduAI/quantum-neural-networks/pull/10.

Thanks a lot @LiuNingtao for looking at this!