Double Training Step to Swap Inputs #9245
Unanswered
pederismo
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone!
I would like to do something in my training step but I'm not really sure how to do it, or whether it is even possible to do it.
At each training step my batch contains two volumetric images, and they are used in two ways:
Now if my explanation was clear enough, you should understand that I'm basically halving my dataset: for every batch of two volumetric images I need one training step where I'm using volume_1 in algorithm_1 and volume_2 in algorithm_2, and another training step where I'm using volume_1 in algorithm_2 and volume_2 in algorithm_1.
But I get the batch WITHIN the training_step function already! I can't just simply do this swapping in here, because in the end I would always end up with a single loss, instead I want to have two distinct training steps.
Should I recursively call training_step(...) once more with the inverted batch? Or should I double the dataset and rearrange it (non scalable option)? Or is there a better way to do this?
Thanks everyone for reading up to here, any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions