siam-thai/sak-family-agent/sakthai-hf-snapshot-download-and-cache-management
Claude Code and agent skill by siam-thai/sak-family-agent
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
'Hugging Face Hub: snapshot_download, cache locations, revision locking,
Install
npx vskill@latest install siam-thai/sak-family-agent/sakthai-hf-snapshot-download-and-cache-managementSKILL.md
The same SKILL.md was published earlier as siam-thai/sak-family-agent/sakthai-hf-snapshot-download-and-cache-management.
Hugging Face Hub: snapshot_download and Cache Management
This skill explains how Hugging Face Hub caching works, how to control where files land, and how to manage disk usage when working with large models or datasets.
Overview
- The
huggingface_hubPython library caches every downloaded model, dataset, or Space on disk. snapshot_download()is the canonical, framework-agnostic way to pull a repository revision into the local cache.- Cache behavior is controlled by environment variables, the
cache_dirargument, and revision pinning.
Default Cache Locations
| OS | Default Path | |
|---|---|---|
| Linux | ~/.cache/huggingface/hub | |
| macOS | ~/Library/Caches/huggingface/hub | |
| Windows | C:\Users\<USER>\.cache\huggingface\hub |
- Set
HF_HOMEto override the root;HF_HUB_CACHEoverrides only thehub/subdirectory. - Example:
HF_HOME=/mnt/data/hf_cachekeeps everything on a mounted volume.
snapshot_download in Practice
- Returns the absolute path to the downloaded snapshot.
- If the revision is already cached, it resolves instantly (hardlinks or copies from cache).
Cache Internals
- Repositories are stored as snapshots keyed by revision SHA.
- Files are deduplicated across snapshots when possible: identical blobs share a single physical copy underneath
blobs/. - A
refs/folder stores branch and tag pointers to revision SHAs.
Disk Management
scan_cache_dir()returns cached repos, last accessed times, and blob sizes.delete_revisions()anddelete_cache()let you prune safely without breaking other snapshots.
LFS Awareness
- Large files (weights, audio, images) use Git LFS pointers;
snapshot_downloadfetches the real LFS content transparently. huggingface-cli repo-info <id> --repo-type modelshows LFS file counts before downloading.- For very large models, consider
max_workersandlocal_dirto keep downloads on a fast drive.
Transfer-Layer Deduplication (XET)
huggingface_hub >= 1.2.2uses the XET protocol for uploads and downloads. XET performs chunk-based deduplication on the wire: identical chunks across different files are transferred and stored only once. See thehf-xetskill.- This is separate from on-disk cache deduplication: XET reduces network traffic and backend storage; the
blobs/cache still deduplicates identical files locally.
Key Facts
snapshot_downloadis revision-safe: storing the commit SHA guarantees reproducibility even if upstream branches move.- Cache deduplication means disk impact is usually far smaller than the sum of repo sizes when multiple models share weights.
HF_HOME,HF_HUB_CACHE, andTRANSFORMERS_CACHE/HF_ASSETS_CACHEcan be combined to route models, tokenizer assets, and datasets to different disks.- Deletion is soft by design: you can prune snapshots or blobs without removing metadata for other working copies.
allow_patterns/ignore_patternsinsnapshot_downloadmake it practical to fetch only config and tokenizer files for inspection.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpersonas/sakthai/skills/SakThai-hf-snapshot-download-and-cache-management/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/siam-thai/sak-family-agent/sakthai-hf-snapshot-download-and-cache-management)