Hello,
I am trying to use Pytorch FasterRCNN model with ORTModule. However I get the following error when trying to wrap my model:
[torch.onnx.errors.UnsupportedOperatorError: Exporting the operator ‘aten::randperm’ to ONNX opset version 15 is not supported]
I tried adding the function myself with the following code:
@_beartype.beartype
def aten_randperm(g, self, *args):
output=g.op(“aten::randperm”, self, *args)
output.setType(self.type())
return output
I registered this operation by using:
register_custom_op_symbolic(‘::randperm’, symbolic_opset14.aten_randperm, 14)
The error dissapeared and then a similar error related to aten::smooth_l1_loss arised. I did similar procedure to add it and moved forward.
Now I am getting the following error:
onnxruntime.training.ortmodule._fallback_exceptions.ORTModuleONNXModelException: There was an error while exporting the PyTorch model to ONNX:
File “/home/op/anaconda3/envs/py310ort/lib/python3.10/site-packages/torch/onnx/symbolic_opset9.py”, line 2244, in _or raise errors.SymbolicValueError( torch.onnx.errors.SymbolicValueError: ONNX export does NOT support exporting bitwise OR for non-boolean input values [Caused by the value ‘4292 defined in (%4292 : Byte(*, strides=[1], requires_grad=0, device=cuda:0) = onnx::ScatterND(%4273, %4277, %4291), scope: onnxruntime.training.ortmodule._io._FlattenedModule::/torchvision.models.detection.faster_rcnn.FasterRCNN::_original_module/torchvision.models.detection.roi_heads.RoIHeads::roi_heads # [/home/op/anaconda3/envs/py310ort/lib/python3.10/site-packages/torchvision/models/detection/_utils.py:65:0]’ (type ‘Tensor’) in the TorchScript graph. The containing node has kind ‘onnx::ScatterND’.] (node defined in /home/op/anaconda3/envs/py310ort/lib/python3.10/site-packages/torchvision/models/detection/_utils.py: call
Currently I have not being able to work with any of the object detection models (FasterRCNN, Fcos) or Deeplab for Semantic Segmentation inside the ORTModule.
Could you please help me figure out what could possibly be causing this problem? Is it maybe my implementation for the custom operators?
I am currently using Pyhon 3.10, onnx 1.14.1, torch_ort 1.15.0 and Pytorch 2.0.1+cu117
Thanks,
Zazhil-ha