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'