tests-and-cache
Skill608 starsChanged 34 days agoApache-2.0View on GitHub
Run, write, and fix OpenVINO GenAI Python and WWB tests, and set up their Hugging Face / OpenVINO model and dataset caches. Use when: running tests/python_tests or tools/who_what_benchmark/tests locally, adding a test that downloads a model/dataset/adapter from the Hugging Face Hub, fixing tests that fail because a Hub resource can't be found in the local cache, warming or debugging CI caches, adding a test entry to the CI test matrices.
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Every Hub access must resolve to files stored in $HF_HOME/hub so that a warm cache is enough to run the test without network access.
- Very specific: line 37
Don't use hf_hub_download(..., local_dir=tmp_path).
- Very specific: line 49
Don't call datasets.load_dataset("org/name", ...) with a Hub id, with or without streaming=True.
- Very specific: line 60
Run the new or changed test once with network access and the same HF_HOME CI uses (/mount/caches/huggingface/lin on Linux, …
- Very specific: line 62
Check what was cached: ls $HF_HOME/hub/{models,datasets}--<org>--<name>/snapshots/*/.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tests and Their Caches
Layout
| What | Where |
| Python API tests | tests/python_tests/ (helpers in tests/python_tests/utils/) |
| Sample tests | tests/python_tests/samples/ |
| WWB tests | tools/who_what_benchmark/tests/ (helpers in conftest.py, ov_utils.py) |
| WWB default datasets | tools/who_what_benchmark/whowhatbench/*_evaluator.py, whowhatbench/utils.py |
| CI test matrices | .github/workflows/test_matrices/<platform>/{wheel_tests,samples_tests}.yml |
Caches
| Variable | Content | Notes |
HF_HOME | Hugging Face Hub cache ($HF_HOME/hub): models, dataset files, adapters | Persistent shared mount in CI. This is the only cache tests may rely on for Hub resources. |
HF_DATASETS_CACHE | datasets Arrow cache and dataset modules | In CI it points to /tmp and is not persistent. Never rely on it. |
OV_CACHE | Converted OpenVINO models (<OV_CACHE>/<YYYYMMDD>/optimum-intel-<ver>_transformers-<ver>/{downloaded_models,converted_models}) | Unset means a temporary directory per session. The date and version subfolders make it rebuild daily and on dependency bumps. |
CLEANUP_CACHE | Removes the OV_CACHE session directory after the run | Doesn't touch HF_HOME. |
Converted-model helpers: utils.hugging_face.download_and_convert_model(), utils.constants.get_ov_cache_converted_models_dir(), and the WWB conftest.convert_model(). They write through AtomicDownloadManager so parallel jobs never see partial directories.
Rules for Hub Resources in Tests
Every Hub access must resolve to files stored in $HF_HOME/hub so that a warm cache is enough to run the test without network access.
Models and single files
- Models:
snapshot_download(model_id)wrapped inretry_request(...)(utils.network/ WWBov_utils). Pass the returned path tofrom_pretrained,optimum-cli, or GenAI pipelines. - Single files (LoRA adapters, GGUF, JSON):
snapshot_download(repo_id, allow_patterns=[filename]), thenPath(result) / filename. - Don't use
hf_hub_download(..., local_dir=tmp_path). It bypasses the shared cache and downloads again on every run. - Pin a revision with the full 40-char commit hash. Short hashes and branch names can't be resolved from the cache alone.
Datasets
Pick the helper by dataset size:
| Case | Helper |
| Small dataset, whole repo is fine | utils.dataset_utils.load_dataset_via_snapshot(repo_id, config, split=...) |
| Large or sharded dataset: fetch only the needed parquet files | utils.dataset_utils.load_parquet_dataset_via_snapshot(repo_id, {"<split>": "<repo-relative glob>"}, revision=..., split=..., streaming=...) |
- Don't call
datasets.load_dataset("org/name", ...)with a Hub id, with or withoutstreaming=True. It resolves through the Hub API andHF_DATASETS_CACHE. - Find the files a config/split maps to with
datasets.load_dataset_builder(repo_id, config).config.data_files. Many script-less repos keep them under<config>/<split>-*.parquet,data/<split>-*, orparquet-data/<config>/<split>-*. - A partial snapshot plus
load_dataset(<snapshot dir>)fails withDataFilesNotFoundErrorwhen the README declares configs whose files weren't downloaded. Load through the"parquet"/"json"builder with explicitdata_files, or point at the split subdirectory. shuffle(seed)over many shards reorders shards, so loading only a subset of shards changes the selected samples.
Diffusers LoRA
pipe.load_lora_weights(<file>) can't guess weight_name without Hub access. Pass the parent directory plus weight_name=<file name>.
Warming and Verifying the Cache
- Run the new or changed test once with network access and the same
HF_HOMECI uses (/mount/caches/huggingface/linon Linux,C:/mount/caches/huggingface/winon Windows). This populates$HF_HOME/hub. - Re-run it with network access disabled. It must pass using only cached files.
- Check what was cached:
ls $HF_HOME/hub/{models,datasets}--<org>--<name>/snapshots/*/. - macOS CI uses per-run, non-persistent
HF_HOMEdirectories, so nothing is warm there.
Known Pitfalls
tqdm==4.70.0:thread_mapfails on generators. That makessnapshot_downloadraiseValueError: min() arg is an empty sequenceon the first download from repos with >1000 files (e.g.facebook/multilingual_librispeech,google/fleurs,lmms-lab/LLaVA-Video-178K).tests/python_tests/requirements.txtpinstqdm==4.69.1because whowhatbench caps tqdm at<=4.70.0.- Errors that mean a resource is missing from
$HF_HOME/hub:LocalEntryNotFoundError,ConnectionError: Couldn't reach '<repo>' on the Hub (OfflineModeIsEnabled),ValueError: When using the offline mode, you must specify a weight_name. Fix the test to go through the cache as described above instead of retrying. - WWB tests run
wwbin a subprocess. The real error is in the captured output afterERROR:conftest:'wwb ...' returned 1. Output:, not in theCalledProcessErrorline. - A module-scoped fixture failure is reported once with its output. Later tests that use the same fixture only show the cached
CalledProcessError.
In this repository8 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- generate-release-notesSkill
- llm-bench-fail-analyzerSkill
- model-checkerSkill
- open-prSkill
- update-docsSkill
- vlm-model-enablerSkill
- wwb-fail-analyzerSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

