webonnx / wonnx

A WebGPU-accelerated ONNX inference run-time written 100% in Rust, ready for native and the web
Other
1.61k stars 59 forks source link

Support basic grouped convolutions #124

Closed SludgePhD closed 1 year ago

SludgePhD commented 2 years ago

Part of https://github.com/webonnx/wonnx/issues/109

Depth-wise convolutions are still failing (eg. https://github.com/onnx/onnx/tree/main/onnx/backend/test/data/pytorch-converted/test_Conv2d_depthwise), I'm not yet sure why. test_Conv2d_groups passes with this PR though.

SludgePhD commented 1 year ago

Rebased onto current HEAD, @pixelspark do you want to merge this partially working? (depth-wise convolution still doesn't work right, but some cases of grouped convolutions do)

pixelspark commented 1 year ago

Sure! Limitations should be properly documented then, e.g. in README.

I'm also curious to know what kinds of models this enables!

haixuanTao commented 1 year ago

Looks good to me :) Awesome to have new contribution to the project!

SludgePhD commented 1 year ago

Sure! Limitations should be properly documented then, e.g. in README.

Since I'm not sure what exactly the remaining bug is, this is a bit hard to write down properly. Does https://github.com/webonnx/wonnx/issues/109 suffice as documentation of the bug?

I'm also curious to know what kinds of models this enables!

By itself, this isn't enough to get anything interesting to work, but I'd like to get it merged first, since it has been lingering for a while. Once the remaining bugs in Conv are fixed, all the MediaPipe models should start to work (they all make heavy use of "depthwise separable convolution" to run in real time, which uses grouped convolutions).

pixelspark commented 1 year ago

Yeah, ok. I just merged this with a little addition to the README, that should suffice for now. Thank you for the contribution!