BERT-BiLSTM-CRF-NER icon indicating copy to clipboard operation
BERT-BiLSTM-CRF-NER copied to clipboard

crf_only设置为false后

Open wzjie opened this issue 5 years ago • 5 comments

训练完成了,但是测试的时候报错

wzjie avatar Jul 15 '19 02:07 wzjie

InvalidArgumentError (see above for traceback): 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. Original error:

Assign requires shapes of both tensors to match. lhs shape= [769,4] rhs shape= [896,512]

wzjie avatar Jul 15 '19 07:07 wzjie

测试的时候,麻烦也使用false.不然肯定会报错的。

macanv avatar Jul 24 '19 13:07 macanv

测试的时候,麻烦也使用false.不然肯定会报错的。

我也遇到同样的问题,训练推理都是crf_only=false的时候就报这个错。。。 是哪里出问题了?

lambert-lan avatar Aug 15 '19 09:08 lambert-lan

@macanv 将crf_only设置为fasle后,修改lstm num_layer=2,训练报错,维数不匹配。 Bug?

Jason-kid avatar Sep 27 '19 01:09 Jason-kid

terminal_predict.py里面的create_model 传参有问题,lstm_size, cell, num_layers 训练时使用的是default值,跟函数里面默认的不一样,在create_model 函数加上(lstm_size=args.lstm_size, cell=args.cell, num_layers=args.num_layers) 就可以成功运行拉~

bitlalala avatar Apr 02 '21 11:04 bitlalala