PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.31k stars 5.63k forks source link

int8模型预测报错 #34804

Closed youngstu closed 1 year ago

youngstu commented 3 years ago
Traceback (most recent call last):
  File "hand_detector.py", line 199, in <module>
    pred = h_detector.predict(image)
  File "hand_detector.py", line 51, in predict
    fetch_list=self.fetch_targets)
  File "/home/ar/shaoxiong/envs/anaconda3/envs/mobilehand/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1110, in run
    six.reraise(*sys.exc_info())
  File "/home/ar/shaoxiong/envs/anaconda3/envs/mobilehand/lib/python3.7/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/ar/shaoxiong/envs/anaconda3/envs/mobilehand/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1108, in run
    return_merged=return_merged)
  File "/home/ar/shaoxiong/envs/anaconda3/envs/mobilehand/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1239, in _run_impl
    use_program_cache=use_program_cache)
  File "/home/ar/shaoxiong/envs/anaconda3/envs/mobilehand/lib/python3.7/site-packages/paddle/fluid/executor.py", line 1329, in _run_program
    [fetch_var_name])
ValueError: In user code:

    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/bin/x2paddle", line 33, in <module>
      sys.exit(load_entry_point('x2paddle==1.2.3', 'console_scripts', 'x2paddle')())
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/convert.py", line 259, in main
      onnx2paddle(args.model, args.save_dir)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/convert.py", line 165, in onnx2paddle
      mapper.paddle_graph.gen_model(save_dir)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/core/program.py", line 274, in gen_model
      self.dygraph2static(save_dir, input_shapes, input_types)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/x2paddle-1.2.3-py3.8.egg/x2paddle/core/program.py", line 553, in dygraph2static
      paddle.jit.save(static_model,
    File "<decorator-gen-67>", line 2, in save

    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
      return wrapped_func(*args, **kwargs)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
      return func(*args, **kwargs)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 718, in save
      concrete_program = static_func.concrete_program_specify_input_spec(
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 487, in concrete_program_specify_input_spec
      concrete_program, _ = self.get_concrete_program(
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 402, in get_concrete_program
      concrete_program, partial_program_layer = self._program_cache[cache_key]
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 711, in __getitem__
      self._caches[item] = self._build_once(item)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 698, in _build_once
      concrete_program = ConcreteProgram.from_func_spec(
    File "<decorator-gen-65>", line 2, in from_func_spec

    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
      return wrapped_func(*args, **kwargs)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 40, in __impl__
      return func(*args, **kwargs)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 652, in from_func_spec
      outputs = static_func(*inputs)
    File "v2_3_1_yolov6_best.pd/x2paddle_code.py", line 222, in forward
      x2paddle_1034 = self.conv0(x2paddle_images)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 902, in __call__
      outputs = self.forward(*inputs, **kwargs)
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/nn/layer/conv.py", line 655, in forward
      out = F.conv._conv_nd(
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/nn/functional/conv.py", line 138, in _conv_nd
      helper.append_op(
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/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 "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2899, in append_op
      op = Operator(
    File "/home/ar/shaoxiong/envs/anaconda3/envs/py38_pytorch1.7/lib/python3.8/site-packages/paddle/fluid/framework.py", line 1977, in __init__
      for frame in traceback.extract_stack():

    InvalidArgumentError: input and filter data type should be consistent, but received input data type is float and filter type is int8_t
      [Hint: Expected input_data_type == filter_data_type, but received input_data_type:5 != filter_data_type:21.] (at /paddle/paddle/fluid/operators/conv_op.cc:185)
      [operator < conv2d > error]
paddle-bot-old[bot] commented 3 years ago

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

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 APIFAQGithub Issue and AI community to get the answer.Have a nice day!

youngstu commented 3 years ago

是不是动态离线量化方式paddle不支持呢