onnx / onnxmltools

ONNXMLTools enables conversion of models to ONNX
https://onnx.ai
Apache License 2.0
998 stars 181 forks source link

onnx + graphpipe #199

Open NonaryR opened 5 years ago

NonaryR commented 5 years ago

Hello! I'm trying to use onnx model from sklearn with graphpipe

Save an onnx model which contains Pipeline with StandartScaler + LogisticRegression Also, I should provide value-inputs.json, with inputs specification In my data i have 44 float features, so my value-inputs looks like this:

{"float_input": [1, [1, 44]]}

Then I run docker container and have this validation error

docker run -it --rm -v $PWD:/root \
    -e https_proxy=${https_proxy} \
    -p 9000:9000 \
    sleepsonthefloor/graphpipe-onnx:cpu \
    --model=/root/pipeline.onnx \
    --value-inputs=/root/model.json \
    --listen=0.0.0.0:9000
INFO[0000] Setting MKL_NUM_THREADS=4.  You can override this variable in your environment.
INFO[0000] Starting graphpipe-caffe2 version 1.0.0.4.0a1675f.dev (built from sha 0a1675f)
WARNING: Logging before InitGoogleLogging() is written to STDERR
E1213 12:32:57.650635     1 c2_api.cc:309] Binary compiled without cuda support.  Using cpu backend.
INFO[0000] Loading file %!(EXTRA string=/root/model.json)
INFO[0000] Loading file %!(EXTRA string=/root/pipeline.onnx)
E1213 12:32:57.661876     1 init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
E1213 12:32:57.662380     1 init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
E1213 12:32:57.662405     1 init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.
terminate called after throwing an instance of 'onnx_c2::checker::ValidationError'
  what():  Unrecognized type value case (value_info name: probabilities): 0
*** Aborted at 1544704377 (unix time) try "date -d @1544704377" if you are using GNU date ***
PC: @     0x7f79c1b27428 gsignal
*** SIGABRT (@0x1) received by PID 1 (TID 0x7f79c3b04b40) from PID 1; stack trace: ***

In my onnx model I have two outputs -- label and probabilties:

output {
    name: "label"
    type {
      tensor_type {
        elem_type: INT64
        shape {
          dim {
            dim_value: 1
          }}}}}
  output {
    name: "probabilities"
    type {
      sequence_type {
        elem_type {
          map_type {
            key_type: INT64
            value_type {
              tensor_type {
                elem_type: FLOAT
              }}}}}}}

How can I resolve this?

wenbingl commented 5 years ago

@xadupre @prabhat00155

xadupre commented 5 years ago

I'm not sure where the errror comes from. If it is a bad conversion, we made many fixes over the past two weeks to fix the conversion of pipelines in sklearn-onnx. If it is a runtime issue, graphpipe says it is using caffe2 as a runtime. Is it possible to check the onnx model with a different runtime (such as onnxruntime) and let us know the outcome?

ghostplant commented 5 years ago

@xadupre I got same building error.