PaddleHub序列标注 运行sh run_sequence_label.sh报错
Created by: mhlwsk
我在按照PaddleHub/demo/sequence-labeling/
下教程运行sh run_sequence_label.sh
时出现以下报错,请问可能是什么问题?
版本
- PaddlePaddle v1.6.1
- PaddleHub v1.4.0
- ERNIE模型 v1.1.0
Traceback (most recent call last):
File "sequence_label.py", line 93, in <module>
seq_label_task.finetune_and_eval()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 588, in finetune_and_eval
return self.finetune(do_eval=True)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 593, in finetune
self.init_if_necessary()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 175, in init_if_necessary
if not self.load_checkpoint():
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 571, in load_checkpoint
main_program=self.main_program)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 357, in main_program
self._build_env()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 207, in _build_env
self.env.outputs = self._build_net()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/sequence_task.py", line 70, in _build_net
self.feature, length=self.seq_len)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/layers/nn.py", line 5872, in sequence_unpad
outputs={'Out': out})
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/framework.py", line 2459, in append_op
attrs=kwargs.get("attrs", None))
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/framework.py", line 1842, in __init__
self.desc.infer_shape(self.block.desc)
paddle.fluid.core_avx.EnforceNotMet:
--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
0 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > paddle::platform::GetTraceBackString<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*, int)
1 paddle::operators::SequenceUnpadOp::InferShape(paddle::framework::InferShapeContext*) const
2 paddle::framework::OpDesc::InferShape(paddle::framework::BlockDesc const&) const
3 void pybind11::cpp_function::initialize<pybind11::cpp_function::cpp_function<void, paddle::framework::OpDesc, paddle::framework::BlockDesc const&, pybind11::name, pybind11::is_method, pybind11::sibling>(void (paddle::framework::OpDesc::*)(paddle::framework::BlockDesc const&) const, pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::'lambda'(paddle::framework::OpDesc const*, paddle::framework::BlockDesc const&), void, paddle::framework::OpDesc const*, paddle::framework::BlockDesc const&, pybind11::name, pybind11::is_method, pybind11::sibling>(void&&, paddle::framework::OpDesc (*)(paddle::framework::BlockDesc const&), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::'lambda'(pybind11::detail::function_call&)::operator()(pybind11::detail::function_call&) const
4 pybind11::cpp_function::dispatcher(_object*, _object*, _object*)
------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/framework.py", line 2459, in append_op
attrs=kwargs.get("attrs", None))
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddle/fluid/layers/nn.py", line 5872, in sequence_unpad
outputs={'Out': out})
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/sequence_task.py", line 70, in _build_net
self.feature, length=self.seq_len)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 207, in _build_env
self.env.outputs = self._build_net()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 357, in main_program
self._build_env()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 571, in load_checkpoint
main_program=self.main_program)
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 175, in init_if_necessary
if not self.load_checkpoint():
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 593, in finetune
self.init_if_necessary()
File "/Users/test/anaconda3/envs/nlp-lab2/lib/python3.5/site-packages/paddlehub/finetune/task/basic_task.py", line 588, in finetune_and_eval
return self.finetune(do_eval=True)
File "sequence_label.py", line 93, in <module>
seq_label_task.finetune_and_eval()
----------------------
Error Message Summary:
----------------------
PaddleCheckError: Expected len_dims.size() == 1, but received len_dims.size():2 != 1:1.
The shape of Input(Length) should be [batch_size]. at [/home/teamcity/work/ef54dc8a5b211854/paddle/fluid/operators/sequence_ops/sequence_unpad_op.cc:41]
[operator < sequence_unpad > error]