# Exporting tokenizer to an onnx model

**URL:** <https://discuss.huggingface.co/t/exporting-tokenizer-to-an-onnx-model/15467>\
**Category:** 🤗Tokenizers\
**Created:** [March 7, 2022, 7:46pm UTC](https://discuss.huggingface.co/t/exporting-tokenizer-to-an-onnx-model/15467 "2022-03-07T19:46:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spencer-gable-cook](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@spencer-gable-cook](https://discuss.huggingface.co/u/spencer-gable-cook)\
**Post date:** [March 7, 2022, 7:46pm UTC](https://discuss.huggingface.co/t/exporting-tokenizer-to-an-onnx-model/15467/1 "2022-03-07T19:46:39Z")

</div>

Hello!

I am using Transformers and Tokenizers on Amazon Web Services (AWS), however I am struggling to import the “transformers” or “tokenizers” library into my AWS Lambda function. I have tried methods with Docker and by zipping the transformers package into Lambda, however none of these approaches have worked for me. I have already trained my model on my local computer, so I do not require any training functionality of transformers on AWS; I only require inference from my trained transformer on AWS.

So far, I have successfully converted my trained transformer model to an .onnx file. This way, I do not have to import “transformers” into AWS. I followed the tutorial [here](https://huggingface.co/docs/transformers/serialization). However, I still require my tokenizer to feed data into my .onnx file, and I am not able to import the “tokenizers” library.

Could I convert my tokenizer to an .onnx file as well? Or is there another way that I could use my tokenizer without requiring the “tokenizer” library?

Thank you very much for all of your help!

---

<div class="post-metadata">

**Author:** ![Franck-Dernoncourt](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/franck-dernoncourt/32/15950_2.png) [@Franck-Dernoncourt](https://discuss.huggingface.co/u/Franck-Dernoncourt)\
**Post date:** [June 23, 2024, 11:09pm UTC](https://discuss.huggingface.co/t/exporting-tokenizer-to-an-onnx-model/15467/2 "2024-06-23T23:09:25Z")

</div>

Have you found a solution to export a tokenizer to an onnx model?
