burn
burn copied to clipboard
ONNX burn-import: Can't transform Shape(4) to tensor
I tried to transform an onnx model to burn code using burn-import crate, but the build script fails with the following error:
ERROR burn_import::logger: PANIC => panicked at /Users/axpun/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/burn-import-0.16.0/src/onnx/to_burn.rs:1334:18: Can't transform Shape(4) to tensor.
This is the onnx model I tried to import: https://huggingface.co/Soykaf/RTMW3D-x/tree/main/onnx
According to the supported onnx operations table, shape should be supported: https://github.com/tracel-ai/burn/blob/main/crates/burn-import/SUPPORTED-ONNX-OPS.md
To Reproduce
- Download onnx model from HF via link above
- Follow the burn guide for onnx model import (https://burn.dev/burn-book/import/onnx-model.html)
- run cargo build
Good news : I just put in a PR to fix this issue specifically. Shape should not successfully be processed.
Bad news : The model you are referencing has a few unsupported Onnx Ops : Unsupported ops: [Abs, DepthToSpace, Abs, Abs, Split, Split]
Good news : I just put in a PR to fix this issue specifically. Shape should not successfully be processed.
Bad news : The model you are referencing has a few unsupported Onnx Ops :
Unsupported ops: [Abs, DepthToSpace, Abs, Abs, Split, Split]
Thank you!
I have the same issue with a different model, and looks like that PR was closed. I think this issue should be opened again? I'm trying this model: https://huggingface.co/TheEeeeLin/HivisionIDPhotos_matting/blob/main/retinaface-resnet50.onnx
Reopening it per AdrianEddy request.
Reproduction
For reference, using the current git version of Burn (has some improvements since the latest release tag v0.17.1).
Reproduction uses this compose.yaml.
rtmw3d-x_8xb64_cocktail14-384x288-b0a0eab7_20240626.onnx
ONNX_MODEL_URL='https://huggingface.co/Soykaf/RTMW3D-x/resolve/main/onnx/rtmw3d-x_8xb64_cocktail14-384x288-b0a0eab7_20240626.onnx' \
docker compose run --rm -it burn-onnx-import cargo build
DEBUG onnx_ir::rank_inference: Inferring rank for node: reducesum1
DEBUG onnx_ir::node::reduce_sum: ReduceSum rank inference for node reducesum1
ERROR burn_import::logger: PANIC => panicked at /root/.cargo/git/checkouts/burn-6c277d792b0d5d7a/1f5ccd4/crates/onnx-ir/src/node/reduce_sum.rs:64:14:
Only tensor input is valid
retinaface-resnet50.onnx
ONNX_MODEL_URL='https://huggingface.co/TheEeeeLin/HivisionIDPhotos_matting/resolve/main/retinaface-resnet50.onnx' \
docker compose run --rm -it burn-onnx-import cargo build
INFO onnx_ir::from_onnx: Parsing ONNX file: src/model/example.onnx
ERROR burn_import::logger: PANIC => panicked at /root/.cargo/git/checkouts/burn-6c277d792b0d5d7a/1f5ccd4/crates/onnx-ir/src/from_onnx.rs:381:5:
Nodes are not topologically sorted
RTMW3D-x is buildable with https://github.com/tracel-ai/burn/pull/3564 (still under review)