Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

Tensor holds no memory

Open wojtuss opened this issue 8 years ago • 7 comments

When running inference script for the DeepASR model (PaddlePaddle/models/fluid/DeepASR/infer.py) I get the following error:

Traceback (most recent call last):
  File "../../infer.py", line 114, in <module>
    infer(args)
  File "../../infer.py", line 101, in infer
    return_numpy=False)
  File "/paddle/build/python/paddle/fluid/executor.py", line 336, in run
    self.executor.run(program.desc, scope, 0, True, True)
paddle.fluid.core.EnforceNotMet: holder_ should not be null
Tensor holds no memory. Call Tensor::mutable_data first. at [/paddle/paddle/fluid/framework/tensor_impl.h:66]

How can I fix this?

The PaddlePddle call stack:

0       0x7f5c1e95f76cp paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 572
1       0x7f5c1e9639dfp paddle::framework::Tensor::check_memory_size() const + 303
2       0x7f5c1f19e643p paddle::framework::LoDTensor::SplitLoDTensor(std::vector<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_>, std::allocator<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 + 67
3       0x7f5c1f003484p
4       0x7f5c1f00d0ffp paddle::operators::ParallelDoOp::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 + 511
5       0x7f5c1f17bd08p 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&) + 72
6       0x7f5c1ea0396ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool) + 382
7       0x7f5c1ea04d82p paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 114
8       0x7f5c1e97f313p void pybind11::cpp_function::initialize<pybind11::cpp_function::initialize<void, paddle::framework::Executor, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(void (paddle::framework::Executor::*)(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool)#1}, void, paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(pybind11::cpp_function::initialize<void, paddle::framework::Executor, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(void (paddle::framework::Executor::*)(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool)#1}&&, void (*)(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail::function_call) + 579
9       0x7f5c1e97bda4p pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 1236
10            0x4c37edp PyEval_EvalFrameEx + 31165
11            0x4b9ab6p PyEval_EvalCodeEx + 774
12            0x4c16e7p PyEval_EvalFrameEx + 22711
13            0x4b9ab6p PyEval_EvalCodeEx + 774
14            0x4c1e6fp PyEval_EvalFrameEx + 24639
15            0x4b9ab6p PyEval_EvalCodeEx + 774
16            0x4eb30fp
17            0x4e5422p PyRun_FileExFlags + 130
18            0x4e3cd6p PyRun_SimpleFileExFlags + 390
19            0x493ae2p Py_Main + 1554
20      0x7f5c41a5a830p __libc_start_main + 240
21            0x4933e9p _start + 41

wojtuss avatar May 08 '18 13:05 wojtuss

@wojtuss Maybe you need to upgrade paddlepaddle. Have you succeeded to run tools/profile.py?

kuke avatar May 09 '18 01:05 kuke

@kuke , I have upgraded to the newest PaddlePaddle. The problem remains.

I also haven't succeeded with tools/profile.py:

-----------  Configuration Arguments -----------
batch_size: 32
class_num: 1749
device: CPU
feature_lst: /dataset/wuss/repos/PaddlePaddle/models/fluid/DeepASR/examples/aishell/data/train_feature.lst
first_batches_to_skip: 1
frame_dim: 1320
hidden_dim: 1024
label_lst: /dataset/wuss/repos/PaddlePaddle/models/fluid/DeepASR/examples/aishell/data/train_label.lst
learning_rate: 0.00016
max_batch_num: 10
mean_var: /dataset/wuss/repos/PaddlePaddle/models/fluid/DeepASR/examples/aishell/data/aishell/global_mean_var
minimum_batch_size: 1
parallel: False
print_train_acc: True
proj_dim: 512
sorted_key: total
stacked_num: 5
------------------------------------------------
Traceback (most recent call last):
  File "tools/profile.py", line 201, in <module>
    profile(args)
  File "tools/profile.py", line 184, in profile
    return_numpy=False)
  File "/dataset/wuss/repos/PaddlePaddle/Paddle/build/python/paddle/fluid/executor.py", line 340, in run
    self.executor.run(program.desc, scope, 0, True, True)
paddle.fluid.core.EnforceNotMet: Filter's height should be context_length * input_hidden_size . at [/dataset/wuss/repos/PaddlePaddle/Paddle/paddle/fluid/operators/sequence_conv_op.cc:46]
PaddlePaddle Call Stacks: 
0       0x7faa2c6e50dcp paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 572
1       0x7faa2cdf0554p paddle::operators::SequenceConvOp::InferShape(paddle::framework::InferShapeContext*) const + 2020
2       0x7faa2cf042c8p 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 + 104
3       0x7faa2cf00e48p 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&) + 72
4       0x7faa2c78941ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool) + 382
5       0x7faa2c78a832p paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 114
6       0x7faa2c704c83p void pybind11::cpp_function::initialize<pybind11::cpp_function::initialize<void, paddle::framework::Executor, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(void (paddle::framework::Executor::*)(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool)#1}, void, paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(pybind11::cpp_function::initialize<void, paddle::framework::Executor, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, pybind11::name, pybind11::is_method, pybind11::sibling>(void (paddle::framework::Executor::*)(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool)#1}&&, void (*)(paddle::framework::Executor*, paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&)::{lambda(pybind11::detail::function_call&)#3}::_FUN(pybind11::detail::function_call) + 579
7       0x7faa2c701714p pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 1236
8             0x4cada2p PyEval_EvalFrameEx + 28066
9             0x4c2765p PyEval_EvalCodeEx + 597
10            0x4ca099p PyEval_EvalFrameEx + 24729
11            0x4c2765p PyEval_EvalCodeEx + 597
12            0x4ca8d1p PyEval_EvalFrameEx + 26833
13            0x4c2765p PyEval_EvalCodeEx + 597
14            0x4c2509p PyEval_EvalCode + 25
15            0x4f1defp
16            0x4ec652p PyRun_FileExFlags + 130
17            0x4eae31p PyRun_SimpleFileExFlags + 401
18            0x49e14ap Py_Main + 1674
19      0x7faa475bb830p __libc_start_main + 240
20            0x49d9d9p _start + 41

wojtuss avatar May 11 '18 15:05 wojtuss

@wojtuss The failure of profiling is due to the wrong data dimension. Please update the code in DeepASR, then run the profile.sh script under examples/aishell. And don't execute the infer.py directly, please try to run infer_by_ckpy.sh.

kuke avatar May 14 '18 04:05 kuke

@kuke , thanks! Now profile.sh works fine. For the infer_by_ckpy.sh script to work I need the target_trans.txt and words.txt (vocabulary) files. They are not present within the model dir. Do you know where I can find them?

wojtuss avatar May 14 '18 14:05 wojtuss

@wojtuss Now you should be able to run training. These two files are missing in the data source. I will upload them some day. Right now, you can comment out the decoding part in the infer_by_ckpt.py script to run it.

kuke avatar May 15 '18 03:05 kuke

@kuke , I have commented out the decoding part and finally managed to run the inference :-) Thanks!

wojtuss avatar May 15 '18 13:05 wojtuss

@wojtuss Great!

kuke avatar May 16 '18 07:05 kuke