From 7146b9457c6843385e19645a9edfcf5077e53484 Mon Sep 17 00:00:00 2001 From: codingma Date: Mon, 15 Jul 2024 10:28:07 +0800 Subject: [PATCH] add IN_GITHUB_ACTIONS Former-commit-id: 32c3afdfa18dc9560009b324fdf4f2987fc739a9 --- tests/data/test_template.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/data/test_template.py b/tests/data/test_template.py index 1ce1b0d8..4a0dfaa8 100644 --- a/tests/data/test_template.py +++ b/tests/data/test_template.py @@ -26,6 +26,7 @@ if TYPE_CHECKING: HF_TOKEN = os.environ.get("HF_TOKEN", None) +IN_GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true" TINY_LLAMA = os.environ.get("TINY_LLAMA", "llamafactory/tiny-random-Llama-3") @@ -121,7 +122,7 @@ def test_jinja_template(use_fast: bool): assert tokenizer.apply_chat_template(MESSAGES) == ref_tokenizer.apply_chat_template(MESSAGES) -@pytest.mark.skipif(HF_TOKEN is None, reason="Gated model.") +@pytest.mark.skipif(IN_GITHUB_ACTIONS or HF_TOKEN is None, reason="Gated model.") def test_gemma_template(): prompt_str = ( "user\nHow are you\n" @@ -133,7 +134,7 @@ def test_gemma_template(): _check_template("google/gemma-2-9b-it", "gemma", prompt_str, answer_str, extra_str="\n") -@pytest.mark.skipif(HF_TOKEN is None, reason="Gated model.") +@pytest.mark.skipif(IN_GITHUB_ACTIONS or HF_TOKEN is None, reason="Gated model.") def test_llama3_template(): prompt_str = ( "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHow are you<|eot_id|>"