diff --git a/tests/unit/tokenizer/test_cohere_hf_tokenizer.py b/tests/unit/tokenizer/test_cohere_hf_tokenizer.py index 79c5961c..f5f9671d 100644 --- a/tests/unit/tokenizer/test_cohere_hf_tokenizer.py +++ b/tests/unit/tokenizer/test_cohere_hf_tokenizer.py @@ -8,7 +8,14 @@ class TestCohereHFTokenizer(BaseTestTokenizer): @staticmethod @pytest.fixture(scope="class") def tokenizer(): - return CohereHFTokenizer() + try: + tokenizer = CohereHFTokenizer() + except ImportError: + pytest.skip( + "`cohere` extra not installed. Skipping CohereHFTokenizer unit " + "tests" + ) + return tokenizer @staticmethod @pytest.fixture diff --git a/tests/unit/tokenizer/test_llama_tokenizer.py b/tests/unit/tokenizer/test_llama_tokenizer.py index cc0a838f..efd5e7d1 100644 --- a/tests/unit/tokenizer/test_llama_tokenizer.py +++ b/tests/unit/tokenizer/test_llama_tokenizer.py @@ -8,7 +8,14 @@ class TestLlamaTokenizer(BaseTestTokenizer): @staticmethod @pytest.fixture(scope="class") def tokenizer(): - return LlamaTokenizer(model_name="hf-internal-testing/llama-tokenizer") + try: + tokenizer = LlamaTokenizer(model_name="hf-internal-testing/llama-tokenizer") + except ImportError: + pytest.skip( + "`transformers` extra not installed. Skipping LLamaTokenizer unit " + "tests" + ) + return tokenizer @staticmethod @pytest.fixture