Closed woocoder closed 5 years ago
在样例数据运行通过的情况下 将corpus.train按照格式替换为自定义数据集train.txt 结果报错
Traceback (most recent call last): File "sentiment_classify.py", line 286, in <module> main(args) File "sentiment_classify.py", line 259, in main args.num_passes) File "sentiment_classify.py", line 151, in train_net fetch_list=[cost.name, acc.name]) File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 470, in run self.executor.run(program.desc, scope, 0, True, True) paddle.fluid.core.EnforceNotMet: Enforce failed. Expected lbl >= 0, but received lbl:-1 < 0:0. at [/paddle/paddle/fluid/operators/math/cross_entropy.cc:51] PaddlePaddle Call Stacks: 0 0x7f60d6b71796p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 486 1 0x7f60d761e05cp paddle::operators::math::CrossEntropyFunctor<paddle::platform::CPUDeviceContext, float>::operator()(paddle::platform::CPUDeviceContext const&, paddle::framework::Tensor*, paddle::framework::Tensor const*, paddle::framework::Tensor const*, bool, int) + 7260 2 0x7f60d7522f58p paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const + 472 3 0x7f60d75230c3p std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, double> >::operator()(char const*, char const*) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) + 35 4 0x7f60d76ee20cp paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) const + 492 5 0x7f60d76ea63fp paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) + 255 6 0x7f60d6c3240ap paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 298 7 0x7f60d6c32e00p paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 128 8 0x7f60d6b5934dp 9 0x7f60d6ba3e14p pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 2596 10 0x4c37edp PyEval_EvalFrameEx + 31165 11 0x4b9ab6p PyEval_EvalCodeEx + 774 12 0x4c16e7p PyEval_EvalFrameEx + 22711 13 0x4b9ab6p PyEval_EvalCodeEx + 774 14 0x4c16e7p PyEval_EvalFrameEx + 22711 15 0x4c136fp PyEval_EvalFrameEx + 21823 16 0x4b9ab6p PyEval_EvalCodeEx + 774 17 0x4eb30fp 18 0x4e5422p PyRun_FileExFlags + 130 19 0x4e3cd6p PyRun_SimpleFileExFlags + 390 20 0x493ae2p Py_Main + 1554 21 0x7f60f7402830p __libc_start_main + 240 22 0x4933e9p _start + 41
明白了,应该是标签有负值
在样例数据运行通过的情况下 将corpus.train按照格式替换为自定义数据集train.txt 结果报错
Traceback (most recent call last): File "sentiment_classify.py", line 286, in <module> main(args) File "sentiment_classify.py", line 259, in main args.num_passes) File "sentiment_classify.py", line 151, in train_net fetch_list=[cost.name, acc.name]) File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 470, in run self.executor.run(program.desc, scope, 0, True, True) paddle.fluid.core.EnforceNotMet: Enforce failed. Expected lbl >= 0, but received lbl:-1 < 0:0. at [/paddle/paddle/fluid/operators/math/cross_entropy.cc:51] PaddlePaddle Call Stacks: 0 0x7f60d6b71796p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 486 1 0x7f60d761e05cp paddle::operators::math::CrossEntropyFunctor<paddle::platform::CPUDeviceContext, float>::operator()(paddle::platform::CPUDeviceContext const&, paddle::framework::Tensor*, paddle::framework::Tensor const*, paddle::framework::Tensor const*, bool, int) + 7260 2 0x7f60d7522f58p paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const + 472 3 0x7f60d75230c3p std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::CrossEntropyOpKernel<paddle::platform::CPUDeviceContext, double> >::operator()(char const*, char const*) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) + 35 4 0x7f60d76ee20cp paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) const + 492 5 0x7f60d76ea63fp paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_> const&) + 255 6 0x7f60d6c3240ap paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 298 7 0x7f60d6c32e00p paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 128 8 0x7f60d6b5934dp 9 0x7f60d6ba3e14p pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 2596 10 0x4c37edp PyEval_EvalFrameEx + 31165 11 0x4b9ab6p PyEval_EvalCodeEx + 774 12 0x4c16e7p PyEval_EvalFrameEx + 22711 13 0x4b9ab6p PyEval_EvalCodeEx + 774 14 0x4c16e7p PyEval_EvalFrameEx + 22711 15 0x4c136fp PyEval_EvalFrameEx + 21823 16 0x4b9ab6p PyEval_EvalCodeEx + 774 17 0x4eb30fp 18 0x4e5422p PyRun_FileExFlags + 130 19 0x4e3cd6p PyRun_SimpleFileExFlags + 390 20 0x493ae2p Py_Main + 1554 21 0x7f60f7402830p __libc_start_main + 240 22 0x4933e9p _start + 41