diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 8ec5ac8f..73f42bdf 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -65,6 +65,30 @@ jobs: run: | python -m pip list --format=columns + - name: Cache Qwen tokenizer vocab + uses: actions/cache@v4 + with: + path: ~/.cache/dashscope/tokenizers + key: qwen-tokenizer-vocab-v1 + + # ModelScope downloads from GitHub runners time out intermittently; + # pre-fetch with retries so network blips don't fail the test matrix. + - name: Pre-download Qwen tokenizer vocab + run: | + python - <<'EOF' + import time + from dashscope.legacy_1x.tokenizers import tokenizer as t + for attempt in range(1, 6): + try: + print("vocab ready:", t._resolve_vocab_path()) + break + except RuntimeError as exc: + print(f"attempt {attempt}/5 failed: {exc}") + if attempt == 5: + raise SystemExit(1) + time.sleep(5 * attempt) + EOF + - name: Run current tests with coverage run: | coverage run -m pytest tests --ignore=tests/legacy_1x @@ -113,6 +137,30 @@ jobs: pip install -r requirements.txt pip install -r requirements-test.txt + - name: Cache Qwen tokenizer vocab + uses: actions/cache@v4 + with: + path: ~/.cache/dashscope/tokenizers + key: qwen-tokenizer-vocab-v1 + + # ModelScope downloads from GitHub runners time out intermittently; + # pre-fetch with retries so network blips don't fail the test matrix. + - name: Pre-download Qwen tokenizer vocab + run: | + python - <<'EOF' + import time + from dashscope.legacy_1x.tokenizers import tokenizer as t + for attempt in range(1, 6): + try: + print("vocab ready:", t._resolve_vocab_path()) + break + except RuntimeError as exc: + print(f"attempt {attempt}/5 failed: {exc}") + if attempt == 5: + raise SystemExit(1) + time.sleep(5 * attempt) + EOF + - name: Run archived legacy tests run: | python -m pytest tests/legacy_1x