Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing positions for beam search gpt2 #12156

Merged
merged 4 commits into from
Jul 14, 2022
Merged

Conversation

viboga
Copy link
Contributor

@viboga viboga commented Jul 12, 2022

Description:
Fixing position_ids input in iterations of gpt2 beam search.

Motivation and Context

  • Why is this change required? What problem does it solve?
    In gpt2 beam search, position ids for the tokens are incremented for each iteration. This is based of the initial length.
    This was initialized to sequence length but should be initialized to sequence length-1 for each batch.

  • If it fixes an open issue, please link to the issue here.
    N/A

Test Case:
Ran beam search for an input sequence of length 52. With DEBUG_BEAM_SEARCH enabled these are the outputs:

It works fine for the first iteration:
position_ids
Shape:{1,52}
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51

For the second iteration it should be 52, but its 53
position_ids
Shape:{1,1}
53

After the fix:

position_ids
Shape:{1,1}
52

@viboga viboga requested a review from tianleiwu July 12, 2022 22:31
@tianleiwu tianleiwu requested a review from wangyems July 14, 2022 00:03
@tianleiwu tianleiwu merged commit 05c31a0 into master Jul 14, 2022
@tianleiwu tianleiwu deleted the Vish/fix_gpt2_positions branch July 14, 2022 20:32
RandySheriffH pushed a commit that referenced this pull request Jul 18, 2022
* fixing positions for beam search gpt2
Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
RandySheriffH added a commit that referenced this pull request Jul 19, 2022
* support optimizer opt for deepspeed 0.5.9

* resolve comments

* resolve comments

* FP16_Optimizer Support for more Deepspeed Versions (#12046)

* fp16_optimizer for more ds versions

* change ds version

* bugfix

* fix bug

* Fix unused function warning for decodeMIDR(). (#12069)

Changed from static function defined in header to function declared in header and defined in separate .cc file.

* pin protobuf version to be compatible with onnx (#12132)

Co-authored-by: Ashwini Khade <askhade@microsoft.com@orttrainingdev10.d32nl1ml4oruzj4qz3bqlggovf.px.internal.cloudapp.net>

* RoiAlign CPU EP add warning for max mode with samples != 1 (#12136)

* RoiAlign add warning about incorrect max summation when sample size not 1

* include coreml_provider_factory.h in macos build instead of coreml_ex… (#12138)

include coreml_provider_factory.h in macos build instead of coreml_execution_provider.h

* List 3.10 as supported python version and remove 3.6 (#12141)

list 3.10 as supported python version and remove 3.6

Co-authored-by: Randy Shuai <rashuai@microsoft.com>

* Use updated symbolic_helper.check_training_mode (#11900)

Co-authored-by: Jingyan Wang, Baiju Meswani

* Fix GH issue 12151 by using inverse perms for updating DQ axis attribute (#12158)

* Fix GH issue 12151.

Need to use inverse perms for updating that axis to what is used for transposing the input. This only applies if the DQ node is doing per-axis dequantization.

* fixing positions for beam search gpt2 (#12156)

* fixing positions for beam search gpt2
Co-authored-by: Tianlei Wu <tlwu@microsoft.com>

* remove wrong placed libs (#12201)

* Add file mapping for windows platform. (#12183)

* Add file mapping for windows platform.

* Add unit test for file mapping for windows. Also add an error message for mis-aligned offset

* Add unit test for file mapping for windows. Also add an error message for mis-aligned offset

* Update data type to avoid warnings

* Compitable data type to avoid warnings. Update CreatFileMapping2 condition for winml compiling.

* Add type conversion to avoid warnings for X86 release build.

Co-authored-by: Ting Cao <ticao@microsoft.com>

* Fix bug where onnxruntime_USE_NCCL flag would default to ON (#12195)

Fix bug where onnxruntime_USE_NCCL flag would default to ON, causing ORT to not build properly. New functionality: flag is ON when training is enabled and NCCL is not disabled. Flag is OFF otherwise

Co-authored-by: zhijxu <zhijxu@microsoft.com>
Co-authored-by: zhijxu <zhijxu>
Co-authored-by: Vincent Wang <wangwchpku@outlook.com>
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: Ashwini Khade <askhade@microsoft.com>
Co-authored-by: Ashwini Khade <askhade@microsoft.com@orttrainingdev10.d32nl1ml4oruzj4qz3bqlggovf.px.internal.cloudapp.net>
Co-authored-by: Dwayne Robinson <dwayner@microsoft.com>
Co-authored-by: Carson Swope <carsonswope@users.noreply.github.com>
Co-authored-by: Randy Shuai <rashuai@microsoft.com>
Co-authored-by: jingyanwangms <47403504+jingyanwangms@users.noreply.github.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
Co-authored-by: Viswanath Boga <44417868+viboga@users.noreply.github.com>
Co-authored-by: leqiao-1 <61653207+leqiao-1@users.noreply.github.com>
Co-authored-by: caoting-dotcom <71617901+caoting-dotcom@users.noreply.github.com>
Co-authored-by: Ting Cao <ticao@microsoft.com>
Co-authored-by: Sean Murray <59740888+seanmurr1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants