Loosen output shape restrictions on GPT-style models (#25188)

* Loosen output shape restrictions on GPT-style models

* Use more self-explanatory variables

* Revert "Use more self-explanatory variables"

This reverts commit 5fd9ab3911.
This commit is contained in:
calpt 2023-08-07 16:31:15 +02:00 committed by GitHub
parent d6bfba76be
commit 65001cb1c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -603,7 +603,7 @@ class DecisionTransformerGPT2Model(DecisionTransformerGPT2PreTrainedModel):
hidden_states = self.drop(hidden_states)
output_shape = input_shape + (hidden_states.size(-1),)
output_shape = (-1,) + input_shape[1:] + (hidden_states.size(-1),)
if self.gradient_checkpointing and self.training:
if use_cache:

View File

@ -849,7 +849,7 @@ class GPT2Model(GPT2PreTrainedModel):
hidden_states = self.drop(hidden_states)
output_shape = input_shape + (hidden_states.size(-1),)
output_shape = (-1,) + input_shape[1:] + (hidden_states.size(-1),)
if self.gradient_checkpointing and self.training:
if use_cache:

View File

@ -588,7 +588,7 @@ class GPTNeoModel(GPTNeoPreTrainedModel):
hidden_states = self.drop(hidden_states)
output_shape = input_shape + (hidden_states.size(-1),)
output_shape = (-1,) + input_shape[1:] + (hidden_states.size(-1),)
if self.gradient_checkpointing and self.training:
if use_cache:

View File

@ -641,7 +641,7 @@ class GPTJModel(GPTJPreTrainedModel):
hidden_states = self.drop(hidden_states)
output_shape = input_shape + (hidden_states.size(-1),)
output_shape = (-1,) + input_shape[1:] + (hidden_states.size(-1),)
if self.gradient_checkpointing and self.training:
if use_cache: