什么是 TensorFlow 检查点元文件? [英] What is the TensorFlow checkpoint meta file?
问题描述
在保存检查点时,TensorFlow 通常会保存一个元文件:my_model.ckpt.meta
.那个文件里有什么,即使我们删除它,我们仍然可以恢复模型吗?如果我们恢复没有元文件的模型,我们会丢失什么样的信息?
When saving a checkpoint, TensorFlow often saves a meta file: my_model.ckpt.meta
. What is in that file, can we still restore a model even if we delete it and what kind of info did we lose if we restore a model without the meta file?
推荐答案
此文件包含一个序列化的 MetaGraphDef
协议缓冲区.MetaGraphDef
被设计为一种序列化格式,其中包括恢复训练或推理过程所需的所有信息(包括 GraphDef
描述数据流,以及描述变量、输入管道和其他相关信息的附加注释).例如,MetaGraphDef
被 TensorFlow Serving 用来启动基于你训练有素的模型.我们正在研究其他可以使用 MetaGraphDef
进行训练的工具.
This file contains a serialized 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 to start an inference service based on your trained model. We are investigating other tools that could use the MetaGraphDef
for training.
假设您仍然拥有模型的 Python 代码,则不需要 MetaGraphDef
来恢复模型,因为您可以重建 MetaGraphDef
通过重新执行构建模型的 Python 代码.要从检查点恢复,您只需要包含训练过的权重的检查点文件,这些文件会定期写入同一目录.
Assuming that you still have the Python code for your model, you do not need the MetaGraphDef
to restore the model, because you can reconstruct all of the information in the MetaGraphDef
by re-executing the Python code that builds the model. To restore from a checkpoint, you only need the checkpoint files that contain the trained weights, which are written periodically to the same directory.
这篇关于什么是 TensorFlow 检查点元文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!