Mirror a Hugging Face model
Keep your own copy of a huggingface.co model on Hippius Hub. A mirror in your namespace stays where you put it: you choose when it changes, you can make it private, and your code loads it with the same transformers call as before. This page takes you from nothing to a checked copy, then shows how to keep it in sync.
archive namespace firstHippius already mirrors many well-known open models into the public archive namespace, under their upstream names and with the same commit ids: Qwen/Qwen3-0.6B on huggingface.co is archive/Qwen3-0.6B here. If the model you want is there and you don't need your own copy, use it directly and skip this page.
Choose how to copy
There are two ways. Both use only standard tools and a hip_ key.
| Copy the files (recommended) | Copy the git history | |
|---|---|---|
| What you get | One new commit holding the upstream files at the revision you chose | The same commits as upstream, with the same commit ids |
| What it downloads | The files at one revision | Every version of every large file in the history |
| Good for | Any model, any size | Small and medium repos, when you need upstream commit ids to resolve on your copy |
| Tools | huggingface_hub (the hf CLI) | git, git-lfs, and hf to create the repo |
The archive mirror is made by a server-side tool that only Hippius runs. Accounts cannot start it or write into archive. The two ways below are what your key can do.
Before you start
- An account and a namespace. Your namespace is the first half of the new repo id (
my-namespace/Qwen3-0.6B). Create it on the console's Hub page. The Free plan needs a balance of at least $10 before the first namespace. See Before you push. - A key that can write to your namespace. In the console, open Hub → Manage → Hub keys and create a key with Scoped access, permission Write, and your namespace. Leave Repository empty: the mirror repo doesn't exist yet, and a key limited to one repo cannot create it. If your console doesn't show Hub keys yet, use an S3 master token as a full key,
<access key id>:<secret key>(the access key id already starts withhip_, as inhip_AbC123:SECRET). See CLI and keys. - The tools. Python 3.10 or later and
pip install -U huggingface_hub. These steps were checked withhf2.5.0. For the git way, alsogit-lfs(git lfs version). - For a gated or private model on huggingface.co only: a Hugging Face token (
hf_…) with read access to it. See Gated and private models before you copy one.
Keep the two hubs apart
You talk to two hubs with the same hf CLI. Each must get its own endpoint and its own token: Hippius Hub refuses hf_ tokens, and your hip_ key must never be sent to huggingface.co. Two small shell functions do that for every command on this page, each with a cache folder of its own:
# Paste your hip_ key when asked. It is not shown, and it stays out of your shell history.
read -rs HIPPIUS_KEY && export HIPPIUS_KEY
# Only for a gated or private model on huggingface.co: paste an hf_ token.
# read -rs HF_UPSTREAM_TOKEN && export HF_UPSTREAM_TOKEN
# huggingface.co: anonymous, or with HF_UPSTREAM_TOKEN when it is set
hf_up() { HF_ENDPOINT=https://huggingface.co HF_HOME="$HOME/.cache/hf-upstream" HF_TOKEN="${HF_UPSTREAM_TOKEN:-}" hf "$@"; }
# Hippius Hub: always with your hip_ key
hf_hip() { HF_ENDPOINT=https://hub.hippius.com HF_HOME="$HOME/.cache/hippius-hf" HF_TOKEN="$HIPPIUS_KEY" HF_HUB_DISABLE_IMPLICIT_TOKEN= hf "$@"; }
They work in bash and zsh, and they override any HF_TOKEN, HF_ENDPOINT or HF_HOME already set in your shell. Don't run hf auth login with hf_up: the folder ~/.cache/hf-upstream should hold no saved token, so that nothing but HF_UPSTREAM_TOKEN is ever sent to huggingface.co. Check the key before going further:
hf_hip auth whoami
It prints the account your key belongs to. 401 Invalid credentials in Authorization header means the key was pasted wrong, has expired, or was revoked.
Copy the files with hf
The steps use Qwen/Qwen3-0.6B (about 1.5 GB) and the namespace my-namespace. Change both.
1. Name the source, the target, and the revision
SRC=Qwen/Qwen3-0.6B
DST=my-namespace/Qwen3-0.6B
REV=$(hf_up models info "$SRC" --expand sha --format quiet | python3 -c 'import json,sys; print(json.load(sys.stdin)["sha"])')
echo "$REV"
REV is the 40-character commit id of upstream main right now, for example c1899de289a04d12100db370d81485cdf75e47ca. Pinning it means the files you upload are exactly that commit's, even if upstream moves while you copy.
2. Download that revision from huggingface.co
SNAP=$(hf_up download "$SRC" --revision "$REV" --format quiet)
echo "$SNAP"
ls "$SNAP"
SNAP is a folder in the hf_up cache, ~/.cache/hf-upstream/hub/models--Qwen--Qwen3-0.6B/snapshots/<REV>, holding exactly the files of that commit. Run again later, the same command downloads only what changed.
3. Create the repo on Hippius Hub
hf_hip repos create "$DST" # public
# or: hf_hip repos create "$DST" --private
Expected output:
✓ Repo created
repo_id: my-namespace/Qwen3-0.6B
url: https://hub.hippius.com/my-namespace/Qwen3-0.6B
If the repo exists already, add --exist-ok. To keep a gated model gated, read Gated and private models first and create the repo --private.
4. Upload the files
hf_hip upload "$DST" "$SNAP" \
--commit-message "Mirror $SRC at $REV" \
--commit-description "Source: https://huggingface.co/$SRC/tree/$REV"
It ends with ✓ Uploaded and the repo's URL. Large files go up through Xet in chunks. If the upload is interrupted, run the same command again: files already on the Hub are skipped.
5. Tag the upstream revision (optional)
A tag lets you and your users ask for the upstream commit by name:
hf_hip repos tag create "$DST" "upstream-${REV:0:12}"
6. Check the copy
# The files at the top of the repo: the same as upstream
hf_hip models ls "$DST"
# Your commit, with the upstream id in its title
printf "Authorization: Bearer %s\n" "$HIPPIUS_KEY" \
| curl -s -H @- "https://hub.hippius.com/api/models/$DST/commits/main" \
| python3 -c 'import json,sys; c=json.load(sys.stdin)[0]; print(c["id"], c["title"])'
# Download one file back
hf_hip download "$DST" config.json
The commit title reads Mirror Qwen/Qwen3-0.6B at c1899de…. Your copy's commit id is new and differs from upstream's: this way copies files, not history. To load it, set HF_ENDPOINT as on Pull and use the new repo id:
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("my-namespace/Qwen3-0.6B")
For a public repo you can drop the printf and -H @- from the curl above. -H @- reads the header from stdin, so the key stays out of the command line.
Keep it in sync
Repeat steps 1, 2 and 4, with --delete "*" added to the upload so that files deleted upstream are deleted from your copy too:
REV=$(hf_up models info "$SRC" --expand sha --format quiet | python3 -c 'import json,sys; print(json.load(sys.stdin)["sha"])')
SNAP=$(hf_up download "$SRC" --revision "$REV" --format quiet)
hf_hip upload "$DST" "$SNAP" --delete "*" \
--commit-message "Mirror $SRC at $REV" \
--commit-description "Source: https://huggingface.co/$SRC/tree/$REV"
Only changed files are downloaded and uploaded. When nothing changed upstream, huggingface_hub makes no commit. Nothing syncs on its own: run these from a scheduled job of yours if you want the copy to follow upstream.
Copy the git history with git
This way pushes upstream's own commits, so every upstream commit id also resolves on your copy, and revision="<upstream sha>" works on both hubs. The price is the download: git lfs fetch --all fetches every version of every large file that upstream ever committed, which for a model with many retrained checkpoints is many times its current size.
1. Clone from huggingface.co with every large file
git clone https://huggingface.co/Qwen/Qwen3-0.6B
cd Qwen3-0.6B
git lfs fetch --all
git rev-parse HEAD # upstream main's commit id
For a gated or private repo, git asks for a username and password: use your huggingface.co username and an hf_ token.
2. Create the repo on Hippius Hub
hf_hip repos create my-namespace/Qwen3-0.6B
A new repo starts with one commit, its .gitattributes.
3. Push the history
git remote add hippius https://hub.hippius.com/my-namespace/Qwen3-0.6B
git push --force hippius main # replaces the new repo's first commit with upstream's history
git push hippius --tags # if upstream has tags
git asks for a username and password: any username, and your hip_ key as the password. git-lfs uploads the large files first, then git pushes the commits. A push whose large files are not all on your machine stops with an error naming the missing object: run git lfs fetch --all again.
4. Check the copy
hf_hip models info my-namespace/Qwen3-0.6B --expand sha
hf_up models info Qwen/Qwen3-0.6B --expand sha
Both print the same sha.
Keep it in sync
git fetch origin
git lfs fetch --all
git push hippius origin/main:refs/heads/main
If upstream rewrote its history (rare, but it happens), the push is refused as not a fast-forward. Add --force to replace yours with theirs.
Limits
- Storage. A mirror counts against your Hub plan's storage, public or private by the repo's visibility. The Free plan holds 25 GB private and 100 GB public. Check a model's size on huggingface.co before copying: a GGUF repo holds every quantization, often hundreds of GB.
- Rate limits. Per account, in five-minute windows: 1,000 API calls and 5,000 file downloads; anonymous callers get 500 and 3,000 per address. Past them, the Hub answers
429, andhuggingface_hubwaits for the window and retries. huggingface.co has rate limits of its own; downloads there are faster and limited less with anhf_token. - git pushes. Files over 10 MB must be in LFS, as on Hugging Face (huggingface.co repos already are), and one push may carry at most 1 GB of git objects, not counting LFS files.
- What is copied. Branch
mainand its files. The git way also copies tags. Neither copies discussions, pull requests, likes or the gate.
Gated and private models
- Gated models (Llama, FLUX and others) need you to accept their terms on huggingface.co first, and an
hf_token. Copying one publicly removes the gate its authors set and can break its licence. Keep the copy private (--private), or gate it yourself: Hippius Hub serves gated repos with access requests, as Hugging Face does. - Private upstream repos need an
hf_token with read access. Make your copy--privatetoo. - Licences still apply. You publish the copy under your namespace. Respect the model's licence.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
401 Invalid credentials in Authorization header from hub.hippius.com | The hip_ key is wrong, expired or revoked, or an hf_ token was sent to Hippius Hub | Check hf_hip auth whoami. Make a new key if needed |
401 from huggingface.co, or GatedRepoError | The upstream model is gated or private | Accept its terms on huggingface.co, then set HF_UPSTREAM_TOKEN to an hf_ token with read access (Keep the two hubs apart) |
403 Forbidden: this token may not write to this namespace (or … to this repo) | A scoped key without Write on the namespace, or limited to another repo | Create a key with Write on the namespace and no repository |
403 Forbidden: claim a Hub handle for this account before writing | The account has no namespace yet | Create the namespace on the console's Hub page |
403 Forbidden: … storage quota exceeded … | The copy doesn't fit in your plan's storage | Free space, upgrade the plan, or make the repo public if your public storage has room |
403 Forbidden: namespace … suspended | The plan lapsed or the namespace was suspended | See Hub plans |
404 / Repository Not Found on upload or push | The repo doesn't exist, or your key can't see it | Run step "Create the repo" first; check the namespace in DST |
409 Conflict on repos create | The repo exists already | Add --exist-ok, or pick another name |
429 Too Many Requests | A rate limit (see Limits) | Wait for the window; huggingface_hub retries on its own |
git: ! [rejected] main -> main (fetch first) | The new repo's first commit is in the way, or upstream rewrote its history | git push --force hippius main |
git-lfs: Unable to find source for object … | A large file from an old commit is not on your machine | git lfs fetch --all, then push again |
503 on a file of an archive repo at an old commit | archive mirrors carry the large files of main's latest commit; older versions may not be there | Use main, or copy the history yourself with git |
Where to next
- Pull: load your copy in
transformers,sentence-transformers,llama.cppordatasets. - Push: public and private repos, tags and branches.
- CLI and keys:
hfcommands, Hub keys for CI.