Open TheRisenPhoenix opened 5 months ago
Hi @TheRisenPhoenix Thanks for the report on this. The object in question is generally tied to specific local instances of GPUs on the system you are running, so we do not have serialisation rules in place for it. However, we can take a look at what seems sensible here and update you when we have a resolution.
I appreciate your efforts in looking into this matter and keeping me informed! Looking forward to hearing back :)
Issue description
I use a pennylane circuit inside a torch model, which needs to be (deep)copied. If I use the default.qubit device, everything works fine, but when I switch to a lightning device (
lightning.qubit
/lightning.gpu
), an exception is thrown. I provide a minimal example to reproduce below.Expected behavior: (What you expect to happen) I hope to be able to copy (pickle) models regardless of the device they're running on. If not, then
default.qubit
andlightning.qubit
should at least show the same behavior (or maybe fail with an explanation, if it is indeed intended to not clone models)Actual behavior: (What actually happens) I get an error message, stating "
TypeError: cannot pickle 'pennylane_lightning.lightning_gpu_ops.DevPool' object
" (or respectively the same forpennylane_lightning.lightning_qubit_ops.StateVectorC128
)Reproduces how often: (What percentage of the time does it reproduce?) Every time, on different machines
System information: (post the output of
import pennylane as qml; qml.about()
)Platform info: Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35 Python version: 3.11.7 Numpy version: 1.26.4 Scipy version: 1.12.0 Installed devices:
Source code and tracebacks
I've prepared this example which I hope helps to reproduce the issue:
This is the stacktrace: