You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lambeq provides a large number of models and trainers, covering a broad range of use cases, both quantum and "classical", where the latter models operate on tensor networks. Currently, the PytorchModel works exclusively on tensor networks, hence it is relevant only for "classical" experiments.
This task asks for the extension of PytorchModel so it could also work with quantum circuits, in the same way as e.g. the PennyLaneModel does. This will allow quantum models to be trained using gradient-based optimisers such as Adam. The following changes will need to be made.
In quantum ansatze, the lambeq symbols will need to be used instead of sympy symbols directly.
The initialise_weights method will need to know whether it is operating on a quantum circuit or tensor network, and the quantum circuit weights may be initialised uniformly at random, without the current logic used for tensors.
Some additional changes may be needed to the quantum backend to ensure that gradients are calculated appropriately by pytorch's autograd.
An example notebook demonstrating the new capability will need to be demonstrated. This can simply use the classical pipeline example notebook, and replace the ansatz with a quantum ansatz.
Notes
Adding the functionality in a new class QuantumPytorchModel, instead of extending the PytorchModel class, might be an acceptable alternative.
Include in the PR the results of a basic test run as a proof of concept, training one of the lambeq datasets with the new model.
Description
lambeq provides a large number of models and trainers, covering a broad range of use cases, both quantum and "classical", where the latter models operate on tensor networks. Currently, the PytorchModel works exclusively on tensor networks, hence it is relevant only for "classical" experiments.
This task asks for the extension of PytorchModel so it could also work with quantum circuits, in the same way as e.g. the
PennyLaneModel
does. This will allow quantum models to be trained using gradient-based optimisers such asAdam
. The following changes will need to be made.initialise_weights
method will need to know whether it is operating on a quantum circuit or tensor network, and the quantum circuit weights may be initialised uniformly at random, without the current logic used for tensors.Notes
QuantumPytorchModel
, instead of extending thePytorchModel
class, might be an acceptable alternative.References
PytorchModel
in lambeqThe text was updated successfully, but these errors were encountered: