transformers/docs/source/en/main_classes/onnx.md
Sylvain Gugger eb849f6604
Migrate doc files to Markdown. (#24376)
* Rename index.mdx to index.md

* With saved modifs

* Address review comment

* Treat all files

* .mdx -> .md

* Remove special char

* Update utils/tests_fetcher.py

Co-authored-by: Lysandre Debut <lysandre.debut@reseau.eseo.fr>

---------

Co-authored-by: Lysandre Debut <lysandre.debut@reseau.eseo.fr>
2023-06-20 18:07:47 -04:00

1.8 KiB

Exporting 🤗 Transformers models to ONNX

🤗 Transformers provides a transformers.onnx package that enables you to convert model checkpoints to an ONNX graph by leveraging configuration objects.

See the guide on exporting 🤗 Transformers models for more details.

ONNX Configurations

We provide three abstract classes that you should inherit from, depending on the type of model architecture you wish to export:

  • Encoder-based models inherit from [~onnx.config.OnnxConfig]
  • Decoder-based models inherit from [~onnx.config.OnnxConfigWithPast]
  • Encoder-decoder models inherit from [~onnx.config.OnnxSeq2SeqConfigWithPast]

OnnxConfig

autodoc onnx.config.OnnxConfig

OnnxConfigWithPast

autodoc onnx.config.OnnxConfigWithPast

OnnxSeq2SeqConfigWithPast

autodoc onnx.config.OnnxSeq2SeqConfigWithPast

ONNX Features

Each ONNX configuration is associated with a set of features that enable you to export models for different types of topologies or tasks.

FeaturesManager

autodoc onnx.features.FeaturesManager