Skip to main content

Module cache

Module cache 

Source
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§

CacheFileUsage
Per-file disk usage entry within a cached repository.
CachedModelSummary
Summary of a single cached model (local-only, no API calls).
FamilyEntry
One repository inside a cached family, with optional quantization label.
FileVerification
Result of verifying a single cached file against HuggingFace LFS metadata.
PartialFile
A .chunked.part temp file left by an interrupted chunked download.
RepoStatus
Cache status report for a repository.
Snapshot
On-disk record of the arguments that produced a cached repository.

Enums§

FileStatus
Status of a single file in the cache.
VerifyEvent
Streaming progress event emitted by verify_cache_with_progress so callers can render per-file feedback during a long verification.
VerifyStatus
Verification status for a single cached file.

Constants§

SNAPSHOT_FILENAME
Filename of the per-repo hf-fm snapshot sidecar.
SNAPSHOT_VERSION
Schema version of the on-disk Snapshot file. 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.part temp files in the HuggingFace cache.
hf_cache_dir
Returns the HuggingFace Hub 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 Snapshot sidecar 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.part temp 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_FILENAME sidecar for a given repository cache directory.
verify_cache
Verifies SHA256 digests of cached files against HuggingFace LFS metadata.
verify_cache_with_progress
Same as verify_cache but emits VerifyEvents through on_event so callers can render streaming progress (e.g. a spinner per file).
write_snapshot
Writes the Snapshot sidecar for a repository, atomically (write to a .tmp sibling, then rename).