码迷,mamicode.com
首页 > 其他好文 > 详细

PaddleDetection 导出PP-YOLO 类型模型时报错AssertionError: Bad argument number for Assign: 2, expecting 3 解决记录

时间:2021-07-01 16:23:33      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:static   gets   ssi   site   field   bad   item   sel   inf   

详细报错记录:

paddle_38) ziyueshijue@ziyueshijue-desktop:~/work/cppwork/padleDemo/model/PaddleDetection$ python tools/export_model.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams
/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/layers/utils.py:26: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  def convert_to_list(value, n, name, dtype=np.int):
/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/tensor/creation.py:143: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe. 
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  if data.dtype == np.object:
[06/30 17:06:25] ppdet.utils.checkpoint INFO: Finish loading model weights: /home/ziyueshijue/.cache/paddle/weights/ppyolo_r50vd_dcn_1x_coco.pdparams
[06/30 17:06:25] ppdet.engine INFO: Export inference config file to output_inference/ppyolo_r50vd_dcn_1x_coco/infer_cfg.yml
/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/layers/utils.py:77: DeprecationWarning: Using or importing the ABCs from collections instead of from collections.abc is deprecated since Python 3.3, and in 3.10 it will stop working
  return (isinstance(seq, collections.Sequence) and
Traceback (most recent call last):
  File "tools/export_model.py", line 105, in <module>
    main()
  File "tools/export_model.py", line 101, in main
    run(FLAGS, cfg)
  File "tools/export_model.py", line 69, in run
    trainer.export(FLAGS.output_dir)
  File "/home/ziyueshijue/work/cppwork/padleDemo/model/PaddleDetection/ppdet/engine/trainer.py", line 460, in export
    input_spec, static_model.forward.main_program,
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 534, in main_program
    concrete_program = self.concrete_program
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 454, in concrete_program
    return self.concrete_program_specify_input_spec(input_spec=None)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/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/ziyueshijue/miniconda3/envs/paddle_38/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/ziyueshijue/miniconda3/envs/paddle_38/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/ziyueshijue/miniconda3/envs/paddle_38/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-58>", line 2, in from_func_spec
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 39, in __impl__
    return func(*args, **kwargs)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 620, in from_func_spec
    static_func = convert_to_static(dygraph_function)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 141, in convert_to_static
    static_func = _FUNCTION_CACHE.convert_with_cache(function)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 78, in convert_with_cache
    static_func = self._convert(func)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 116, in _convert
    root_wrapper = self._dygraph_to_static.get_static_ast(root)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 61, in get_static_ast
    self.transfer_from_node_type(self.static_analysis_root)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 92, in transfer_from_node_type
    self._apply(transformer, node_wrapper, log_level=index + 1)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ast_transformer.py", line 65, in _apply
    transformer(node_wrapper).transform()
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ifelse_transformer.py", line 55, in transform
    self.visit(self.root)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/ast.py", line 447, in generic_visit
    value = self.visit(value)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/ast.py", line 447, in generic_visit
    value = self.visit(value)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/ast.py", line 371, in visit
    return visitor(node)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ifelse_transformer.py", line 62, in visit_If
    new_node = create_convert_ifelse_node(return_name_ids, node.test,
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/ifelse_transformer.py", line 540, in create_convert_ifelse_node
    _, cond_node = create_assign_node(return_name_ids, convert_ifelse_layer)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/utils.py", line 439, in create_assign_node
    assign_node = gast.Assign(targets=[targets], value=node)
  File "/home/ziyueshijue/miniconda3/envs/paddle_38/lib/python3.8/site-packages/gast/gast.py", line 17, in create_node
    assert nbparam in (0, len(Fields)), AssertionError: Bad argument number for Assign: 2, expecting 3

paddlepaddle 版本: 2.0.2

后经排查,是gast库版本高导致, 把gast 卸载,重新安装 0.3.3解决

pip uninstall gast

pip install gast==0.3.3

 

PaddleDetection 导出PP-YOLO 类型模型时报错AssertionError: Bad argument number for Assign: 2, expecting 3 解决记录

标签:static   gets   ssi   site   field   bad   item   sel   inf   

原文地址:https://www.cnblogs.com/GengMingYan/p/14955474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!