Skip to main content

Module cache_layout

Module cache_layout 

Source
Expand description

Centralized hf-hub cache path construction.

All paths follow the hf-hub 0.5 cache layout: {cache_root}/models--org--name/{snapshots,blobs,refs}/...

This module is the single source of truth for cache directory structure. When hf-hub bumps, update this module and rerun the cache_layout_matches_hf_hub integration test.

Functionsยง

blob_path
Blob path: {repo_dir}/blobs/{etag}.
blobs_dir
Blobs directory: {repo_dir}/blobs/.
pointer_path
Pointer path: {repo_dir}/snapshots/{commit_hash}/{filename}.
ref_path
Ref file path: {repo_dir}/refs/{revision}.
refs_dir
Refs directory: {repo_dir}/refs/.
repo_dir
Repo root directory: {cache_root}/models--org--name/.
repo_folder_name
Repo folder name: "models--org--name".
snapshot_dir
Snapshot directory for a specific commit: {repo_dir}/snapshots/{commit_hash}/.
snapshots_dir
Snapshots directory: {repo_dir}/snapshots/.
temp_blob_path
Temp blob path for chunked downloads: {repo_dir}/blobs/{etag}.chunked.part.