Hello! I am facing the following error while using the qml.load(), below is an example code that I have used form here https://discuss.pennylane.ai/t/how-to-train-a-circuit-imported-from-qiskit/1832/2
# Put code here
import pennylane as qml
from pennylane import numpy as np
from qiskit.circuit import QuantumCircuit, Parameter
qc = QuantumCircuit(2)
theta = Parameter('θ')
state = [1/2,1/2,1/2,1/2]
qc.initialize(state, qc.qubits)
qc.rx(theta, [0])
qc.cx(0, 1)
my_circuit = qml.load(qc, format='qiskit')
#dev = qml.device('default.qubit', wires=2)
dev = qml.device(
"qiskit.aer",
wires=2,
shots=1000,
noise_model=noise_model,
backend="aer_simulator_statevector",
seed_simulator=1,
seed_transpiler=1,
)
@qml.qnode(dev)
def circuit(x):
my_circuit(params={theta: x},wires=(1, 0))
return qml.expval(qml.PauliZ(0))
theta_train = np.array(0.4, requires_grad=True)
opt = qml.GradientDescentOptimizer()
for i in range(100):
theta_train = opt.step(circuit, theta_train)
if i % 10 == 0:
print('Cost', circuit(theta_train))
This is the error that I am getting. Please help me.
# Put full error message here
Traceback (most recent call last):
Cell In[2], line 14
my_circuit = qml.load(qc, format='qiskit')
File /opt/conda/lib/python3.10/site-packages/pennylane/io.py:74 in load
raise ValueError(
ValueError: Converter does not exist. Make sure the required plugin is installed and supports conversion.
Use %tb to get the full traceback.
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about()
.
Name: PennyLane
Version: 0.34.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/PennyLaneAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /opt/conda/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: PennyLane-Lightning
Platform info: Linux-5.4.0-156-generic-x86_64-with-glibc2.35
Python version: 3.10.8
Numpy version: 1.23.5
Scipy version: 1.9.3
Installed devices:
- default.gaussian (PennyLane-0.34.0)
- default.mixed (PennyLane-0.34.0)
- default.qubit (PennyLane-0.34.0)
- default.qubit.autograd (PennyLane-0.34.0)
- default.qubit.jax (PennyLane-0.34.0)
- default.qubit.legacy (PennyLane-0.34.0)
- default.qubit.tf (PennyLane-0.34.0)
- default.qubit.torch (PennyLane-0.34.0)
- default.qutrit (PennyLane-0.34.0)
- null.qubit (PennyLane-0.34.0)
- lightning.qubit (PennyLane-Lightning-0.34.0)