简体   繁体   English

Tensorflow 在已保存的 model 上训练

[英]Tensorflow train on a saved model

I am using tensorflow to train a RNN with more than 200k of data, the training process takes up to 2 hours for every epoch.我正在使用 tensorflow 训练具有超过 200k 数据的 RNN,每个 epoch 的训练过程最多需要 2 个小时。 I save the model for every epoch with custom callback and this function: model.save_weights()我使用自定义回调为每个时代保存 model 和这个 function: model.save_weights()

can I stop the training and resume it later from last epoch like this?我可以像这样停止训练并稍后从上一个时代恢复吗? Does it make a diffrence in the result?是否会对结果产生影响? model.load_wieghts(last_epoch_dir) model.fit() model.load_wieghts(last_epoch_dir) model.fit()

Yes, you can retrain from the last epoch but the problem is that you might loose your optimiser state but it's no problem because optimiser will go back to its original state or even better within a few epochs.是的,您可以从最后一个时期重新训练,但问题是您可能会失去优化器 state 但这没问题,因为优化器会将 go 恢复到原来的 Z9ED39E2EA9314586B6AZE985A6 甚至更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM