Expand description
HuggingFace cache directory resolution, model family scanning, disk usage,
and integrity verification.
hf_cache_dir() locates the local HF cache. list_cached_families()
scans downloaded models and groups them by model_type.
cache_summary() provides per-repo size totals,
cache_repo_usage() returns per-file disk usage for a single repo, and
verify_cache() re-checks SHA256 digests of cached files against
HuggingFace LFS metadata.
Structs§
- Cache
File Usage - Per-file disk usage entry within a cached repository.
- Cached
Model Summary - Summary of a single cached model (local-only, no API calls).
- Family
Entry - One repository inside a cached family, with optional quantization label.
- File
Verification - Result of verifying a single cached file against
HuggingFaceLFS metadata. - Partial
File - A
.chunked.parttemp file left by an interrupted chunked download. - Repo
Status - Cache status report for a repository.
- Snapshot
- On-disk record of the arguments that produced a cached repository.
Enums§
- File
Status - Status of a single file in the cache.
- Verify
Event - Streaming progress event emitted by
verify_cache_with_progressso callers can render per-file feedback during a long verification. - Verify
Status - Verification status for a single cached file.
Constants§
- SNAPSHOT_
FILENAME - Filename of the per-repo
hf-fmsnapshot sidecar. - SNAPSHOT_
VERSION - Schema version of the on-disk
Snapshotfile. Bumped on incompatible changes.
Functions§
- cache_
repo_ usage - Returns per-file disk usage for a specific cached repository.
- cache_
summary - Scans the entire HF cache and returns a summary for each cached model.
- find_
partial_ files - Finds all
.chunked.parttemp files in theHuggingFacecache. - hf_
cache_ dir - Returns the
HuggingFaceHub cache directory. - list_
cached_ families - Scans the local HF cache for downloaded models and groups them by
model_type. - read_
ref - Reads the commit hash from a refs file, if it exists.
- read_
snapshot - Reads the per-repo
Snapshotsidecar if it exists. - repo_
disk_ usage - Returns the file count and total size for a single cached repo.
- repo_
has_ partial - Checks whether a single cached repo has
.chunked.parttemp files. - repo_
status - Inspects the local cache for a repository and compares against the remote file list.
- snapshot_
path - Returns the absolute path of the
SNAPSHOT_FILENAMEsidecar for a given repository cache directory. - verify_
cache - Verifies
SHA256digests of cached files againstHuggingFaceLFS metadata. - verify_
cache_ with_ progress - Same as
verify_cachebut emitsVerifyEvents throughon_eventso callers can render streaming progress (e.g. a spinner per file). - write_
snapshot - Writes the
Snapshotsidecar for a repository, atomically (write to a.tmpsibling, then rename).