Closed nikhilkhatri closed 1 year ago
I would like to have a try at this. May I be assigned?
@ACE07-Sev Hi, thanks for your interest! The way this hackathon works is that you have to open a PR that will be approved and merged, then the issue/task will be assigned to you and closed. If more than one coders submit PRs for the same issue, the maintainers will chose the solution they'll consider the best, or even decide to split the bounty. Hope that helps.
Hello, has this issue been resolved or is it still open?
@Vishwa-docs Hi, this is still open, feel free to try.
Hi, what will a suitable environment to run this . Can I run the code on jupyter Notebook or I need some other installations for running the code. Please guide me.
Hi @akve17 , I'm not sure what code in specific you're trying to run. The installation page describes how to set up lambeq. Beyond this, I'd recommend taking a look at the linked Resources in the issue description, particularly the training part of the documentation.
Hi , I tried the installation but I am getting this error " Could not import Cython, which is required to build depccg extension modules. Please install cython and numpy prior to installing depccg." I have installed cython and numpy ,but still the error doesn't resolve. What could be the possible workaround for this?
@akve17 Why are you installing depccg? By default, lambeq is using Bobcat which is installed with the main package. Not sure if this is any helpful, but what you need to do is the following:
Work with notebooks is not required at any stage of the modifications, to answer your first question.
Hi @dimkart Thanks for replying. Is visual studio a correct platform to run and debug the code or do I need to use something else.
@neiljdo Please reply to this comment so we can assign you to the issue.
@dimkart replying for issue assignment. The associated PR is #101. Thank you for the heads up!
This is now considered complete, thanks to everyone for your work.
Task Description
lambeq's training pipeline, shows that QNLP model training does not occur on string diagrams themselves, but on the concrete quantum circuits or tensor-networks, which are created from the string diagrams using ansätze. Akin to classical ML training, the
Model
andTrainer
classes (and subclasses) use multiple hyperparameters to adjust the training procedure.We would like to treat the choice of ansatz as a training hyperparameter.
Since the choice of ansätze plays a significant role in training, it is something we would like to be able to adjust from
Model
automatically. Currently, a change in ansatz requires converting the diagrams to circuits / tensor-networks using the new anstaz, and instantiating a newModel
.Furthermore, the models have a checkpoint system that allows restoring the model from a previous training run. If we then wanted to use a different ansatz, it may not be possible since the model only stores the circuits, and not the original diagrams.
Completion of this task involves the following changes:
ansatz
attribute.Model
methods includefrom_diagrams
andget_diagram_output
.Bonus: instead of passing the ansatz as the parameter, rewrite the interface so that we can pass in the ansatz class and the arguments for initialising the ansatz.
Notes
discopy.quantum.Circuit
) for quantum models, and tensor-networks (discopy.tensor.Diagram
) for classical models. Code that is common to both cases usesdiscopy.tensor.Diagram
as the common superclass, since quantum circuits are implemented as a subclass of tensor diagrams. These should be rewritten to usediscopy.rigid.Diagram
.Resources