Ignore past_key_values
during GPT-Neo inference
#13521
Merged
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.
What does this PR do?
Applies #8633 to GPT-Neo.
I was getting errors like
RuntimeError: Sizes of tensors must match except in dimension 2. Got 20 and 19 (The offending index is 0)
during the evaluation step ofTrainer.train()
with GPT-Neo.This was fixed in an internal implementation of
GPTNeoForSequenceClassification
by @manuelciosici before an official version of the class was released fortransformers
. I converted our code to use thetransformers
version of the class and realized the solution should be upstreamed. I'm just mentioning this here because I don't get all the credit for this patch.This might be needed for other models as well, but I don't know of a good way to figure that out without testing them all.
Who can review?
trainer: @sgugger