Transfomer_IMDB_TRIM.py (12.7 KB)
Hello, I can’t get quantum transfer learning to run with a BERT based NLP model and Pennylane. I am not sure what I am doing wrong. It works when I use the pre-made code hosted on the Zapata github using the quantum_processors.pt weight file. However, when I try to recreate it with my own code it runs with no errors but never interfaces with quantum hardware, and there is no record of it running on the backend.
Hi @dancbeaulieu! Thank you for posting your question here.
Since your file has almost 400 lines of code it’s hard for us to find the problem. Could you try sending us a tiny version of this, which also has the problem?
I will try to reduce the length of the script.
This is about as minimal as I can get the code. It’s 219 lines, and I need help with the Pennylane quantum_net function on line 107, DressedQuantumNet on 130 or the actual model code on 208. I don’t get an error so I can’t tell why the model code isn’t running, it runs fine but just doesn’t interact with the quantum hardware on AWS Braket or IBM Q.Transfomer_IMDB_minimal2.py (6.9 KB)
Hi @dancbeaulieu, we looked at your code and it looks good. I would suggest you try this tutorial but instead of using the
default.qubit try using the
AwsDevice. This will help you see if the problem is with the credentials or with the code, and you can work from there.
Why don’t you try it and let us know how it goes?
In addition to @CatalinaAlbornoz’s useful suggestion it may be worth checking if the traceback errors are be being sent to your s3 bucket. Generally we’d expect failed jobs to be visible on the braket dashboard.
Please let us know if you have any more questions
This is the code I am using to initialize the “dev_remote” device I am using:
#Pennylane Hardware config
device_arn = “arn:aws:braket:::device/quantum-simulator/amazon/sv1”
dev_remote = qml.device(
I am not getting errors because it runs fine, it just doesn’t interact with the quantum hardware. There are no traceback errors since it fully works, it just seems to not run on quantum hardware, but it runs completely with no errors, just without interfacing with the quantum hardware. Its very confusing.
Yes @dancbeaulieu, it is a strange problem. There are several options:
- There is an actual error but it’s just not being printed so we don’t know what it is.
- The code is running on the hardware but there’s just no job id being generated and this leads us to think that it’s running somewhere else.
The thing with the first option is that if it’s not running on the hardware, where is it running? This is the only qml device being specified so I’m thinking it might be option 2.