Hello! I am encountering an error whenever I try to use lightning.gpu simulator instead of lightning.qubit simulator.
This is the version information:
Name: PennyLane
Version: 0.23.1
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.
Author: None
Author-email: None
License: Apache License 2.0
Location: /home/jay/.local/lib/python3.8/site-packages
Requires: semantic-version, networkx, pennylane-lightning, appdirs, scipy, numpy, toml, autoray, retworkx, autograd, cachetools
Required-by: PennyLane-Lightning, PennyLane-Lightning-GPU
Platform info: Linux-5.15.0-50-generic-x86_64-with-glibc2.29
Python version: 3.8.10
Numpy version: 1.22.3
Scipy version: 1.8.0
Installed devices:
- default.gaussian (PennyLane-0.23.1)
- default.mixed (PennyLane-0.23.1)
- default.qubit (PennyLane-0.23.1)
- default.qubit.autograd (PennyLane-0.23.1)
- default.qubit.jax (PennyLane-0.23.1)
- default.qubit.tf (PennyLane-0.23.1)
- default.qubit.torch (PennyLane-0.23.1)
- lightning.qubit (PennyLane-Lightning-0.23.0)
- lightning.gpu (PennyLane-Lightning-GPU-0.26.0)
[PhysicalDevice(name=‘/physical_device:GPU:0’, device_type=‘GPU’),
PhysicalDevice(name=‘/physical_device:GPU:1’, device_type=‘GPU’)]
This is the code:
n_qubits =10
dev = qml.device("lightning.gpu", wires=n_qubits)
tf.keras.backend.set_floatx('float64')
@qml.qnode(dev, diff_method="adjoint")
def qnode(inputs, weights):
QAOAEmbedding(features=inputs, weights=weights, local_field='Z', wires=range(n_qubits))
return [qml.expval(qml.PauliZ(wires=i)) for i in range(n_qubits)]
And this is the error:
TypeError Traceback (most recent call last)
Input In [12], in <cell line: 2>()
1 n_qubits =10
----> 2 dev = qml.device(“lightning.gpu”, wires=n_qubits)
3 tf.keras.backend.set_floatx(‘float64’)
4 @qml.qnode(dev, diff_method=“adjoint”)
5 def qnode(inputs, weights):
File ~/.local/lib/python3.8/site-packages/pennylane/init.py:306, in device(name, *args, **kwargs)
300 raise DeviceError(
301 f"The {name} plugin requires PennyLane versions {plugin_device_class.pennylane_requires}, "
302 f"however PennyLane version {version} is installed."
303 )
305 # Construct the device
→ 306 dev = plugin_device_class(*args, **options)
308 # Once the device is constructed, we set its custom expansion function if
309 # any custom decompositions were specified.
310 if custom_decomps is not None:
File ~/.local/lib/python3.8/site-packages/pennylane_lightning_gpu/lightning_gpu.py:128, in LightningGPU.init(self, wires, sync, c_dtype, shots, batch_obs)
127 def init(self, wires, *, sync=True, c_dtype=np.complex128, shots=None, batch_obs=False):
→ 128 super().init(wires, c_dtype=c_dtype, shots=shots)
129 self._gpu_state = _gpu_dtype(self._state.dtype)(self._state)
130 self._sync = sync
TypeError: init() got an unexpected keyword argument ‘c_dtype’
How can I fix this? Thank you