添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

源代码如下:
(这是代码内调用模型设置的路径,大家根据自己代码的情况做出相应的修改)

# 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'
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file /home/wpq/data/model.ckpt.data-00000-of-00001:
Data loss: not an sstable (bad magic number): perhaps your file is ...
				
预训练过程中主要修改了两个文件,一个是create_pretraining_data和run_pretrain. 前者运行需要读取一个txt文件,记得改成utf-8。在前者代码里面,将读进来的txt转化成了tfrecod形式,存进了example.tfrecord,在后者的程序里会调用它,来预训练。 两个代码程序都需要保证读取成功,如果路径没问题,仍然报错, 可以去路径下看example.tfrecord有没有正确生成。
tensorflow.python.framework.errors_impl.DataLossError: corrupted record at XXXX DataLossError (see above for traceback): corrupted record at XXXXXXX 错误的可能原因: tf record文件损坏,可以重新下载或者生成record文件;
出现这个错误的原因大概率是你在打开文件后,往文件中写东西,写了之后没有关闭文件,就对文件进行读操作了。 举个例子: writer = tf.io.TFRecordWriter("predict.tfrecords") 现在我打开了这样一个文件,往里面写入了我想写的内容,内容写完后正确的做法是 writer.close() 接下来在对这个文件做一些另外的操作。但是由于粗心,忘记写关闭文件的操作了,并对文件进行读操作,这个时候就报错了。 DataLossError
如保存操作为saver.save(sess, “train_model”) 那么会产生四个文件,这是python3的saver.restore()格式,分别为: 1.checkpoint 2.train_model-100.index 3.train_model-100.meta 4.train_model-100.data-00000-of-00001 那么导入时,saver.restore(...
Unable to open table file ..\data\model_ckpt: Unknown: NewRandomAccessFile failed to Create/Open: 这里是因为加载模型,但是目录文件夹下并不存在保存的模型, 下载指定额模型放到data目录下,并修改checkpoint的目录为..\data\model.chpt 下载模型解压如下 : $ l...
NVIDIA驱动出错:NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver. Make sure t 78415 ubuntu 解决apt报错 E: Some index files failed to download. They have been ignored, or old ones used inst m0_64076371: 你自己不给设置好权限啊 安装VMware后主机无法联网(远程计算机或设备将不接受连接) 2401_87912978: c++ jsoncpp库读写json vhjnn: 请问你一下博主,我看其他的文章里面用的json/json.h是在python环境下运行出来,但是我看您的是直接下载里面自带的,请问您是不是进行了置换 安装opencv时,xfeatures2d模块缺失boostdesc_bgm.i文件,下载超时问题 对酒当歌长亭晚802: balser相机IP设置 运气藏锋: 感谢大佬分享,搞不清相机IP地址卡了一天,在IP Configurator.exe找到了