question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🚀 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:closed
  • Created 2 years ago
  • Reactions:18
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
piEspositocommented, May 11, 2022

Hugging Face rocks.

0reactions
harishankar-gopalancommented, Aug 8, 2022

@philschmid Thanks for the update. I did manage to find out after some deep diving into the HuggingFace Transformers repo.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found