export with 🤗 Optimum via CLI.
export with 🤗 Optimum with optimum.onnxruntime.

Exporting a 🤗 Transformers model to ONNX with CLI
To export a 🤗 Transformers model to ONNX, first install an extra dependency:

pip install optimum[exporters]
To check out all available arguments, refer to the 🤗 Optimum docs, 
or view help in command line:

optimum-cli export onnx --help
To export a model's checkpoint from the 🤗 Hub, for example, distilbert/distilbert-base-uncased-distilled-squad, run the following command: