If youâve ever needed to move a Hugging Face model to an offline machine, ship it to a colleague, or archive an exact version for reproducibility, youâve probably discovered an annoying detail: a âdownloaded modelâ isnât always a neat folder of files. Depending on how you pull it down, you can end up with symlinks, cache indirection, or a layout that isnât friendly to copying.
A simple, reliable pattern is:
- Download a full repository snapshot as real files (no symlinks).
- Compress that directory into a single tarball you can store or transport anywhere.
Hereâs a clean example using the Hugging Face Hub Python client and tar.
Step 1: Download a full snapshot with real files
The Hugging Face Hub client provides snapshot_download, which can fetch a repository at a specific revision and materialize it locally.
python - <<'PY'
from huggingface_hub import snapshot_download
repo_id = "mistralai/Ministral-3-3B-Instruct-2512" # change me
local_dir = "./hf_repo"
snapshot_download(
repo_id=repo_id,
local_dir=local_dir,
local_dir_use_symlinks=False, # IMPORTANT: makes real files (good for tar)
)
print("Downloaded to", local_dir)
PYWhy local_dir_use_symlinks=False matters
By default, Hugging Face may use symlinks that point into its local cache. Thatâs efficient on your machine, but itâs a trap if you plan to:
- zip/tar the directory,
- copy it to a USB drive,
- upload it to object storage,
- move it to a different computer.
Symlinks can break when the target cache isnât present on the destination system. Setting local_dir_use_symlinks=False forces the download into actual files, so the directory becomes self-contained and portable.
Step 2: Create a compressed tarball
Once your snapshot is in ./hf_repo, package it up:
tar -czf Ministral-3-3B-Instruct-2512.tar.gz -C hf_repo .What this command is doing (in plain English)
tarcreates an archive-c= create-z= gzip compression-f= output filename follows (Ministral-3-3B-Instruct-2512.tar.gz)-C hf_repo= change into thehf_repodirectory first.= archive âeverything in this folderâ
That -C hf_repo . pattern is a subtle best practice: it keeps your archive clean so it extracts into the current directory (or into whatever folder you choose), rather than embedding the whole hf_repo/ path prefix.
Verifying the tarball
Before you ship it off, itâs worth quickly checking that the archive contains what you expect:
tar -tzf Ministral-3-3B-Instruct-2512.tar.gz | headTo test extraction into a new folder:
mkdir -p /tmp/model_test
tar -xzf Ministral-3-3B-Instruct-2512.tar.gz -C /tmp/model_test
ls -la /tmp/model_test | headUsing the snapshot offline
Once extracted, most Hugging Face workflows can load from a local directory path rather than a remote repo ID. For example, you can point your tooling at the extracted folder and avoid network access entirely (often with an offline flag or environment variable depending on your stack).
The important part is that you now have a deterministic, portable bundle: the exact repository snapshot you downloaded, frozen in a single file.
Common gotchas (and how to avoid them)
1) âMy archive is hugeâ
Model repos can be large, and tarballs compress differently depending on file types. Expect modest gains for already-compressed weights (some formats wonât shrink much).
2) âIt downloads different files laterâ
If you care about reproducibility, pin a revision. snapshot_download supports specifying a particular commit hash or tag so you donât accidentally capture a moving target.
3) âMy tar extracts into a weird nested pathâ
Use tar -C hf_repo . like shown above to keep the archive root tidy.
The takeaway
With two commands, you get a robust workflow:
snapshot_download(..., local_dir_use_symlinks=False)to build a self-contained snapshot directory.tar -czf ... -C hf_repo .to package it into a single portable artifact.
This is a practical way to archive models, move them across environments, and ensure you can recreate an exact setup laterâwithout depending on a cache layout or a live network connection.