No schema registered for 'Celu'
Describe the bug
Error "No schema registered for 'Celu'!" happens when I'm trying to run "onnx_tf.backend.prepare(my_model)". Is there a way to solve this problem?
To Reproduce
My code is just: onnx_tf.backend.prepare(onnx.load(PATH))
ONNX model file
https://drive.google.com/file/d/1CkXFBeEjLFqmdDcPYb77Wqz_rPYrpdOw/view?usp=sharing
Python, ONNX, ONNX-TF, Tensorflow version
- Python version: 3.6.9
- ONNX version: 1.8.1
- ONNX-TF version: 1.7.0
- Tensorflow version: 2.4.1
Additional context
Please specify Tensorflow version. Use 2.4.x and see if it helps.
Please specify Tensorflow version. Use 2.4.x and see if it helps.
Tensorflow version is 2.4.1. (I edited the issue).
I tried with the same env and the prepare call works. However, the export_graph call fails with "RuntimeError: Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow"
Unfortunately, that is a known limitation in resize conversion, due to no Tensorflow equivalent for the pytorch_half_pixel option.
Okey, I will try to fix it, thank you for attention.
Hi. I'm having the exact same issue as described here. With my .onnx model, when I call prepare I get "Error "No schema registered for 'Celu'!" I have the same exact libraries versions as described above onnx model: https://drive.google.com/file/d/1ukBrN3zGAkI368PFjtZ4Olx2RCyc8rGh/view?usp=sharing
Can anyone help? Thanks in advance
Also, for @bratyslav model I get the same error. Just doing
onnx_model = onnx.load(f'{root_dir}/models/modnet.onnx')
tf_rep = prepare(onnx_model)
I am porting model from pytorch to tflite. I had same problem with Celu, i changed opset_version in torch.onnx.export (from 11 to 12) and celu error gone.
Now i having another error mentioned before (RuntimeError: Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow.).
As you can tell here, https://github.com/onnx/onnx/blob/master/docs/Operators.md#Celu, the Celu op is first introduced in ONNX opset 12. The initial problem is in the Pytorch exporter, which could produce a model with opset < 12 and including Celu. The default opset number is way too old as seen in this issue, https://github.com/pytorch/pytorch/issues/48341
I encountered same problem. But my model does not have any Celu op, so I am very confused. Here is stack dump
Invalid MIT-MAGIC-COOKIE-1 key2021-03-19 17:47:09,586 - onnx-tf - INFO - Start converting onnx pb to tf pb:
Traceback (most recent call last):
File "/home/jeffwhen/.local/bin/onnx-tf", line 8, in <module>
sys.exit(main())
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/cli.py", line 20, in main
return onnx_tf.converter.main(args[1:])
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/converter.py", line 20, in main
convert(**{k: v for k, v in vars(args).items() if v is not None})
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/converter.py", line 134, in convert
tf_rep = backend.prepare(onnx_model, **kwargs)
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/backend.py", line 70, in prepare
return cls.onnx_model_to_tensorflow_rep(model, strict, **kwargs)
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/backend.py", line 90, in onnx_model_to_tensorflow_rep
return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict,
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/backend.py", line 111, in _onnx_graph_to_tensorflow_rep
handlers = cls._get_handlers(opset)
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/backend.py", line 303, in _get_handlers
return get_all_backend_handlers(opset_dict)
File "/home/jeffwhen/.local/lib/python3.8/site-packages/onnx_tf/common/handler_helper.py", line 25, in get_all_backend_handlers
since_version = defs.get_schema(
onnx.onnx_cpp2py_export.defs.SchemaError: No schema registered for 'Celu'!
@Jeffwhen please provide your onnx file for debugging. Also your environment details, such as onnx, tensorflow versions, thanks.
@chinhuang007 onnx version 1.8.1 tensorflow 2.3.1 onnx-tf 1.7.0. Model file on google drive
@Jeffwhen The issue is in the combination of onnx 1.8.1 and onnx-tf 1.7.0. The onnx-tf 1.7.0 from pip install officially supports onnx 1.7.0. You have two options to get rid of this error. 1. install onnx 1.7.0 2. source install onnx-tf from the master branch.
Once you have done that, unfortunately you will hit a known unsupported case "Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow". The only solution to that is to use one of the supported resize options, seen in the notes section of https://github.com/onnx/onnx-tensorflow/blob/master/doc/support_status_v1_7_0.md
Okey, I will try to fix it, thank you for attention.
Could you tell me how you did? @bratyslav