GPT2 one step beam search update with configuration support#7425
Merged
tianleiwu merged 25 commits intomicrosoft:masterfrom Apr 29, 2021
Merged
GPT2 one step beam search update with configuration support#7425tianleiwu merged 25 commits intomicrosoft:masterfrom
tianleiwu merged 25 commits intomicrosoft:masterfrom
Conversation
ONNX with beam search refactoring
tianleiwu
reviewed
Apr 23, 2021
Contributor
|
Please add some tests. For example, in test_gpt2.py? |
tianleiwu
reviewed
Apr 23, 2021
tianleiwu
reviewed
Apr 23, 2021
| def top_k_top_p_filtering(log_probs, top_p=1.0, top_k=0): | ||
| '''Set tail event (out of top_p) to a big negative number''' | ||
| sorted_log_probs, sorted_indices = torch.sort(log_probs, descending=True) | ||
| cumulative_probs = torch.cumsum(sorted_log_probs.exp(), dim=-1) |
Contributor
There was a problem hiding this comment.
CumSum for float16 need onnx opset version 14. User will encounter issue in float16 model right now since pytorch and ORT does not support opset 14 right now.
Member
Author
There was a problem hiding this comment.
I have tested on Pytorch and ORT 1.7.0 and it works fine. Could you clarify? Thanks
Member
Author
Done |
tianleiwu
reviewed
Apr 27, 2021
added 2 commits
April 27, 2021 22:08
tianleiwu
approved these changes
Apr 27, 2021
…o xi-liu-ds/beam_search_update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: In this PR we add update one-step beam search with supporting early stopping, temperature, repetition penalty, length penalty, excluded token ids and sampling in ONNX graph.
Motivation and Context
How to run
In bash/CMD/PowerShell, run:
and optionally with
--input_test_file=[path/to/test/file]and setting different configuration flags (--ignore_eos,--repetition_penalty,--temperature,--excluded_token_ids,--length_penalty,--do_sample,--do_sample_top_p,--do_sample_top_k)