castorini/honk

onnx models won't pass the checker (Raspberry Pi)

Closed this issue · 3 comments

Hi,
I have followed the instructions for running on Raspberry Pi infrastructure (using RPI 3 model B with latest raspbian) and have encountered the following error when loading any .onnx models:

File "/home/pi/honk/main.py", line 18, in main
server.start(config)
File "./server.py", line 144, in start
lbl_service = load_service(config)
File "./server.py", line 126, in load_service
lbl_service = Caffe2LabelService(model_path, commands)
File "./service.py", line 62, in init
self.model = onnx_caffe2.backend.prepare(self._graph)
File "/home/pi/.local/lib/python2.7/site-packages/onnx_caffe2/backend.py", line 513, in prepare
super(Caffe2Backend, cls).prepare(model, device, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/onnx/backend/base.py", line 53, in prepare
onnx.checker.check_model(model)
File "/home/pi/.local/lib/python2.7/site-packages/onnx/checker.py", line 32, in checker
proto.SerializeToString(), ir_version)
onnx.onnx_cpp2py_export.checker.ValidationError: Unrecognized attribute: dilations
==>
Context: Bad node spec: input: "13" output: "15" op_type: "MaxPool" attribute { name: "kernel_sha pe" ints: 2 ints: 2 } attribute { name: "pads" ints: 0 ints: 0 } attribute { name: "dilations" ints: 1 ints: 1 } attribute { name: "strides" ints: 2 ints: 2 }

It seems that my pooling layers do not support dilation?
(which coincides with operator descriptions [https://github.com/onnx/onnx/blob/master/docs/Operators.md#MaxPool] )

May I ask what versions/branches did you use for successful loading of the model?
Or if I can fix this in any other way?

Note: In step 9, I've had a few more files that needed numba and jit commenting under the librosa package folder

Hmm, that's odd. Perhaps onnx-caffe2 and/or PyTorch's ONNX module changed too much since October 2017, when we did our experiments. We used PyTorch 0.2.0, ONNX 0.2, and onnx-caffe2 0.2.

It is simply missing from the implementation: https://github.com/onnx/onnx/pull/1864/files

@daemon Doing some further research made me realize that dilation was probably not defined in the IR_version (onnx file versioning) used for the .onnx file export.
In Honk's readme, I can't find which version of onnx_caffe2 and onnx was used.

Could you maybe give me guidance on how your setup looked like when you ran these models?

The best would be to have .pt dumps for the models (especially the cnn_one_fstride4.onnx and cnn_one_fstride8.onnx).

Thank you in advance!