ERNIE命名实体识别,sequence_unpad出错,报错error: The shape of Input(Length) should be [batch_size]
Created by: lujinchao
环境配置
- paddle 1.8.2
- CUDA 9.0
- cuDNN 7.6
- python 2.7.15
- ernie 2.2.0
- linux centos 6
报错信息
Traceback (most recent call last): File "run_sequence_labeling.py", line 375, in main(args) File "run_sequence_labeling.py", line 114, in main ernie_config=ernie_config) File "/home/work/lujinchao/ERNIE-2.2.0/finetune/sequence_label.py", line 79, in create_model lod_labels = fluid.layers.sequence_unpad(labels, seq_lens) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/layers/sequence_lod.py", line 1057, in sequence_unpad outputs={'Out': out}) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/framework.py", line 2610, in append_op attrs=kwargs.get("attrs", None)) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1971, in init self.desc.infer_shape(self.block.desc) paddle.fluid.core_avx.EnforceNotMet:
C++ Call Stacks (More useful to developers): 0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&&&, char const*, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const*, int) 2 paddle::operators::SequenceUnpadOp::InferShape(paddle::framework::InferShapeContext*) const 3 paddle::framework::OpDesc::InferShape(paddle::framework::BlockDesc const&) const
Python Call Stacks (More useful to users): File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/framework.py", line 2610, in append_op attrs=kwargs.get("attrs", None)) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(*args, **kwargs) File "/home/work/lujinchao/python/lib/python2.7/site-packages/paddle/fluid/layers/sequence_lod.py", line 1057, in sequence_unpad outputs={'Out': out}) File "/home/work/lujinchao/ERNIE-2.2.0/finetune/sequence_label.py", line 79, in create_model lod_labels = fluid.layers.sequence_unpad(labels, seq_lens) File "run_sequence_labeling.py", line 114, in main ernie_config=ernie_config) File "run_sequence_labeling.py", line 375, in main(args)
Error Message Summary: InvalidArgumentError: The shape of Input(Length) should be [batch_size]. But received (2) [Hint: Expected len_dims.size() == 1, but received len_dims.size():2 != 1:1.] at (/paddle/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc:52) [operator < sequence_unpad > error]