microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.5k stars 4.28k forks source link

RuntimeError: ONNX (Identity) is not supported in CNTK #3505

Open ssoumyajit opened 5 years ago

ssoumyajit commented 5 years ago

onnx_identity_fail

I tried to import an ONNX model to cntk but got this error. https://github.com/onnx/tutorials/blob/master/tutorials/OnnxCntkImport.ipynb I used the above process to test which was successful in my machine;However my own onnx model shows the above runtime error. any help?

delzac commented 5 years ago

Which version of cntk can you using? Different cntk ver support different onnx specs.

ssoumyajit commented 5 years ago

@delzac , I use CNTK 2.4 currently. I tried CNTK 2.6 version(with intel mkl being installed), However I could not be able to run the example code also, So thinking that I might miss some dependencies or something, I downgraded to cntk 2.4 where the example works but giving above error while I try to use my own model.

ssoumyajit commented 5 years ago

@delzac , Just to mention; my ONNX model is generated from a native keras model. keras model---->ONNX model------->Import to CNTK. Do you think the identity layer or something is somehow missed in the process?

ssoumyajit commented 5 years ago

It seems like CNTK 2.4 does not support Identity layer/operator. Tried to use CNTK 2.7 nightly build version because mentioned that it supports Identity layer and yes it is :) but unfortunately It does not support upsample (tested with my model). I found that converting the keras model into an ONNX model introduces Identity layer in the original model which is not supported in CNTK 2.4. I changed the the keras model into coreml using coreml tools instead of ONNX and successfully exported into CNTK 2.4 which seems to work.

delzac commented 5 years ago

Sounds great, thanks for posting the solution! :)