Export WEIGHTS_ALLOW_PATTERNS for offline pre-caches

The runtime's _weights_dir resolves the Hub snapshot offline through an
inline allow_patterns list, so a deployment that pre-caches the snapshot
for HF_HUB_OFFLINE=1 had to re-list the files by hand and silently
drifted when a release added one: the offline resolution then failed on
a four-fifths-present cache even though every missing piece had its own
fallback. Export the exact runtime request list as one public name, use
it in _weights_dir, and pin the seam with a test that captures the
snapshot_download call. Document the contract in photo-classify.md and
module-internals.md.
This commit is contained in:
Victor Kuznetsov committed 2026-09-07 11:31:08 -07:00
1 parent c0fec5de19
commit 7ddd2097bd
4 files changed
+49 -3

No files matched your search

+5 -1
View File
@@ -45,7 +45,11 @@ Weights are not in git. First call downloads
at the freeze revision pinned in `classify.py`, or reads
`RAIW_CLASSIFY_WEIGHTS` if that directory already has `clip-l-ft.pt`,
`probe-weights-clip-l-ft.npz`, `detector.pt`, and `provider.pt`. The training
catalog is not published with the package.
catalog is not published with the package. Deployments that pre-cache the
snapshot for offline resolution must request exactly
`classify.WEIGHTS_ALLOW_PATTERNS` (the runtime resolves that same list under
`HF_HUB_OFFLINE=1`; a partial pre-cache fails the whole resolution, even for
files the runtime would fall back on).
## What one call returns