Skip to main content

hf-ark

The models your code depends on live on servers Nvidia now owns. Snapshot them before the terms change.

hf-ark finds the Hugging Face models and datasets a codebase (or machine) depends on and snapshots them into a portable, checksummed, offline-usable archive: an "ark". It's deliberately boring under the hood. An ark is a valid huggingface_hub cache directory plus a manifest with checksums and license tags. No custom format. Anything that reads an HF cache can read an ark.

Quickstart

pip install hf-ark
hf-ark snapshot --from . --include-cache
hf-ark verify ./hf-ark

Later, on any machine:

hf-ark restore ./hf-ark
HF_HUB_OFFLINE=1 python your_script.py

What an ark is

An ark is just a huggingface_hub cache directory (models--org--name/, blobs/, snapshots/) plus one ark.json file recording, per repo: the resolved commit sha, license tag, gated status, and a sha256 for every file. hf-ark computes those checksums itself; it doesn't trust the hub's metadata.

Because an ark is a real HF cache, you don't need to restore it anywhere to use it. Point HF_HUB_CACHE straight at it:

HF_HUB_CACHE=/path/to/ark HF_HUB_OFFLINE=1 python your_script.py

hf-ark restore exists for when you'd rather merge an ark into your normal cache location instead.

Commands

  • hf-ark scan [PATHS...] finds HF repo references in your source (from_pretrained(...), hf_hub_download(...), huggingface.co URLs, and an optional hf-ark.txt file). Add --include-cache to also list what's already in your local HF cache, --check to confirm each repo exists on the hub, --json for machine-readable output.
  • hf-ark snapshot [REPO_IDS...] [-o ARK] downloads repos into an ark and records them in ark.json. Takes explicit repo IDs, --from PATHS (runs the scanner), and/or --include-cache. --dry-run prints the download size without writing anything.
  • hf-ark verify ARK recomputes every file's sha256 and checks it against the manifest.
  • hf-ark list ARK prints a table of what's in an ark: repo, type, sha, license, size. No network.
  • hf-ark restore ARK [--target DIR] merges an ark into a local HF cache (default: wherever huggingface_hub already looks).

Run hf-ark <command> --help for the full flag list.

FAQ

Does this redistribute model weights? No. It downloads what you already have access to and stores it under your control. Nothing gets uploaded anywhere.

What about licenses? The manifest records each model's license tag as reported by the hub. The contents stay under their own license. Snapshotting a repo doesn't change what you're allowed to do with it.

Gated models? You still need a token with access (HF_TOKEN, same as huggingface_hub always used). An ark of a gated repo doesn't grant access to anyone else; it's just your already-authorized download saved locally.

Private hub / mirror? hf-ark respects HF_ENDPOINT, same as huggingface_hub.

Is Hugging Face actually going to break? Nobody knows. That's the point. Snapshots are cheap insurance either way.

Not this

hf-ark isn't a mirror server (see olah for that), a torrent client, or a package manager. It snapshots and restores. That's it.

License

MIT

Metadata

Release files for hf-ark 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hf-ark 0.1.0
File Size Uploaded
hf_ark-0.1.0.tar.gz 25.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hf-ark 0.1.0
File Interpreter ABI Platform
hf_ark-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.0 kB

Release files / hf_ark-0.1.0.tar.gz

Download URL hf_ark-0.1.0.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e40899e53819de5c0f081bf744bd65484622aba56f831167e5267064f569e99c
BLAKE2b-256 checksum
How to use checksums
35ae9265dfd807b95ba810ba8259e2df23750b800e2a7381186f8ccc54f42247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / hf_ark-0.1.0-py3-none-any.whl

Download URL hf_ark-0.1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94c7cf4eb6f9f079eb48e972885c1d45e85f71eac0d9a51c58a4de2e1f03de64
BLAKE2b-256 checksum
How to use checksums
b209110bbf0d0c12d28b5e5a8ea2c8ecc349c97da5745b6408833463dbbf03b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page