Skip to content
Merged
Changes from all commits
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
17 changes: 16 additions & 1 deletion tests/models/longformer/test_modeling_longformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
import unittest

from transformers import LongformerConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from transformers.testing_utils import (
is_flaky,
require_sentencepiece,
require_tokenizers,
require_torch,
slow,
torch_device,
)

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
Expand Down Expand Up @@ -355,6 +362,14 @@ def setUp(self):
self.model_tester = LongformerModelTester(self)
self.config_tester = ConfigTester(self, config_class=LongformerConfig, hidden_size=37)

# Without this, 0.01% failure rate.
@is_flaky(
max_attempts=2,
description="When `inputs_dict['attention_mask'][:, -1]` is all `0`s, we get shorter length along the last dimension of the output's `attentions`.",
)
def test_attention_outputs(self):
super().test_attention_outputs()

def test_config(self):
self.config_tester.run_common_tests()

Expand Down