How to print Validation loss and Metrics within an epoch?

Hi fastai experts,

Yes, I have an epoch that takes several hours, and would like to see the validation scores more frequently.

Easy, hard, existing callback?

Thank you.

I also have this problem :slight_smile:

I have written a callback to do this, called CycleHandler. You can find it in my project here.

CycleHandler ‘fakes’ an epoch every n batches for the callbacks within it. So you can report loss, validation loss, or any other metric you like. Because it is operating in it’s own space, you have to also provide a mechanism to get the metrics out (it does not automatically forward them to the Recorder).

CycleHandler is part of my larger repo, but it doesn’t have any dependencies; you should be able to cut and paste if you want to use it.

Thank you! I will try it.

I am also trying to do exactly this. It should probably be made into a native functionality in fastai2.
In the mean time, I have tried to plug Denise’s CycleHandler into fastai2, unsuccessfully. Is there an existing solution for fastai2?
I have also tried to use ShortEpochCallback native to fastai2 but it does not work as expected…