XanaduAI / quantum-transfer-learning

A transfer learning approach applied to hybrid neural networks composed of classical and quantum elements.
Apache License 2.0
71 stars 37 forks source link

I got error when I execute "run_on_QPU.py" #14

Open masaya611 opened 2 years ago

masaya611 commented 2 years ago

Hello.

I try to execute "run_on_QPU.py" I got the error messages below.

Traceback (most recent call last): File "/home/watabe/quantum-transfer-learning/quantum_processors/run_on_QPU.py", line 62, in dev = qml.device("qiskit.ibmq", wires=n_qubits, backend="ibmqx4", ibmqx_token=token) File "/home/watabe/.tql/lib/python3.10/site-packages/pennylane/init.py", line 330, in device raise DeviceError("Device does not exist. Make sure the required plugin is installed.") pennylane._device.DeviceError: Device does not exist. Make sure the required plugin is installed.

I only change the token in this code. Are there what I need to do?

CatalinaAlbornoz commented 2 years ago

Hi @masaya611!

You will need the pennylane-qiskit plugin. You can install it by using python -m pip install pennylane-qiskit . You can learn more about the plugin in its documentation.

Please let us know if this solves your problem!

OnePl3 commented 1 year ago

After installing pennylane-qiskit, there is no ibmqx4 device.

dev = qml.device("qiskit.ibmq", wires=n_qubits, backend="ibmq_qasm_simulator", ibmqx_token=token, shots=1024)
print("Device capabilities: ", dev.capabilities()["backend"])

Device capabilities: ['ibmq_qasm_simulator', 'ibmq_lima', 'ibmq_belem', 'ibmq_quito', 'simulator_statevector', 'simulator_mps', 'simulator_extended_stabilizer', 'simulator_stabilizer', 'ibmq_manila', 'ibm_nairobi', 'ibm_oslo']

OnePl3 commented 1 year ago

Can you guys give me a new one, using the QPU example? This version is too old, and the IBM piece of equipment seems to be gone. Thank you very much!

CatalinaAlbornoz commented 1 year ago

Hi @OnePl3 , yes, as you noticed IBM no longer has the ibmqx4 device. However you can use ibmq_lima if you prefer. You just need to change the run_on_QPU.py file which is in folder quantum_processors. You can change the "ibmqx4" in line 62 to "ibmq_lima". It is possible that other parts of the code are still outdated but at least this is an updated device that you can use.