microsoft / microsoft/onnxruntime

Random sampling for T5 text generation

Open
#12,837 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request model:transformer
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 8h
Merged PRs (30d)
179

Description

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Right now, the ORT only supports beam search and greedy search, but not random sampling for T5. It would be great to implement random sampling.

System information

  • ONNX Runtime version (you are using):
    ORT 1.12

Describe the solution you'd like
A clear and concise description of what you want to happen.

The beam search and greedy search nodes are defined here: https://github.com/microsoft/onnxruntime/blob/main/onnxruntime/python/tools/transformers/convert_generation.py#L889
An implementation of top-k and top-p random sampling for T5 text generation would be great. The corresponding huggingface implementation is here: https://github.com/huggingface/transformers/blob/main/src/transformers/generation_utils.py#L1796

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in onnxruntime/python/tools/transformers/convert_generation.py around the beam search and greedy search nodes at line 889, then compare the Hugging Face generation_utils.py implementation around line 1796. The work is done when T5 text generation supports top-k and top-p random sampling in addition to the existing search modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.