Home > front end >  Is it possible to train ONNX models developed in tensorflow and pytorch with C ?
Is it possible to train ONNX models developed in tensorflow and pytorch with C ?

Time:11-06

I wonder if its possible to use tensorflow and pytorch models converted to onnx models to train them with the C Api like it is done in e.g. https://gist.github.com/asimshankar/5c96acd1280507940bad9083370fe8dc with a tensorflow model. I just found examples for inference with onnx. The idea is to be able to prototype with tensorflow and pytorch in python, convert to onnx models and to have a unified API in C to do inference and training. It would help quite a lot to get some (links to get) informaton.

CodePudding user response:

ONNX's GitHub page suggests that it can be used for inference, but it doesn't seem reasonable to be able to train all models with it (from the development perspective).

Currently we focus on the capabilities needed for inferencing (scoring).

Although there are some difficulties, such as always writing backpropagation is more difficult than feedforwarding, and supporting it would double the framework size, which is not what ONNX is aiming for since there are already so many frameworks for this. To train you will need all the parameters, the derivatives of functions in the GPU and CPU(if its performance is lower than other frameworks, it will be a big problem since nobody will use it). And there are many other things that make a unified framework difficult(Supporting training on multiple GPUs over a network, for example).(So In our perspective, it's great, but in theirs it's so difficult)

But we can see that some functionality for training has been added to the framework, in this case it can train transformer models

Also, to training transformers in PyTorch you could see this link

CodePudding user response:

ONNX Runtime does support training but not in C . You can train an ONNX model using ORT and Pytorch. Please see here https://onnxruntime.ai/docs/get-started/training-pytorch.html.

  • Related