baidu / lac

百度NLP:分词,词性标注,命名实体识别,词重要性
Apache License 2.0
3.89k stars 596 forks source link

Alloc Error #107

Open LeiChen9 opened 4 years ago

LeiChen9 commented 4 years ago

Traceback (most recent call last): File "main.py", line 34, in text = lac.run(texts) File "/home/riceball/anaconda3/envs/tf2/lib/python3.7/site-packages/LAC/lac.py", line 105, in run crf_decode = self.predictor.run([tensor_words]) 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::memory::detail::AlignedMalloc(unsigned long) 2 paddle::memory::detail::CPUAllocator::Alloc(unsigned long, unsigned long) 3 paddle::memory::detail::BuddyAllocator::SystemAlloc(unsigned long) 4 paddle::memory::detail::BuddyAllocator::Alloc(unsigned long) 5 void paddle::memory::legacy::Alloc(paddle::platform::CPUPlace const&, unsigned long) 6 paddle::memory::allocation::NaiveBestFitAllocator::AllocateImpl(unsigned long) 7 paddle::memory::allocation::AllocatorFacade::Alloc(paddle::platform::Place const&, unsigned long) 8 paddle::memory::allocation::AllocatorFacade::AllocShared(paddle::platform::Place const&, unsigned long) 9 paddle::memory::AllocShared(paddle::platform::Place const&, unsigned long) 10 paddle::framework::Tensor::mutable_data(paddle::platform::Place const&, paddle::framework::proto::VarType_Type, unsigned long) 11 paddle::operators::LookupTableKernel::Compute(paddle::framework::ExecutionContext const&) const 12 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::LookupTableKernel, paddle::operators::LookupTableKernel, paddle::operators::LookupTableKernel >::operator()(char const, char const, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) 13 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext) const 14 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const 15 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) 16 paddle::framework::NaiveExecutor::Run() 17 paddle::AnalysisPredictor::Run(std::vector<paddle::PaddleTensor, std::allocator > const&, std::vector<paddle::PaddleTensor, std::allocator >*, int)


Python Call Stacks (More useful to users):

File "/home/work/huangdingbang/anaconda3/lib/python3.7/site-packages/paddle/fluid/framework.py", line 2459, in append_op attrs=kwargs.get("attrs", None)) File "/home/work/huangdingbang/anaconda3/lib/python3.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/huangdingbang/anaconda3/lib/python3.7/site-packages/paddle/fluid/layers/nn.py", line 638, in embedding 'padding_idx': padding_idx File "../models/sequence_labeling/nets.py", line 97, in _net_conf low=-init_bound, high=init_bound))) File "../models/sequence_labeling/nets.py", line 136, in lex_net return _net_conf(word) File "/home/work/huangdingbang/models1.5/models/PaddleNLP/lexical_analysis/creator.py", line 41, in create_model crf_decode = nets.lex_net(words, args, vocab_size, num_labels, for_infer=True, target=None) File "inference_model.py", line 29, in save_inference_model args, dataset.vocab_size, dataset.num_labels, mode='infer') File "inference_model.py", line 105, in save_inference_model(args)


Error Message Summary:

Error: Alloc 26685710336 error! [Hint: Expected posix_memalign(&p, alignment, size) == 0, but received posix_memalign(&p, alignment, size):12 != 0:0.] at (/paddle/paddle/fluid/memory/detail/system_allocator.cc:59) [operator < lookup_table > error]

请问是因为机器内存不够吗?没看懂这个报错信息

Bond-H commented 4 years ago

应该是texts的size太大了,一般批处理时size设为200以内,再大性能不会有提升,且内存消耗增加

LeiChen9 commented 4 years ago

请问LAC支持GPU计算么?直接to(device)可以么

Bond-H commented 4 years ago

支持GPU,使用可参考https://github.com/baidu/lac/issues/55#issuecomment-635138819_