Getting predictions and gold labels from trainer.test()
#12841
Unanswered
ZhaofengWu
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.
-
Is there a way to obtain predictions and gold labels from
trainer.test()
? I have access to these intest_epoch_end()
, but since this function doesn't return, I can't pass them outside. Options that I've considered:self.log("preds", preds)
, but apparently torch tensors are automatically reduced.trainer.predict()
, but since I'm already doingtrainer.test()
, having to run the forward pass on the evaluation data twice seems wasteful.self._some_custom_property_{preds,labels}
intest_epoch_end()
, and access these properties outside. I'd go for this if there's no better alternative, but it sounds like a hack.Beta Was this translation helpful? Give feedback.
All reactions