Saving training metrics to a python variable

When you train a vision learner it prints train_loss/valid_loss etc. How do I get this into a python variable so that I can log this into wandb etc.

apparently there is an integration with wandb: fastai - Wandb.

Just need to figure out how to use it. Please delete this question if it is not particularly useful.

Hi! Did you actually manage to get the train_loss to a variable?

I found that loss_history = [float(x) for x in model.recorder.losses] gives me the valid_loss, but is there a way to get the train_loss?


learn.recorder.values should provide that:
Screenshot from 2023-01-13 12-37-24


Haha damn, it was right there and I didn’t see it. Thanks a lot!

1 Like