Add Tensorflow handling of ONNX conversion (#13831)

* Add TensorFlow support for ONNX export

* Change documentation to mention conversion with Tensorflow

* Refactor export into export_pytorch and export_tensorflow

* Check model's type instead of framework installation to choose between TF and Pytorch

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
Co-authored-by: Alberto Bégué <alberto.begue@della.ai>
Co-authored-by: lewtun <lewis.c.tunstall@gmail.com>
This commit is contained in:
Alberto Bégué
2022-02-10 10:18:41 +00:00
committed by GitHub
parent e923917cd9
commit cb7ed6e083
5 changed files with 271 additions and 96 deletions

View File

@@ -62,10 +62,6 @@ Ready-made configurations include the following architectures:
- XLM-RoBERTa
- XLM-RoBERTa-XL
The ONNX conversion is supported for the PyTorch versions of the models. If you
would like to be able to convert a TensorFlow model, please let us know by
opening an issue.
In the next two sections, we'll show you how to:
* Export a supported model using the `transformers.onnx` package.
@@ -150,6 +146,8 @@ DistilBERT we have:
["last_hidden_state"]
```
The approach is similar for TensorFlow models.
### Selecting features for different model topologies
Each ready-made configuration comes with a set of _features_ that enable you to