Skip to content

Commit

Permalink
Fix: Skip tests, if xlstm library is not installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpoeppel committed Dec 21, 2024
1 parent f2e77c0 commit 869f52a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/models/xlstm/test_modeling_xlstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from transformers import AutoTokenizer, is_torch_available, xLSTMConfig
from transformers.testing_utils import require_read_token, require_torch, require_torch_gpu, slow, torch_device
from transformers.utils import is_xlstm_available

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
Expand Down Expand Up @@ -163,6 +164,7 @@ def prepare_config_and_inputs_for_common(self):
@unittest.skipIf(
not is_torch_greater_or_equal_than_2_2, reason="See https://github.com/huggingface/transformers/pull/24204"
)
@unittest.skipIf(not is_xlstm_available(), reason="xlstm needs to be installed for tests to work")
@require_torch
class xLSTMModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (xLSTMModel, xLSTMForCausalLM) if is_torch_available() else ()
Expand Down Expand Up @@ -279,6 +281,7 @@ def recursive_check(tuple_object, dict_object):
check_equivalence(model, tuple_inputs, dict_inputs, {"output_hidden_states": True})


@unittest.skipIf(not is_xlstm_available(), reason="xlstm needs to be installed for tests to work")
@require_torch
@slow
@require_read_token
Expand Down

0 comments on commit 869f52a

Please sign in to comment.