tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This

背景:

今天使用bert finetuning的方式进行文本多分类任务时候,遇到一个报错,记录一下

tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint.

操作过程

采用数据1,其中为20分类的数据, 训练模型的过程中,

数据为 label (\t)text 格式

label为0,1,2,3,。。。20的格式

处理过程中label为string类型,csv中自带了"字符,导致有的label为2,有的为 "2 导致label个数变多

 

修改完后,采用数据2,三分类数据训练过程就报错

最后发现output的checkpoint中有数据的问题,导致出现了shape不一致的情况,上次运行20分类任务的时候生成的模型和现在生成的三分类模型的shape不一致,所以这里需要在运行前先清空之情的output。

        --output_dir=/tmp/mrpc_output/

rm -rf /tmp/mrpc_output/

或者手动删除改文件夹

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值