tranformers.onnx is no longer maintained, please export models with 🤗 Optimum as described above. This section will be removed in the future versions.

To export a 🤗 Transformers model to ONNX with tranformers.onnx, install extra dependencies:

pip install transformers[onnx]
Use transformers.onnx package as a Python module to export a checkpoint using a ready-made configuration: