什么是 TensorFlow 检查点元文件?

What is the TensorFlow checkpoint meta file?

在保存检查点时,TensorFlow 通常会保存一个元文件:my_model.ckpt.meta。那个文件里有什么,即使我们删除了模型,我们还能恢复模型吗?如果我们在没有元文件的情况下恢复模型,我们会丢失什么样的信息?

此文件包含一个序列化 MetaGraphDef protocol buffer. The MetaGraphDef is designed as a serialization format that includes all of the information required to restore a training or inference process (including the GraphDef that describes the dataflow, and additional annotations that describe the variables, input pipelines, and other relevant information). For example, the MetaGraphDef is used by TensorFlow Serving 以根据您训练的模型启动推理服务。我们正在研究可以使用 MetaGraphDef 进行训练的其他工具。

假设你的模型还有Python代码,你不需要MetaGraphDef来恢复模型,因为你可以重建MetaGraphDef中的所有信息] 通过重新执行构建模型的 Python 代码。要从检查点恢复,您只需要包含训练权重的检查点文件,这些文件会定期写入同一目录。