Spaces:
Paused
Paused
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 filesHF 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>
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
|
| 55 |
|
| 56 |
-
Don't commit 15 GB into the Space repo.
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
```bash
|
| 60 |
-
# one-time upload
|
| 61 |
-
hf upload UmutKocasari/FaceAnything
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
```
|
| 63 |
|
| 64 |
-
Then set
|
| 65 |
|
| 66 |
```
|
| 67 |
-
|
| 68 |
-
HF_TOKEN = hf_... # only if the repo is private
|
| 69 |
-
HF_HOME = /data/.huggingface # with Persistent Storage enabled (see below)
|
| 70 |
```
|
| 71 |
|
| 72 |
-
`
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
*
|
| 81 |
-
|
| 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 |
|