TensorFlow 如何在上次模型训练结果之上继续训练

在摸索了一段时间后,发现其实很简单。找到之前训练结果输出的checkpoint文件,是一个文本文件,里面记录这你最近输出的模型路径,如下所示

model_checkpoint_path: "/output/ckpt/model.ckpt-20610"
all_model_checkpoint_paths: "/output/ckpt/model.ckpt-20073"
all_model_checkpoint_paths: "/output/ckpt/model.ckpt-20357"
all_model_checkpoint_paths: "/output/ckpt/model.ckpt-20610"

说明你最近一次的模型为 "/output/ckpt/model.ckpt-20610" , 将你模型训练中的checkpoint_path 参数值修改为当前模型路径,然后重新执行模型训练,就会接着当前模型继续训练。

INFO:tensorflow:Recording summary at step 20610.
INFO:tensorflow:global step 20620: loss = 3.3006 (2.125 sec/step)
INFO:tensorflow:global step 20630: loss = 3.6536 (2.096 sec/step)
INFO:tensorflow:global step 20640: loss = 3.4894 (2.086 sec/step)
INFO:tensorflow:global step 20650: loss = 4.0706 (2.131 sec/step)
INFO:tensorflow:global step 20660: loss = 3.6693 (2.112 sec/step)
INFO:tensorflow:global step 20670: loss = 3.8816 (2.146 sec/step)
……

你可能感兴趣的:(TensorFlow)