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

Generate: skip left-padding tests on old models #23437

Merged
merged 2 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tests/generation/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,9 +1597,6 @@ def test_generate_with_head_masking(self):
attn_weights = out[attn_name] if attn_name == attention_names[0] else out[attn_name][-1]
self.assertEqual(sum([w.sum().item() for w in attn_weights]), 0.0)

# TODO (joao): this test is actually not slow :) However, it is not passing in some models (e.g. GPTNeoX) and the
# fix for some models is quite lengthy. Being slow means it doesn't block our push CI while we fix it.
@slow
def test_left_padding_compatibility(self):
# The check done in this test is fairly difficult -- depending on the model architecture, passing the right
# position index for the position embeddings can still result in a different output, due to numerical masking.
Expand Down
4 changes: 4 additions & 0 deletions tests/models/bart/test_modeling_bart.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,3 +1516,7 @@ def test_retain_grad_hidden_states_attentions(self):

def test_save_load_fast_init_from_base(self):
pass

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
Copy link
Member Author

@gante gante May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is not Bart, but the BartDecoder used as a stand-alone model. 11 out of the 16 skips below follow this pattern, a decoder used as a stand-alone model (which is not very used in practice, afaik).

The exceptions are CTRL, ImageGPT, Reformer, and TransfoXL

def test_left_padding_compatibility(self):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -811,3 +811,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/blenderbot/test_modeling_blenderbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -566,3 +566,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/ctrl/test_modeling_ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ def test_model_from_pretrained(self):
model = CTRLModel.from_pretrained(model_name)
self.assertIsNotNone(model)

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


@require_torch
class CTRLModelLanguageGenerationTest(unittest.TestCase):
Expand Down
4 changes: 4 additions & 0 deletions tests/models/imagegpt/test_modeling_imagegpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ def _create_and_check_torchscript(self, config, inputs_dict):

self.assertTrue(models_equal)

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


# We will verify our results on an image of cute cats
def prepare_img():
Expand Down
4 changes: 4 additions & 0 deletions tests/models/marian/test_modeling_marian.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,3 +862,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/mbart/test_modeling_mbart.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,3 +692,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/mvp/test_modeling_mvp.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,3 +818,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/pegasus/test_modeling_pegasus.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,3 +573,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/plbart/test_modeling_plbart.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,7 @@ def test_decoder_model_attn_mask_past(self):
def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
4 changes: 4 additions & 0 deletions tests/models/prophetnet/test_modeling_prophetnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,10 @@ def test_retain_grad_hidden_states_attentions(self):
# decoder cannot keep gradients
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


@require_torch
class ProphetNetStandaloneEncoderModelTest(ModelTesterMixin, unittest.TestCase):
Expand Down
8 changes: 8 additions & 0 deletions tests/models/reformer/test_modeling_reformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@ def _check_hidden_states_for_generate(
[expected_shape] * len(iter_hidden_states),
)

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


@require_torch
class ReformerLSHAttnModelTest(
Expand Down Expand Up @@ -839,6 +843,10 @@ def test_problem_types(self):
def test_past_key_values_format(self):
pass

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


@require_torch
@require_sentencepiece
Expand Down
4 changes: 4 additions & 0 deletions tests/models/transfo_xl/test_modeling_transfo_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ def _mock_init_weights(self, module):
weight = getattr(module, param)
weight.data.fill_(3)

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass


@require_torch
class TransfoXLModelLanguageGenerationTest(unittest.TestCase):
Expand Down
4 changes: 4 additions & 0 deletions tests/models/trocr/test_modeling_trocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,7 @@ def test_decoder_model_past(self):
# decoder cannot keep gradients
def test_retain_grad_hidden_states_attentions(self):
return

@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass