Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ONNX: Adds Ops GatherElements & Xor #2568

Merged
merged 5 commits into from
Oct 17, 2024

Conversation

AnubhabB
Copy link
Contributor

This PR adds support for the following ONNX Ops:

@LaurentMazare please take a look at the Xor implementation, Candle is currently missing Tensor::logical_<and | or | not | xor> ops?

Unsure if my current workaround is reasonable.

@LaurentMazare
Copy link
Collaborator

The xor implementation looks reasonable to me in the current setup. I would be curious if you have any practical model that require this op?

@LaurentMazare LaurentMazare merged commit 7c09215 into huggingface:main Oct 17, 2024
10 checks passed
@AnubhabB
Copy link
Contributor Author

Yup, this one - this is a Document layout analysis model I crossed path with by Unstructured.io, originally I had intended to create a quick example for candle-onnx but refrained because I can't find the license information associated with the model.

@AnubhabB AnubhabB deleted the onnx-gather-elem-xor branch October 17, 2024 18:45
@AnubhabB
Copy link
Contributor Author

AnubhabB commented Oct 17, 2024

In fact, these are the ops used by this model:

["Add", "And", "Cast", "Clip", "Concat", "Constant", "ConstantOfShape", "Conv", "ConvTranspose", "Div", "Equal", "Exp", "Expand", "Flatten", "Floor", "Gather", "GatherND", "Gemm", "Greater", "If", "Less", "Log", "MaxPool", "Mod", "Mul", "NonZero", "Not", "Pad", "Range", "ReduceMax", "ReduceProd", "Relu", "Reshape", "Resize", "RoiAlign", "ScatterND", "Shape", "Sigmoid", "Slice", "Softmax", "Split", "Sqrt", "Squeeze", "Sub", "TopK", "Transpose", "Unsqueeze", "Where", "Xor"]

I'll try and figure out if these ops are common across some of the more popular models in Detectron2 Model Zoo. If they are common I'll try and bridge the gaps with Candle implementation over time, otherwise I think I'm better off with something like Sonos/tract or ort based onnx runtimes for my current project!

Edit: From the Ops above - the following are not supported by candle-onnx at the moment:

["And", "ConvTranspose", "GatherND", "Mod", "NonZero", "ReduceProd", "Resize", "RoiAlign", "ScatterND", "TopK"]

From what I can tell detectron2 mask rcnn based models exported to onnx tend to use these ops.
I'll probably take a stab at implementing these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ONNX: unsupported GatherElements ops
2 participants