🛠️ Converting PTH Models to NCNN and ONNX - Sirosky/Upscale-Hub GitHub Wiki
Introduction
This guide covers the conversion of PTH models to ONNX or NCNN. For the uninitiated (and vastly simplified), each of them are machine learning farmeworks. Community models are typically trained in PyTorch (resulting in PTH models), and then converted into ONNX or NCNN.
NCNN and ONNX are commonly used as part of inferencing / upscaling process, with NCNN typically being used by those with AMD GPUs, while ONNX can be used by both AMD and NVIDIA GPUs. In particular, ONNX is very common used for TensorRT inference on NVIDIA GPUs, which provides a significant boost to inference speed.
Prerequisites
- This guide assumes that you have chaiNNer installed-- if not, you can follow the guide here.
Instructions
- For converting into ONNX, download the chain here. For converting to NCNN, download the chain here. Make sure to hit the "Download raw file" button as seen below.
- Launch chaiNNer, and drag the downloaded .chn file into chaiNNer. Below is an example of what the PTH to ONNX chain looks like.
- Under the "Load Model" node, select the model you would like to convert. Everything else can be left on default unless you know what you're doing.
- Hit the run button, and done!