This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Key error pads #554
Labels
bug
Unexpected behaviour that should be corrected (type)
Comments
Also the same issue here. It works okay on opset 9 or 10. Traceback (most recent call last):
File "convert.py", line 138, in <module>
start_conversion()
File "convert.py", line 133, in start_conversion
create_coreml(name)
File "convert.py", line 63, in create_coreml
minimum_ios_deployment_target='13'
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/converter.py", line 627, in convert
_convert_node_nd(builder, node, graph, err)
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/_operators_nd.py", line 2389, in _convert_node_nd
return converter_fn(builder, node, graph, err)
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/_operators_nd.py", line 1333, in _convert_pad
_convert_pad_5d(builder, node, graph, err)
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/_operators.py", line 1367, in _convert_pad
builder, node, graph, err)
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/_operators.py", line 217, in _add_conv_like_op
get_params_func(builder, node, graph, err, params_dict)
File "/usr/local/lib/python3.7/site-packages/onnx_coreml/_operators.py", line 1310, in _get_pad_params
pads = node.attrs['pads']
KeyError: 'pads' System environment:coremltools==3.3 |
Same issue. Did anyone handle it?
System environment:coremltools==3.3 |
@BorisKourt @Arxtage Looks like you are using opset version 11 |
As mentioned in my post above it does work in opset 9 and 10. I am wondering what the issue with 11 is? |
i had same issue. Does anyone have any ideas? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
🐞Bug Description
Hi using opset_version=11, I'm trying to convert Architecture with
Upscaling Layers and ReflectionPad2d from Pytorch to CoreML
Trace
1/214: Converting Node Type Sub
2/214: Converting Node Type ConstantOfShape
3/214: Converting Node Type Concat
4/214: Converting Node Type Reshape
5/214: Converting Node Type Slice
6/214: Converting Node Type Transpose
7/214: Converting Node Type Reshape
8/214: Converting Node Type Pad
KeyError Traceback (most recent call last)
in
82 coreml_model = convert(
83 onnx_model,
---> 84 minimum_ios_deployment_target='13'
85 )
86 coreml_model.save('my_model.mlmodel')
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml\converter.py in convert(model, mode, image_input_names, preprocessing_args, image_output_names, deprocessing_args, class_labels, predicted_feature_name, add_custom_layers, custom_conversion_functions, onnx_coreml_input_shape_map, minimum_ios_deployment_target)
624 print("%d/%d: Converting Node Type %s" %(i+1, len(graph.nodes), node.op_type))
625 if disable_coreml_rank5_mapping:
--> 626 _convert_node_nd(builder, node, graph, err)
627 else:
628 _add_const_inputs_if_required(builder, node, graph, err)
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml_operators_nd.py in _convert_node_nd(builder, node, graph, err)
2387 def _convert_node_nd(builder, node, graph, err): # type: (NeuralNetworkBuilder, Node, Graph, ErrorHandling) -> None
2388 converter_fn = _get_node_converter_fn(builder, node, err)
-> 2389 return converter_fn(builder, node, graph, err)
2390
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml_operators_nd.py in _convert_pad(builder, node, graph, err)
1331 )
1332 else:
-> 1333 _convert_pad_5d(builder, node, graph, err)
1334
1335 def _convert_matmul(builder, node, graph, err):
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml_operators.py in _convert_pad(builder, node, graph, err)
1365
1366 _add_conv_like_op(_add_pad, _get_pad_params, params_dict,
-> 1367 builder, node, graph, err)
1368
1369 # update map
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml_operators.py in _add_conv_like_op(add_func, get_params_func, params_dict, builder, node, graph, err)
215
216 else:
--> 217 get_params_func(builder, node, graph, err, params_dict)
218 add_func(node.inputs, node.outputs, params_dict=params_dict, builder=builder, node=node, graph=graph, err=err)
219
~\Anaconda3\envs\torch\lib\site-packages\onnx_coreml_operators.py in _get_pad_params(builder, node, graph, err, params_dict, axis)
1308 def _get_pad_params(builder, node, graph, err, params_dict, axis=None):
1309
-> 1310 pads = node.attrs['pads']
1311 if not (len(pads) % 2 == 0 and len(pads) >= 2):
1312 return err.unsupported_op_configuration(builder, node, graph,
KeyError: 'pads'
To Reproduce
`OnnxModel
System environment (please complete the following information):
coremltools==3.3
onnx-coreml==1.2
Python : 3.6
Framework : Pytorch == 1.4
The text was updated successfully, but these errors were encountered: