how test the best checkpoint without fit #10015
Unanswered
Achazwl
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
-
What should I do if I want to test the best checkpoint (using previous training checkpoint)? I would save the checkpoints in a quite complicated format, like
{epoch:02d}-{val_loss:.2f}.ckpt
. But when I run test, I don't want to specify the exact path of the checkpoint in my program, but let lightning tell me which checkpoint under the logging base_path is my best checkpoint.Similar to resume training, setting the logging base_path to the
resume_from_checkpoint
attribute of Trainer would give it the checkpoint information. However,resume_from_checkpoint
would matter only afterfit
#8796 , which is not called when only running test.I have tried getting the
trainer.checkpoint_callbacks[0].best_model_path
beforetrainer.test
and withoutfit
, but it is empty.I also tried getting the
trainer.checkpoint_callbacks[0].best_model_path
aftertrainer.fit
when resume training, it is not empty, and it is just the best checkpoint path I need.lightning version 1.4.6
Here's a code snippet:
Beta Was this translation helpful? Give feedback.
All reactions