Closed GeorgeBohw closed 2 years ago
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~
Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day!
建议提到paddleocr的repo,方便相关同学后续跟进。
Since you haven\'t replied for more than a year, we have closed this issue/pr. If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up. 由于您超过一年未回复,我们将关闭这个issue/pr。 若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。
os environment: ubuntu18.04 with gpu 10.0,cudnn 7 paddle2.0
operation: when convert paddle ocr_attention to ++,whcih occurs error as following:
error:
C++ Call Stacks (More useful to developers):
0 std::string paddle::platform::GetTraceBackString<std::string const&>(std::string const&, char const, int) 1 paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const, int) 2 long const paddle::framework::Tensor::data() const
3 paddle::operators::LookupTableV2CUDAKernel::Compute(paddle::framework::ExecutionContext const&) const
4 std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::LookupTableV2CUDAKernel, paddle::operators::LookupTableV2CUDAKernel, paddle::operators::LookupTableV2CUDAKernel >::operator()(char const , char const, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&)
5 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext) const
6 paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const
7 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&)
8 paddle::framework::Executor::RunPartialPreparedContext(paddle::framework::ExecutorPrepareContext, paddle::framework::Scope, long, long, bool, bool, bool)
9 paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext, paddle::framework::Scope, bool, bool, bool)
10 paddle::operators::WhileOp::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const
11 paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&)
12 paddle::framework::NaiveExecutor::Run()
13 paddle::AnalysisPredictor::ZeroCopyRun()
Python Call Stacks (More useful to users):
File "infer.py", line 182, in main() File "infer.py", line 176, in main inference(args) File "infer.py", line 60, in inference ids = infer(images, num_classes, use_cudnn=True if args.use_gpu else False) File "/home/george/my_ocr_recognition/models/PaddleCV/ocr_recognition/attention_model.py", line 291, in attention_infer pre_ids_emb = fluid.embedding( File "", line 2, in embedding File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl return wrapped_func(*args, kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/framework.py", line 232, in impl return func(*args, *kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/input.py", line 322, in embedding helper.append_op( File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op return self.main_program.current_block().append_op(args, kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2840, in append_op op = Operator( File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/framework.py", line 1931, in init for frame in traceback.extract_stack():
Error Message Summary:
InvalidArgumentError: Tensor holds the wrong type, it holds float, but desires to be int64_t. [Hint: Expected valid == true, but received valid:0 != true:1.] at (/home/george/paddle/paddle/fluid/framework/tensor_impl.h:33) [operator < lookup_table_v2 > error] Aborted (core dumped)
我该怎么修改,我改写了attention_model.py中的def attention_infer()里的pre_ids_emb = fluid.embedding相关参数,怎么搞都没有成功,def attention_infer函数如下:
def attention_infer(images, num_classes, use_cudnn=True):
infer.py的程序如下: def inference(args): """OCR inference""" if args.model == "crnn_ctc": infer = ctc_infer get_feeder_data = get_ctc_feeder_for_infer else: infer = attention_infer get_feeder_data = get_attention_feeder_for_infer eos = 1 sos = 0 num_classes = data_reader.num_classes() data_shape = data_reader.data_shape()
define network
谁可以告诉我,谢谢!