BBuf / onnx2X

ONNX2Pytorch
159 stars 24 forks source link

NotImplementedError: Extraction of attribute count_include_pad not implemented. #1

Open cww97 opened 3 years ago

cww97 commented 3 years ago

我从paddle这里转了个resnet_vd到onnx

https://github.com/PaddlePaddle/PaddleClas/blob/release%2F2.1/ppcls/modeling/architectures/resnet_vd.py

尝试转到时候发现了这么个问题

...
2021-06-09 15:20:33.937297848 [W:onnxruntime:, graph.cc:1074 Graph] Initializer 1240 appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2021-06-09 15:20:33.937314832 [W:onnxruntime:, graph.cc:1074 Graph] Initializer 1242 appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
Traceback (most recent call last):
  File "onnx2pytorch.py", line 94, in <module>
    convert_onnx_pytorch(model_slim, pytorch_model, output, input)
  File "onnx2pytorch.py", line 15, in convert_onnx_pytorch
    model = convert.ConvertModel(onnx_model, debug=False)
  File "/root/paddle/onnx2X/onnx2pytorch/convert/model.py", line 60, in __init__
    for op_id, op_name, op in convert_operations(onnx_model, batch_dim):
  File "/root/paddle/onnx2X/onnx2pytorch/convert/operations.py", line 52, in convert_operations
    op = convert_layer(node, "AvgPool")
  File "/root/paddle/onnx2X/onnx2pytorch/convert/layer.py", line 37, in convert_layer
    kwargs = extract_attributes(node)
  File "/root/paddle/onnx2X/onnx2pytorch/convert/attribute.py", line 145, in extract_attributes
    raise NotImplementedError(
NotImplementedError: Extraction of attribute count_include_pad not implemented.

新算子还未支持?

BBuf commented 3 years ago

尝试转到什么?pytorch?

cww97 commented 3 years ago

是的

犯罪现场 https://github.com/cww97/paddle2torch

python onnx2pytorch.py \
    --onnx_path ../models/resnet50_vd.onnx \
    --simplify_path ../models/resnet50_vd_sim.onnx \
    --pytorch_path ../models/resnet50_vd.pth \
    --input_shape input:1,3,224,224

原来的结构文件 https://github.com/PaddlePaddle/PaddleClas/blob/release%2F2.1/ppcls/modeling/architectures/resnet_vd.py

原来的模型 https://github.com/PaddlePaddle/PaddleClas/blob/release/2.1/docs/zh_CN/application/transfer_learning.md

(都是主人的任务罢了~