Convert a FastAI model to ONNX and CoreML
Hello there ๐, In this post, I will show you how to convert a FastAI model to ONNX and CoreML. Convert a FastAI model to Pytorch Before we can convert the model to ONNX format or CoreML, we need to convert it to Pytorch first. This is a simple process. Assuming that the model is trained, we need to call torch.save to export the model: 1 2 3 4 5 from fastai.vision.all import * # learn is your FastAI Learner torch.save(learn.model, "/models/model.pth") Convert a FastAI model to ONNX ONNX is a standard for machine learning models. It allows you to convert a model from a framework like PyTorch or TensorFlow to its format in order to be used in different runtimes, for exampl Windows, Android, Linux, MacOS and iOS and from various programming languages like C#, C++, Java, JavaScript and Python. ...