加载ernie预训练模型,报错Tensor's dims_ is out of bound
Created by: JoyeeL
使用脚本方法
export CUDA_VISIBLE_DEVICES=1 MODEL_PATH=./pretrained_model TASK_DATA_PATH=./data python -u ernie_encoder.py
--use_cuda true
--batch_size 16
--output_dir "./test_128"
--init_pretraining_params ${MODEL_PATH}/params
--data_set ${TASK_DATA_PATH}/head_split_embedding_token.tsv
--vocab_path config/vocab.txt
--max_seq_len 30
--ernie_config_path config/ernie_config.json &> log/${PADDLE_TRAINER_ID}.txt
报错信息:
File "/home/slurm/job/tmp/job-27032/python/lib/python2.7/site-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 numel() * SizeOfType(type()) <= memory_size(), but received numel() * SizeOfType(type()):9206784 > memory_size():1474560. Tensor's dims_ is out of bound. Call Tensor::mutable_data first to re-allocate memory. or maybe the required data-type mismatches the data already stored. at [/paddle/paddle/fluid/framework/tensor.cc:27] PaddlePaddle Call Stacks: 0 0x7f593fb07d06p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 486 1 0x7f594110e440p paddle::framework::Tensor::check_memory_size() const + 528 2 0x7f593fb11349p float* paddle::framework::Tensor::data<float>() + 25 3 0x7f5940f19f5bp paddle::operators::math::UnpaddingLoDTensorFunctor<paddle::platform::CUDADeviceContext, float>::operator()(paddle::platform::CUDADeviceContext const&, paddle::framework::LoDTensor const&, paddle::framework::LoDTensor*, int, int, bool, paddle::operators::math::PadLayout) + 555 4 0x7f594061d79fp paddle::operators::SequenceUnpadOpKernel<paddle::platform::CUDADeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const + 975 5 0x7f594061d943p std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::SequenceUnpadOpKernel<paddle::platform::CUDADeviceContext, float>, paddle::operators::SequenceUnpadOpKernel<paddle::platform::CUDADeviceContext, double>, paddle::operators::SequenceUnpadOpKernel<paddle::platform::CUDADeviceContext, int>, paddle::operators::SequenceUnpadOpKernel<paddle::platform::CUDADeviceContext, long> >::operator()(char const*, char const*) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) + 35 6 0x7f5941091bbcp 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 7 0x7f594108e3ffp 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&) + 463 8 0x7f593fbd59cbp paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 219