Remove token_type_ids from default TF GPT-2 signature#26962
Merged
Rocketknight1 merged 1 commit intomainfrom Oct 23, 2023
Merged
Remove token_type_ids from default TF GPT-2 signature#26962Rocketknight1 merged 1 commit intomainfrom
Rocketknight1 merged 1 commit intomainfrom
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
4 tasks
EduardoPach
pushed a commit
to EduardoPach/transformers
that referenced
this pull request
Nov 19, 2023
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.
Although GPT-2 supports
token_type_ids, the implementation is very weird (token embeddings are also used as token type embeddings!) and in practicetoken_type_ids=Noneis used almost exclusively.For most models, you could mimic the effects of
token_type_ids=Noneby just passing an all-zeros array, but this does not work for GPT-2 because it completely skips the embeddings whentoken_type_ids=None. This means that a model exported with atoken_type_idsinput cannot be coerced to behave correctly.To stop this tripping up other users, we remove
token_type_idsfrom the GPT-2 input sig. This issue is specific to GPT-2 - most other models have more reasonable ways of handlingtoken_type_idsand shouldn't be affected.Fixes #26783