Repository navigation
CI: share the gemma-3-270m-it model cache across Linux, macOS and Windows - #8068
Conversation
…dows
The tree under hf-cache is byte-identical on all three runners, so the
runner.os prefix in the key only ever bought three copies of the same
254 MiB download. Drop it, bump v2 -> v3, and set enableCrossOsArchive
so Windows can join the same entry.
Also require hashFiles('hf-cache/**/*.gguf') != '' before saving: a
shared key means a bad save now poisons three OSes, not one.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f39f1768fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with: | ||
| path: hf-cache | ||
| key: ${{ runner.os }}-hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-v2 | ||
| key: hf-${{ env.GGUF_REPO }}-${{ env.GGUF_VARIANT }}-v3 |
There was a problem hiding this comment.
Include the validation GGUF in every shared-cache producer
When the prompt-cache job wins the main-branch save race, this shared key contains only the Gemma GGUF because its prime step downloads no ggml-org/models/tinyllamas/stories260K.gguf. The API/UI and macOS/Windows workflows use the same immutable key, treat that restore as a hit, and skip their prime steps that explicitly add stories260K; their installer then has to fetch the validation model live (studio/install_llama_prebuilt.py:7049-7051), so an HF outage or transient download failure can break jobs that otherwise restored successfully. Add the validation GGUF here as well, or keep producers with different payloads on separate keys.
Useful? React with 👍 / 👎.
|
Source-level confirmation of why the staging results above come out the way they do, for anyone The key really is the only thing that was splitting these. Why Linux and macOS already matched without the flag. const versionOutput = await getVersion('zstd', ['--quiet'])
...
if (versionOutput === '') { return CompressionMethod.Gzip }
else { return CompressionMethod.ZstdWithoutLong }zstd present at any version gives
Why the snapshot symlink survives the round trip. There is no One caveat that is worth writing down even though it does not affect this PR. The reason the hub layout is portable is that every name it generates is content-derived or a So the general statement "an HF_HOME cache is cross-OS portable" is only true for repos whose |
What
One
actions/cacheentry for the gemma-3-270m-it model instead of three.Every job that primes
HF_HOMEwithunsloth/gemma-3-270m-it-GGUF/UD-Q4_K_XLalreadyused the identical
path: hf-cache. The only thing splitting them into three separate cacheentries was
${{ runner.os }}at the front of the key. This drops it, bumpsv2->v3, andsets
enableCrossOsArchive: trueso Windows can join the same entry.Ten cache steps across nine jobs now resolve to one key,
hf-unsloth/gemma-3-270m-it-GGUF-UD-Q4_K_XL-v3:studio-api-smoke/ api-smokestudio-ui-smoke/ ui-smokestudio-inference-smoke/ openai-anthropiclocal-agent-guides-ci/ prompt-cachestudio-mac-ui-smoke/ ui-smokestudio-mac-inference-smoke/ inference-smoke (phase 1)studio-windows-api-smoke/ api-smokestudio-windows-ui-smoke/ ui-smokestudio-windows-inference-smoke/ inference-smoke (phase 1)studio-windows-inference-smoke/ no-vs-cpuLive caches on
maintoday holdLinux-hf-...,macOS-hf-...andWindows-hf-...for thismodel, 0.22 GiB each, byte-identical.
Why this is safe: the payload really is identical
I did not infer this from the toolkit source. I ran a probe on a staging repo that downloads
this exact model on
ubuntu-latest,macos-15andwindows-latestand dumps a sortedinventory of everything under
hf-cachewith per-file sha256, symlink targets, and a checkfor Windows-illegal characters.
All three OSes produce the same tree:
Both are content-derived, so both are OS-independent.
WIN_NAME_PROBLEMS=0andCASE_COLLISIONS=0on all three: no: ? * < > | ", no trailingdot or space, no reserved device name, no case-only collisions. The GGUF and hub filenames
are already cross-OS safe as they stand.
there identically rather than degraded to a copy.
The three entries that do vary are not content:
hub/CACHEDIR.TAGis 191 bytes onLinux/macOS and 195 on Windows (CRLF), the
hub/.locks/*.lockplaceholder is absent onWindows, and
xet/logs/xet_<timestamp>_<pid>.logis per-run noise. None of them is read backby
huggingface_hub, and a single shared entry means only one of the three variants is everstored anyway.
Empirical proof of the cross-OS restore
The same probe saves on one OS and restores on another. Run:
https://github.com/danielhanchen/unsloth-staging-2/actions/runs/31141007275
enableCrossOsArchiveCache restored from key: xosprobe-g1-flatCache not found for input keys: xosprobe-g1-flattrueCache restored from key: xosprobe-g1-flatxtrueCache restored from key: xosprobe-g1-flatxtrueCache restored from key: xosprobe-g1-hftrueCache restored from key: xosprobe-g1-hftrueCache restored from key: xosprobe-g1-winsaveLinux and macOS share with no flag at all (both runners have zstd 1.5.7 on
PATH, so bothcompute the same compression component of the cache version hash). Windows needs
enableCrossOsArchive: trueand then works in both directions; it extracts with"C:\Program Files\Git\usr\bin\tar.exe" ... --force-local --use-compress-program "zstd -d".After the cross-OS restore on Windows, the relative snapshot symlink is intact and
huggingface_hubresolves the model offline from the Linux-written tree:Same on macOS. The restored inventories on macOS and Windows are 21-for-21 identical to the
Linux one that produced them, including every sha256.
Cost
pathis unchanged, so this is a pure key rename. The new key is cold, and prefixrestore-keyscannot rescue it (the old keys have the OS as a prefix, so nothing matches).The first
mainrun after merge therefore re-downloads 254 MiB once per OS, about 10 s eachon the runners I measured, then one of them saves and the other two log the benign
"Unable to reserve cache with key ... another job may be creating this cache" they already log
today when two Linux workflows race for the same key.
Steady state: one 0.22 GiB entry instead of three, and macOS/Windows jobs now restore from
whatever the far more frequent Linux workflows seeded, which is the real win here.
Also in this change
The save gates gain
hashFiles('hf-cache/**/*.gguf') != ''. With a per-OS key a bad save onlyhurt that OS; with a shared key it would poison all three, so the saves now require an actual
.ggufto be present.studio-mac-inference-smokealready had this guard and keeps its!= 'skipped'semantics so a partial, resumable download still gets stored.Deliberately not changed
The other five cache families are single-OS and have nothing to share with:
gemma-4-E4B-it(Linux only, 4.6 GiB),gemma-4-E2B-it+ mmproj (macOS only, 3.26 GiB),Qwen3-VL-2B-InstructUD-Q4_K_XL + mmproj (Linux only, 1.62 GiB) andQwen3-VL-2B-InstructUD-IQ2_XXS + mmproj (Windows only, 1.14 GiB). Renaming their keys wouldbuy a cold re-download and no sharing. The two Qwen3-VL entries are the same repo at different
quants, so they are not interchangeable either.