graviraja / MLOps-Basics

MIT License
6.08k stars 1.02k forks source link

Metric not matched between in `early_stopping_callbacks` (Week 1) #21

Closed wonyoungseo closed 3 years ago

wonyoungseo commented 3 years ago

Hi @graviraja ,

I found out that train.py in Week 1 throws RuntimeError while runnning.

RuntimeError: Early stopping conditioned on metric `val_loss` which is not available. 
Pass in or modify your `EarlyStopping` callback to use any of the following: 
`valid/loss_epoch`, `valid/acc`, `valid/precision_macro`, `valid/recall_macro`, 
`valid/precision_micro`, `valid/recall_micro`, `valid/f1`, `valid/loss`, `train/loss_step`, 
`train/acc_step`, `train/loss_epoch`, `train/acc_epoch`, `train/loss`, `train/acc`

"val_loss" on line 52 seems to be the reason since it does not match. https://github.com/graviraja/MLOps-Basics/blob/ade8cb075a3705318f57a97c0d6fbf66da87c634/week_1_wandb_logging/train.py#L52 I believe this should be changed to "valid/loss" ?

Thanks for the amazing resource.

graviraja commented 3 years ago

Hi @lucaseo thanks for pointing it out. Fixed it.