🚀 Add built-in support for autorregressive text generation with ONNX models.
See original GitHub issue🚀 Add built-in support for autorregressive text generation with ONNX models.
After converting a autorregressive model to ONNX, it would be nice to be able to generate text with it via something like:
from transformers import OnnxTextGenerationModel, AutoTokenizer
model_path = "gpt-something.onnx"
tokenizer_name = "gpt2"
model = OnnxTextGenerationModel(model_path)
# and then
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model.generate(encoded_input)
With support to using past_key_values
internally in the most efficient way.
Motivation
When trying to accelerate inference with transformers, being unable to load our ONNX model with the lib and running a model.generate
method to seamlessly generate sequences and perform Beam Search is somehow frustrating. That leads us to have to rely on custom implementations - which takes time and are a lot more prone to have bugs.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Add built-in support for autorregressive text generation with ...
When trying to accelerate inference with transformers, being unable to load our ONNX model with the lib and running a model.generate method to ......
Read more >Using onnx for text-generation with GPT-2 - 🤗Transformers
Hi @valhalla @patrickvonplaten , I was working with onnx_transformers and using onnx for GPT-2 model and text-generation task.
Read more >Model Zoo - Deep learning code and pretrained models for ...
ModelZoo curates and provides a platform for deep learning researchers to easily find code and pre-trained models for a variety of platforms and...
Read more >Profile for GitHub - Linknovate
Python supports procedural programming using functions and also inheritable ... Yet another Autoregressive Text-to-Image generation model from Google, ...
Read more >Available CRAN Packages By Date of Publication
2022-11-24, iAR, Irregularly Observed Autoregressive Models ... 2022-11-18, inTextSummaryTable, Creation of in-Text Summary Table. 2022-11-18, jsonStrings ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hugging Face rocks.
@philschmid Thanks for the update. I did manage to find out after some deep diving into the HuggingFace Transformers repo.