Skip to content

fix(tests): skip tokenizer tests for only gated model in fork prs #2268

Merged
lianakoleva merged 9 commits into
Lightning-AI:mainfrom
bhimrazy:fix/tokenizer-registry-fallback
Jun 23, 2026
Merged

fix(tests): skip tokenizer tests for only gated model in fork prs #2268
lianakoleva merged 9 commits into
Lightning-AI:mainfrom
bhimrazy:fix/tokenizer-registry-fallback

Conversation

@bhimrazy

@bhimrazy bhimrazy commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

This PR introduces a mechanism to skip the test_tokenizer_against_hf test for gated models in fork-based PRs. Instead of blocking the entire PR due to failures in this test, it allows the test to be skipped when running in a fork context.

This helps unblock unrelated PRs that are not dependent on gated models.

Test from upstream pr for the same change: #2269

Note: This is likely to be addressed more permanently with Lightning Registry models. see #2262

bhimrazy added 2 commits June 17, 2026 23:30
AutoTokenizer.from_pretrained raises a bare OSError for gated repos,
which _is_gated_hf_error doesn't recognise — causing the test to fail
and retry 3×120s per model (6 min each) until the 35-min job times out.

Switch to huggingface_hub.snapshot_download with allow_patterns limited
to tokenizer/config files (no weights, no safetensors). It raises the
typed GatedRepoError that the existing skip check already handles, so
fork PRs without HF_TOKEN skip cleanly in seconds. Using the default HF
cache (no local_dir) also means retries and CI caching reuse downloads.
pytest 9 removed the `path` argument from the pytest_collect_file
hookspec. pytest-check-links 0.9.1 still declares the old signature,
causing a PluginValidationError on startup. The uv migration (Lightning-AI#2257)
un-pinned pytest, which let 9.x get resolved. Pin to <9 until
pytest-check-links ships a compatible release.
@bhimrazy bhimrazy changed the title fix(tests): skip tokenizer tests for gated model fix(tests): skip gated tokenizer tests and fix check-links CI Jun 17, 2026
@bhimrazy bhimrazy changed the title fix(tests): skip gated tokenizer tests and fix check-links CI fix(tests): skip tokenizer tests for gated model Jun 17, 2026
bhimrazy added 2 commits June 18, 2026 14:10
Fork PRs have no HF_TOKEN, so 6 parallel CI jobs hit HF anonymously and
get rate-limited (HTTP 429). The HfHubHTTPError wasn't caught, causing
each rate-limited model to fail and retry 3x120s until the job timed out.

Extend the skip check to include 429 and rename to _is_hf_skip_error to
reflect that it now covers both gated repos and anonymous rate-limits.
@bhimrazy bhimrazy changed the title fix(tests): skip tokenizer tests for gated model fix(tests): skip tokenizer tests for only gated model in fork prs Jun 18, 2026
bhimrazy added 3 commits June 23, 2026 11:23
snapshot_download returns a commit-hash path; litgpt's Tokenizer infers
BOS from the directory name (SmolLM2-*-Instruct, Llama-3*, etc.) so
symlink the cached files into tmp_path/<model-name> to preserve that.

Also temporarily scope pytester to test_tokenizer.py for faster CI
iteration while this is being validated.
CI sets a relative HF_HOME (.cache-HF), so snapshot_download returns a
relative path; symlinking from the test's tmp_path produced dangling
links and every tokenizer test failed. Copy the small tokenizer/config
files into the model-named dir instead — robust regardless of HF_HOME.
Drop the check-links and cpu-tests.yml edits (check-links fix lives in a
separate PR; restore the full CPU test suite) and trim the tokenizer test
comments to the essentials.
@bhimrazy bhimrazy changed the title fix(tests): skip tokenizer tests for only gated model in fork prs fix(tests): robust tokenizer tests — skip gated models, fix BOS dir for public ones Jun 23, 2026
@bhimrazy

Copy link
Copy Markdown
Collaborator Author

requires #2270

@bhimrazy bhimrazy changed the title fix(tests): robust tokenizer tests — skip gated models, fix BOS dir for public ones fix(tests): skip tokenizer tests for only gated model in fork prs Jun 23, 2026
@lianakoleva
lianakoleva merged commit 153d04c into Lightning-AI:main Jun 23, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants