Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughLocal-only cache lookup now resolves the requested cached snapshot before validating metadata. When the snapshot belongs to the selected source’s cache, validation checks metadata for that revision. The function returns the resolved path after successful checks or raises the saved resolution error. Tests cover revision selection, selected and unselected revision corruption, unresolved revisions, legacy-cased cache fallback, online redownload, and Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change; it is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
files_metadata.jsonis stored at the repository-cache level and can describe a different snapshot from the one the caller is loading. The offline check currently validates every recorded model file before asking the hub which snapshot to use. A truncated file in an old snapshot can therefore prevent an intact current snapshot from loading, including withlocal_files_only=True.Resolve the cached snapshot first and ignore metadata explicitly scoped to other revisions. Keep checking the selected snapshot and legacy unscoped entries. If snapshot resolution fails, preserve the existing corruption error so
download_modelcan still request a forced re-download. Standalonelocal_dirresults retain their existing behavior.This complements #780, which limits metadata collection after an online download. The regression here occurs in the offline verification path.
Tests use tiny local cache fixtures and real Hugging Face cache resolution, with no model downloads. They cover main, named refs, pinned revisions, old-only and mixed metadata, selected-snapshot corruption, missing refs, forced re-downloads, legacy repository casing, and standalone directories.
Validation:
Tested on Python 3.12 / Linux with huggingface_hub 1.33.0. The full model-download/inference suite and platform matrix were not run locally.
All Submissions