新的檢查點格式會生成三個文件:model.ckpt-1000.data-00000-of-00001
,model.ckpt-1000.meta
,model.ckpt-1000.index
。舊的檢查點格式僅生成兩個文件:model.ckpt-1000
和model.ckpt-1000.meta
。如何恢復沒有索引文件和元文件的張量流模型?
當我使用代碼saver.restore(sess, './model.ckpt-1000')
以新的檢查點格式寫入恢復模型時,它可以成功恢復模型。現在當前目錄有三個文件model.ckpt-1000.data-00000-of-00001
,model.ckpt-1000.meta
,model.ckpt-1000.index
。如果我刪除model.ckpt-1000.index
,則無法恢復模型。錯誤信息:DataLossError (see above for traceback): Unable to open table file ./model.ckpt-1000: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
。
但我注意到tensorflow pretrained model只有一個文件:*.ckpt
。當我使用tensorflow提供的預訓練模型時,它可以成功恢復。它不需要*.index
文件。
我的張量流版本是1.1.0。
它是如何保存模型?它使用舊的檢查點格式嗎?