Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

KeyError: '498' W_shape = graph.shape_dict[W_name] #561

Open
fcqfcq opened this issue Apr 14, 2020 · 1 comment
Open

KeyError: '498' W_shape = graph.shape_dict[W_name] #561

fcqfcq opened this issue Apr 14, 2020 · 1 comment
Labels
awaiting response Please respond to this issue to provide further clarification (status) bug Unexpected behaviour that should be corrected (type)

Comments

@fcqfcq
Copy link

fcqfcq commented Apr 14, 2020

🐞Describe the bug

A clear and brief description of what the bug is.

Trace

If applicable, please paste the error trace.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-14-f3ca1d2728f9> in <module>
      1 
----> 2 cml = onnx_coreml.convert(model,minimum_ios_deployment_target='13')
      3 cml.save('stylegan2.mlmodel')
      4 

/usr/local/miniconda3/envs/dl/lib/python3.6/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)

/usr/local/miniconda3/envs/dl/lib/python3.6/site-packages/onnx_coreml/_operators_nd.py in _convert_node_nd(builder, node, graph, err)
   2385 def _convert_node_nd(builder, node, graph, err):  # type: (NeuralNetworkBuilder, Node, Graph, ErrorHandling) -> None
   2386     converter_fn = _get_node_converter_fn(builder, node, err)
-> 2387     return converter_fn(builder, node, graph, err)
   2388 

/usr/local/miniconda3/envs/dl/lib/python3.6/site-packages/onnx_coreml/_operators_nd.py in _convert_conv(builder, node, graph, err)
    487         # Expected CoreML Format: H x W x KC x OC
    488         W_name = node.inputs[1]
--> 489         W_shape = graph.shape_dict[W_name]
    490         W_rank  = len(W_shape)
    491 

KeyError: '498'    W_shape = graph.shape_dict[W_name]

To Reproduce

  • If a python script can reproduce the error, please paste the code snippet
from onnx_coreml import convert
cml = onnx_coreml.convert(model,minimum_ios_deployment_target='13')

# Paste code snippet here
  • If applicable, please attach ONNX model
  • If model conversion succeeds, however, there is numerical mismatch between the original and the coreml model, please paste python script used for comparison (pytorch code, onnx runtime code etc.) pytorch->onnx

System environment (please complete the following information):

  • coremltools version (e.g., 3.0b5):3.3.0
  • onnx-coreml version (e.g. 1.0b2):1.2
  • OS (e.g., MacOS, Linux):linux
  • macOS version (if applicable):
  • How you install python (anaconda, virtualenv, system):anaconda
  • python version (e.g. 3.7):3.6
  • any other relevant information:

Additional context

Add any other context about the problem here.

@fcqfcq fcqfcq added the bug Unexpected behaviour that should be corrected (type) label Apr 14, 2020
@fcqfcq fcqfcq changed the title key :498 KeyError: '498' W_shape = graph.shape_dict[W_name] Apr 14, 2020
@bhushan23
Copy link
Collaborator

@fcqfcq looks like shape information is not available for input weights.
Can you share onnx model?

@bhushan23 bhushan23 added the awaiting response Please respond to this issue to provide further clarification (status) label Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Please respond to this issue to provide further clarification (status) bug Unexpected behaviour that should be corrected (type)
Projects
None yet
Development

No branches or pull requests

2 participants