tracel-ai / burn

Burn is a new comprehensive dynamic Deep Learning Framework built using Rust with extreme flexibility, compute efficiency and portability as its primary goals.
https://burn.dev
Apache License 2.0
8.89k stars 440 forks source link

ONNX import issue: `Pad: only float values are currently supported for constant value, submit an issue on github` in `pad_config()` #2151

Closed SimonBrandner closed 2 months ago

SimonBrandner commented 3 months ago
ERROR burn_import::logger: PANIC => panicked at /home/simon/.cargo/git/checkouts/burn-178c6829f420d
Pad: only float values are currently supported for constant value, submit an issue on github

Link to model: https://drive.google.com/drive/folders/1zfzHNeGju1r1-5vishZ--uaQNSorA0SJ

mepatrick73 commented 2 months ago

I am under the assumption that this is for the landmarks_68_pfld.onnx model. I am currently using main rev and using the following code

use burn_import::onnx::ModelGen;

fn main() {
    // Generate Rust code from the ONNX model file
    ModelGen::new()
        .input("src/model/landmarks_68_pfld.onnx")
        .out_dir("model/")
        .run_from_script();
}

When I run cargo build, I get the following error :

  ERROR burn_import::logger: PANIC => panicked at /home/patrick/work/burn/crates/burn-import/src/onnx/op_configuration.rs:1056:9:
  Reshape: shape tensor must be present for Node { node_type: Reshape, name: "reshape1", inputs: [Argument { name: "averagepool2d1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 4, shape: Some([0, 3, 112, 112]) }), value: None, passed: false }, Argument { name: "concat1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 1, shape: None }), value: None, passed: false }], outputs: [Argument { name: "reshape1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 0, shape: None }), value: None, passed: false }], attrs: {} }

  --- stderr
  thread 'main' panicked at /home/patrick/work/burn/crates/burn-import/src/onnx/op_configuration.rs:1056:9:
  Reshape: shape tensor must be present for Node { node_type: Reshape, name: "reshape1", inputs: [Argument { name: "averagepool2d1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 4, shape: Some([0, 3, 112, 112]) }), value: None, passed: false }, Argument { name: "concat1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 1, shape: None }), value: None, passed: false }], outputs: [Argument { name: "reshape1_out1", ty: Tensor(TensorType { elem_type: Float32, dim: 0, shape: None }), value: None, passed: false }], attrs: {} }
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Let me know if I'm running the right model, because as per issue #2116 this issue is linked to the landmarks model.

SimonBrandner commented 2 months ago

You're right, closing in favour of https://github.com/tracel-ai/burn/issues/2115