Closed PeppeGoodhelp closed 7 months ago
Hi @PeppeGoodhelp, thank you for reporting this issue.
I have a couple of questions regarding your training setup.
IQPAnsatz
instance? My initial impression is you are reusing this classical pipeline which used SpiderAnsatz
but switched to IQPAnsatz
.It would be great if you could provide your full code here and a couple of sentences you use for your training task.
Thank you very much.
Hi @PeppeGoodhelp, thank you for reporting this issue.
I have a couple of questions regarding your training setup.
* What dataset are you using for your classification task? * How did you create your `IQPAnsatz` instance? My initial impression is you are reusing this [classical pipeline](https://cqcl.github.io/lambeq/examples/classical_pipeline.html) which used `SpiderAnsatz` but switched to `IQPAnsatz`.
It would be great if you could provide your full code here and a couple of sentences you use for your training task.
Thank you very much.
Hi and thanks for your answer. I am basically using a standard Cola (acceptability judgement) dataset. It is quite extensive so we are shrinking it a little bit.
Concerning the ansatz thats what I did:
`from lambeq import AtomicType, IQPAnsatz, remove_cups,CircuitAnsatz,MPSAnsatz, BaseAnsatz,SpiderAnsatz from discopy.tensor import Dim
ansatz = SpiderAnsatz({AtomicType.NOUN: Dim(2), AtomicType.SENTENCE: Dim(2),AtomicType.PREPOSITIONAL_PHRASE: Dim(2),AtomicType.CONJUNCTION: Dim(2)})
train_circuits = [ansatz(diagram) for diagram in train_diagrams]`
As you can see this is basically a standard classical pipeline. There is a further issue when I try the IQP for the quantum pipeline. I can't remove cups. I cant wrap my head around
Hi @PeppeGoodhelp,
If you can, can you provide a dataset containing 5 to 10 sample sentences that, if used with the code you provided, generate the same error message? Since the code you are using is unchanged from the docs, it's most likely that the dataset is causing the issue. Thanks!
This will be closed due to inactivity.
Hi,
I have an issue when I try to train a classical pipelien on a standard Sentiment Analysis (binary classifcation task). Basically, after the conversion of the training diagrams into IQP ansatz I set up the trainer:
from lambeq import PytorchModel all_circuits = train_circuits# + dev_circuits + test_circuits model = PytorchModel.from_diagrams(all_circuits) model.initialise_weights()
and then:
`from lambeq import PytorchTrainer
trainer = PytorchTrainer( model=model, loss_function=torch.nn.BCEWithLogitsLoss(), optimizer=torch.optim.AdamW, # type: ignore learning_rate=LEARNING_RATE, epochs=EPOCHS, evaluate_functions={"acc": accuracy}, evaluate_on_train=False, verbose='text', seed=SEED)`
Finally: `from lambeq import Dataset
train_dataset = Dataset( train_circuits, train_label, batch_size=BATCH_SIZE)
trainer.fit(train_dataset, log_interval=5)`
I get the following error:
TypeError: moveaxis() received an invalid combination of arguments - got (Tensor, range, list), but expected one of:
Attached, a screen of the error stated above.
Any idea about how to fix this?