Writing predictions for training and validation dataloaders on fit end #13018
Replies: 2 comments 15 replies
-
there is no built-in component for it and baseprediction writer callback is the best one you can configure and use. |
Beta Was this translation helpful? Give feedback.
-
Sure. As far as I understand, the default loops called when running # FitLoop
for epoch in range(max_epochs):
# TrainingEpochLoop
for batch_idx, batch in enumerate(train_dataloader):
# TrainingBatchLoop
for split_batch in tbptt_split(batch):
# OptimizerLoop
for optimizer_idx, opt in enumerate(optimizers):
loss = lightning_module.training_step(batch, batch_idx, optimizer_idx) But in order to write predictions for the training data using something similar to the def training_step(self, batch, batch_idx):
# Compute predictions and loss
return loss, predictions So I would have thought I would need override this loop in order to handle the fact that the # FitLoop
for epoch in range(max_epochs):
# TrainingEpochLoop
for batch_idx, batch in enumerate(train_dataloader):
# TrainingBatchLoop
for split_batch in tbptt_split(batch):
# OptimizerLoop
for optimizer_idx, opt in enumerate(optimizers):
loss = lightning_module.training_step(batch, batch_idx, optimizer_idx)[0] # Grab the first index of the returned values Does that make sense? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a simple way to take advantage of current Lightning features to write predictions on the entire training and validation sets to separate files on
fit
end? Been trying to take advantage of some combination of theon_fit_end
andBasePredictionWriter
(which I am already using for writing usingpredict
functionality). Worst case I will just write a separate script but wanted to see if there was something built in I could take advantage of.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions