Exporter Recipes Gallery¶
A model can be converted to ONNX if torch.export.export()
is
able to convert that model into a graph. This is not always
possible but usually possible with some code changes.
These changes may not be desired as they may hurt the performance
and make the code more complex than it should be.
The conversion is a necessary step to be able to use
ONNX. Next examples shows some recurrent code patterns and
ways to rewrite them so that the exporter works.
See Parameter torch.export.export(…, strict: bool) for an organized version of this gallery.
to_onnx and a model with a test
to_onnx and a model with a test
to_onnx and a custom operator inplace
to_onnx and a custom operator inplace
to_onnx and a custom operator registered with a function
to_onnx and a custom operator registered with a function
to_onnx and a model with a loop (scan)
to_onnx and a model with a loop (scan)
to_onnx and submodules from LLMs
to_onnx and submodules from LLMs