onnx / onnx-tensorflow

Tensorflow Backend for ONNX
Other
1.27k stars 296 forks source link

KeyError: 'ai.onnx.ml' for BiDAF model from the model zoo #437

Open HedgehogCode opened 5 years ago

HedgehogCode commented 5 years ago

Describe the bug

If I try to convert the model BiDAF from the ONNX Model Zoo I get an Exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/benjamin/apps/miniconda3/envs/datascience-cpu/lib/python3.6/site-packages/onnx_tf/backend.py", line 55, in prepare
    return cls.onnx_model_to_tensorflow_rep(model, strict)
  File "/home/benjamin/apps/miniconda3/envs/datascience-cpu/lib/python3.6/site-packages/onnx_tf/backend.py", line 75, in onnx_model_to_tensorflow_rep
    return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict)
  File "/home/benjamin/apps/miniconda3/envs/datascience-cpu/lib/python3.6/site-packages/onnx_tf/backend.py", line 129, in _onnx_graph_to_tensorflow_rep
    onnx_node, tensor_dict, handlers, opset=opset, strict=strict)
  File "/home/benjamin/apps/miniconda3/envs/datascience-cpu/lib/python3.6/site-packages/onnx_tf/backend.py", line 222, in _onnx_node_to_tensorflow_op
    handler = handlers[node.domain].get(node.op_type, None)
KeyError: 'ai.onnx.ml'

To Reproduce

  1. Download the model from here
  2. Try to convert it with the code from the README:
    import onnx
    from onnx_tf.backend import prepare
    onnx_model = onnx.load("bidaf.onnx")
    output = prepare(onnx_model)

Python, ONNX, ONNX-TF, Tensorflow version

This section can be obtained by running get_version.py from util folder.

*Expected

I would expect the conversion to either work or give an helpful error message.

tejaslodaya commented 4 years ago

@HedgehogCode Any update here?

HedgehogCode commented 4 years ago

Hi @tejaslodaya,

The error is still reproducible with the latest released version of onnx-tf. My new environment is:

The link to the model is now: https://github.com/onnx/models/tree/master/text/machine_comprehension/bidirectional_attention_flow

I have not looked into how to solve the issue.

steffens21 commented 4 years ago

I can also still reproduce this error. My environment: python==3.6.9 onnx-tf==1.6.0 onnx==1.6.0 tensorflow==2.2.0 tensorflow-addons==0.10.0