tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

Multiple model

Open shbnm21 opened this issue 6 years ago • 5 comments

How to convert multiple models to onnx format.

I have trained model which is having Gan model as well as encoder decoder models.

How do I convert all the models to onnx format

shbnm21 avatar Jun 21 '19 05:06 shbnm21

Which framework did you use to create these models? There are converters and exporters which can convert models from tensorflow, keras, pytorch and such to onnx You can start from here : https://github.com/onnx

askhade avatar Aug 10 '19 15:08 askhade

Thanks for the response,I was training a project on GitHub.It is pytorch based model There are 4 .pth files.Out of which 3 files I have successfully converted to onnx and then to caffe2.But I am facing issue with one of the .pth file. Not able to convert into caffe2. I have asked on caffe2 forum but might be nobody noticed it.

shbnm21 avatar Aug 11 '19 10:08 shbnm21

Are you able to convert the 4th model to ONNX? You should consider using ONNX Runtime which runs ONNX models directly and supports all of ONNX. I do not believe Caffe2 supports all of ONNX.

prasanthpul avatar Aug 11 '19 22:08 prasanthpul

Thank u for the reply. Yes I am able to convert 4 th model to onnx. I will look into onnx runtime . Because of the 4 th model I am stuck and not able to deploy the model on Android .

shbnm21 avatar Aug 12 '19 01:08 shbnm21

Hi @askhade / @prasanthpul , sorry I do not know whether is this the right place to ask .. Model : I am using a bert model and 2 different classifiers upon it, trained using NeMo.

Usually for text-classification, which has bert and a single classifier they jit trace each separately, convert to individual onnx files and use a method to attach both the onnx files by manipulating node names etc. When I use the above to export the model to onnx and check the model I get Graph must be in single static assignment (SSA) form, however 'hidden_states' has been used as graph input names multiple times.

Suppose if I change the input name of a classifier to hidden_states_1 how does the IR know both the input variables of each classifier are the same output of bert model? (same error applies to output variable logits)?

kalyangvs avatar Oct 28 '20 17:10 kalyangvs