Deepspeech: Save only the best checkpoint

Created on 24 Jul 2018  路  8Comments  路  Source: mozilla/DeepSpeech

Instead of using EarlyStop to avoid overfitting, I would like to save the model at the time it had the best (lowest) validation loss. In other words, I would like to keep track only for the best checkpoint (based on val/dev set).

I tried to use a wrapper for tf.train.Saver (this one: https://github.com/vonclites/checkmate), but couldn't make it works with DeepSpeech. Is there a easy way to do tha (maybe using the MonitoredTrainingSession as you are using)?

Most helpful comment

All 8 comments

I looked into this briefly but couldn't find a clean way to implement it with MonitoredTrainingSession (which is IMO a terrible API). I ended up just writing a hack that works, but isn't really code we can land. I'm attaching the patch.

save_best_val.patch.txt

Thanks @reuben , I had to change the name of the MonitoredTrainingSession to train_session for this to work. Now it is working perfectly fine.

@bernardohenz What's the status here, is the issue fixed, do you have a workaround ? Should we close this ?

@lissyx yes, the patch from @reuben worked just fine.

We should have a proper solution for this in-tree. This would be too much work with the current training setup, but would probably be very simple if we used TF Eager, for example. Reopening so we don't forget.

1988 added this feature. It checkpoints the best validating epoch and supports different ways to resume - see load command-line parameter.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

verloka picture verloka  路  23Comments

MuruganR96 picture MuruganR96  路  28Comments

MalikMahnoor picture MalikMahnoor  路  79Comments

yoann1995 picture yoann1995  路  49Comments

erksch picture erksch  路  38Comments