server icon indicating copy to clipboard operation
server copied to clipboard

onnx model dynamic axis not working

Open wooAo opened this issue 2 years ago • 3 comments

Description onnx model dynamic axis is not working i'm sure the onnx output node has the dynamic axis for both dimension

netron info: Dingtalk_20220826140758

export script: Dingtalk_20220826140128

print onnx model output node info:

[name: "output"
type {
  tensor_type {
    elem_type: 1
    shape {
      dim {
        dim_param: "None"
      }
      dim {
        dim_param: "None"
      }
    }
  }
}
]

Triton Information model_repository_manager.cc:832] failed to load 'Drinks-Sku' version 1: Invalid argument: model 'Drinks-Sku', tensor 'output': the model expects 2 dimensions (shape [-1,16075]) but the model configuration specifies 2 dimensions (an initial batch dimension because max_batch_size > 0 followed by the explicit tensor shape, making complete shape [-1,-1])

Are you using the Triton container or did you build it yourself? Triton container

config.pbtxt

name: "Drinks-Sku"
platform: "onnxruntime_onnx"
max_batch_size: 128
input [
  {
    name: "img"
    data_type: TYPE_FP32
    format: FORMAT_NHWC
    dims: [3, 224, 224]
  }
]
output [
  {
    name: "output"
    data_type: TYPE_FP32
    dims: [-1 ]
  }
]
instance_group [
  {
    count: 1
    kind: KIND_GPU
    gpus: [ 0 ]
  }
]
dynamic_batching { }

wooAo avatar Aug 26 '22 06:08 wooAo

Hi @wooAo ,

model_repository_manager.cc:832] failed to load 'Drinks-Sku' version 1: Invalid argument: model 'Drinks-Sku', tensor 'output': the model expects 2 dimensions (shape [-1,16075]) but the model configuration specifies 2 dimensions (an initial batch dimension because max_batch_size > 0 followed by the explicit tensor shape, making complete shape [-1,-1])

Is your output tensor supposed to be something like this instead in the config?

output [
  {
    name: "output"
    data_type: TYPE_FP32
    dims: [ 16075 ]   // implicitly [-1, 16075] because max_batch_size > 0
  }
]

rmccorm4 avatar Aug 26 '22 21:08 rmccorm4

Hi, the specified dims work fine, but we have more than 10 models in our production line and they need to share one config.pbtxt (must be)

wooAo avatar Aug 28 '22 12:08 wooAo

Are your 10 models different versions of the same one? If this is the case then you can layout your directory structure as follows:

<model-repository-path>/
  <model-name>/
    config.pbtxt
    1/
      onnx.model
    2/
      onnx.model
    3/
      onnx.model
    ...

If you want distinct names for your model then you will have to copy your config.pbtxt file (changing the name parameter appropriately) to each of your directories.

nv-kmcgill53 avatar Sep 02 '22 17:09 nv-kmcgill53

Closing issue due to lack of activity. Please re-open the issue if you would like to follow up with this issue.

krishung5 avatar Oct 13 '22 00:10 krishung5