报错解决:DataLossError: Unable to open table file Data loss: not an sstable (bad magic number):

tensorflow 下加载bert模型权重文件,报错

源代码如下:

# bert配置
config_path = './publish/bert_config.json'
checkpoint_path = './publish/model.ckpt'
dict_path = './publish/vocab.txt'

然后报错:

Could not open .\publish\model.ckpt: 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?
在这里插入图片描述

解决方案:
代码:

# bert配置
config_path = './publish/bert_config.json'
checkpoint_path =tf.train.latest_checkpoint('./publish/')
#checkpoint_path = './publish/model.ckpt'             
dict_path = './publish/vocab.txt'

猜你喜欢

转载自blog.csdn.net/sazass/article/details/110452977
今日推荐