[CLI] Support hf:// URIs in cache rm#4235
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4235 +/- ##
==========================================
+ Coverage 75.00% 77.20% +2.19%
==========================================
Files 145 171 +26
Lines 13978 19437 +5459
==========================================
+ Hits 10484 15006 +4522
- Misses 3494 4431 +937 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@bot /style |
|
x-linking initial comment #4226 (comment) |
Wauplin
left a comment
There was a problem hiding this comment.
Looks good, thank you :)
Note that for the second PR we've discussed (being able to delete specific file), I'll prefer to handle it myself as I'll be a bit opinionated on how we want to deal with it
|
This PR has been shipped as part of the v1.16.0 release. |
Summary
hf://URIs inhf cache rmparse_hf_urihelper introduced in [Core] Migrate hf:// URI parsing to centralized parse_hf_uri #4189Example:
For now this only supports repo-level URIs like hf://models/openai-community/gpt2. Follow-up PRs can expand this to revisions and filenames...
Validation:
make style
make quality
PYTHONPATH=src python3 -m pytest tests/test_cli.py::TestCacheCommand
tests/test_cli.py::TestCacheCommand passes locally.
Full tests/test_cli.py hits unrelated network/DNS failures in production-style tests.
Note
Medium Risk
Extends cache-deletion target parsing to accept
hf://inputs; while scoped to repo-level URIs and covered by new tests, mistakes could cause unintended cache removals if URI-to-cache-id resolution is wrong.Overview
hf cache rmnow accepts repo-levelhf://URIs (e.g.hf://models/openai-community/gpt2) in addition tomodel/...IDs and revision hashes by resolving URIs viaparse_hf_uri.The command explicitly rejects non-repo URIs (e.g. buckets) and any
hf://URI that includes a revision (@...) or a path, and the CLI docs/reference plus tests were updated to reflect and validate this behavior.Reviewed by Cursor Bugbot for commit 08c0c40. Bugbot is set up for automated code reviews on this repo. Configure here.