My biggest problem is that at this point many things related to binding TorchSharp and ML.NET are not completed, even though in many sources I saw that the work is in progress, but I hope to be able to overcome it somehow. The main requirement is to use only C#.NET for training a very custom neural.network model from the scratch and then for running it. Please don't make emphasis on this requirement. It is what it is. The question is how to train a model and then run it?
So far, I managed to train a model using TorchSharp and save it with a hope to use it later in ML.NET but it looks like TorchSharp saves the model in a format very specific to torch/PyTorch/TorchSharp. It looks like PyTorch has torch.onnx.export method but TorchSharp doesn't have such method. So, I'm stuck at a point how to save my trained model as ONNX?
Then I hope to be able to load/import that ONNX to ML.NET using OnnxTransformer and run it. Any suggestions, keeping in mind that everything needs to be in C#.NET? There is one other thing to add. I guess I can load and run the model using TorchSharp itself but there is already written code using ML.NET for running other models so I hoped to have a unified interface for running via ML.NET.
Being able to run models trained with TorchSharp in ML.NET is part of our roadmap . However, it's not something we'll be delivering in the near future (next 6-9 months).
I think in the short-term the best path forward is what you suggested:
run the model using TorchSharp itself
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.