[英]How to save the structure and weights of trained tensorflow model?
[英]How to save tensorflow model with best weights
我正在訓練一個 LSTM,並且對於 300 個 epoch 訓練序列期間的部分 epoch(范圍不一致),它在很長一段時間內表現出非常好的准確性。 我希望此時能夠保存整個 model,但除了使用檢查點然后恢復並保存新的 model 之外,似乎找不到其他方法。
有沒有辦法我可以使用 model.save 僅在 model 具有最佳權重時捕獲它?
使用save _best_only
參數:
model_checkpoint_callback = tf.keras.callbacks.ModelCheckpoint(
filepath=checkpoint_filepath,
save_weights_only=True,
monitor='val_accuracy',
mode='max',
save_best_only=True)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.