我试图在训练模型后从检查点加载权重,然后在训练结束前停止(仍然有很多步骤)。我似乎可以通过以下方式加载权重:
latest = tf.train.latest_checkpoint(checkpoint_dir)
model.load_weights(latest)
检查点目录有像[checpoint, ckpt-44]这样的文件。数据- 00000 - 00001,ckpt-44。印度,……]并通过运行负载权重,我得到一堆数组,似乎是权重作为输出,但也警告(只是警告的一部分):
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'v' for (root).model.layer_with_weights-86.kernel
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'v' for (root).model.layer_with_weights-86.bias
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'v' for (root).model.layer_with_weights-87.alpha
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'v' for (root).model.layer_with_weights-88.kernel
WARNING:tensorflow:Value in checkpoint could not be found in the restored object: (root).optimizer's state 'v' for (root).model.layer_with_weights-88.bias
运行之后,程序就结束了。没有别的东西运行。如果我尝试在此之后打印或显示图像,那么什么都不会发生(或者如果我尝试做我真正想做的事情)。有人知道发生了什么吗?谢谢,抱歉,如果类似,没有看到,如果我发现类似,将删除。
我尝试了一堆不同的方式来加载检查点,他们似乎没有工作,但这似乎加载它,但不让我在加载后做太多。我希望能够继续训练,或者做我想做的负重训练。
我能够在从检查点文件加载权重后做出预测,该文件为每个epoch都有检查点
latest = tf.train.latest_checkpoint('/content/training')
model1.load_weights(latest)
完整的代码可以参考这个要点。谢谢你,