multiple validation steps #11456
Unanswered
yuvalsCG
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment
-
hey @yuvalsCG ! one way you can achieve this: def validation_step1(...):
...
def validation_step2(...):
...
def validation_step(self, batch, batch_idx, dataloader_idx):
if dataloader_idx == 0:
self.validation_step1(batch, batch_idx)
elif dataloader_idx == 1:
if (self.current_epoch + 1) % 20 != 0:
return
self.validation_step2(batch, batch_idx: this will simplify the use-case of different validation_step hooks, but for the second dataloader, it might add a time overhead by retrieving the batch from the dataloader2 for some of the epochs where they aren't even used. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I have a rather challenging use case.
We are training 3d parametric models of objects. It is very beneficial for us to render the objects models during training to evaluate the models quality.
Rendering is time-expensive action. We also like to get many relevant images from the
dataloader
to render the models on top of them.It would be convenient for us if there would be another loop, in addition to
training_loop
andvalidation_loop
, let's call itvisualization_loop
, in which we can do visualizations.The requirement from this visualization phase are:
check_every_n_epoch
)Seemingly, we would want to be able to create multiple
validation_loop
s which are separated by their functionality, their dataloaders and their rate of occurrence.I imagine something like this:
I was not able to find a solution to my problem in the current abstraction. I would be happy to hear proposed solutions and thoughts.
Beta Was this translation helpful? Give feedback.
All reactions