Umut Kocasari Claude Opus 4.8 commited on
Commit
bce9a48
·
1 Parent(s): 10fa3d7

Docs: mount model repo as a read-only volume for the checkpoint

Browse files

HF replaced the fixed persistent-storage disk with mounted volumes. Recommend
mounting the model repo (read-only) so the checkpoint is a local file at
/models/checkpoint.pt (FACEANYTHING_CHECKPOINT) — no download, nothing to re-fetch
on cold start. Keep the hf_hub_download path as an alternative, with a Storage
Bucket volume backing HF_HOME for cache persistence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (1) hide show
  1. README.md +34 -18
README.md CHANGED
@@ -51,35 +51,51 @@ The Gradio code (`app.py`) and the model source (`src/faceanything`,
51
  `src/depth_anything_3`) are included here. To make the Space runnable you still
52
  need the **checkpoint** (~15 GB), which is not committed.
53
 
54
- ### Checkpoint storage (recommended: a separate HF model repo)
55
 
56
- Don't commit 15 GB into the Space repo. Upload the checkpoint to its own Hugging
57
- Face **model** repo once, and let the app pull it at startup:
 
 
 
 
 
 
58
 
59
  ```bash
60
- # one-time upload (make the repo private and add an HF_TOKEN secret if you like)
61
- hf upload UmutKocasari/FaceAnything-weights /path/to/checkpoint.pt checkpoint.pt --repo-type=model
 
 
 
 
62
  ```
63
 
64
- Then set on the Space (*Settings → Variables and secrets*):
65
 
66
  ```
67
- FACEANYTHING_CHECKPOINT_REPO = UmutKocasari/FaceAnything-weights
68
- HF_TOKEN = hf_... # only if the repo is private
69
- HF_HOME = /data/.huggingface # with Persistent Storage enabled (see below)
70
  ```
71
 
72
- `hf_hub_download` caches the file, so it transfers once (and is HF-internal, so
73
- fast). The app resolves the checkpoint at **startup on the CPU node**, so the
74
- download never eats into ZeroGPU compute time.
 
 
 
 
 
 
75
 
76
- **Enable Persistent Storage** on the Space and point `HF_HOME` at it
77
- (`/data/.huggingface`) so the 15 GB cache survives restarts instead of
78
- re-downloading on every cold start.
 
 
 
79
 
80
- *Alternatives:* commit it via Git LFS at `checkpoints/checkpoint.pt` (simplest,
81
- but bloats the Space repo and slows clones — fine only if you accept that), or
82
- set `FACEANYTHING_CHECKPOINT` to an already-present local path.
83
 
84
  ### Hardware
85
 
 
51
  `src/depth_anything_3`) are included here. To make the Space runnable you still
52
  need the **checkpoint** (~15 GB), which is not committed.
53
 
54
+ ### Checkpoint storage
55
 
56
+ Don't commit 15 GB into the Space repo. Put the checkpoint in a Hugging Face
57
+ **model** repo and expose it to the Space with a mounted volume (HF's current
58
+ mechanism for persisting data — the old fixed persistent-storage disk has been
59
+ superseded by volumes / storage buckets).
60
+
61
+ **Recommended — mount the model repo as a read-only volume.** The checkpoint then
62
+ appears as a plain local file; no download code, nothing to re-fetch on cold
63
+ start, and zero ZeroGPU seconds spent moving it.
64
 
65
  ```bash
66
+ # one-time: upload the checkpoint into your model repo
67
+ hf upload UmutKocasari/FaceAnything /path/to/checkpoint.pt checkpoint.pt --repo-type=model
68
+
69
+ # mount that model repo into the Space at /models (read-only) — restarts the Space
70
+ hf spaces volumes set UmutKocasari/FaceAnything \
71
+ -v hf://models/UmutKocasari/FaceAnything:/models
72
  ```
73
 
74
+ Then set one Space variable (*Settings → Variables and secrets*):
75
 
76
  ```
77
+ FACEANYTHING_CHECKPOINT = /models/checkpoint.pt
 
 
78
  ```
79
 
80
+ Add the `HF_TOKEN` secret too if the model repo is private. Verify the mount with
81
+ `hf spaces volumes ls UmutKocasari/FaceAnything`. (Models/datasets are always
82
+ read-only mounts; only storage buckets can be mounted read-write.)
83
+
84
+ **Alternative — download at startup.** Skip the volume and set
85
+ `FACEANYTHING_CHECKPOINT_REPO = UmutKocasari/FaceAnything`; the app calls
86
+ `hf_hub_download` on the CPU node at startup. It re-downloads on each cold start
87
+ unless you back the HF cache with a read-write **Storage Bucket** volume and point
88
+ `HF_HOME` at it:
89
 
90
+ ```bash
91
+ hf buckets create UmutKocasari/faceanything-cache
92
+ hf spaces volumes set UmutKocasari/FaceAnything \
93
+ -v hf://buckets/UmutKocasari/faceanything-cache:/data
94
+ # then set Space variable: HF_HOME = /data/.huggingface
95
+ ```
96
 
97
+ *Last resort:* commit the weights via Git LFS at `checkpoints/checkpoint.pt`
98
+ (bloats the Space repo and slows every clone).
 
99
 
100
  ### Hardware
101