Spaces:
Paused
Paused
Fix: Use official HF Spaces preload_from_hub for model caching
Browse filesRoot cause: /data directory not accessible during Docker build
Solution: Use HF Spaces preload_from_hub feature (official best practice)
Changes:
- README.md: Add preload_from_hub configuration for both model repos
- README.md: Change cache paths from /data to ~/.cache/huggingface
- Dockerfile: Update HF cache environment variables to use ~/.cache
- Dockerfile: Remove failed /data download block (lines 100-120)
- code/demo.py: Keep local_files_only=True (already done)
- code/clip_retrieval.py: Keep local_files_only=True (already done)
This follows HF Spaces official documentation and fixes:
✅ Permission error during build
✅ Startup hang from runtime downloads
Updated: README.md
README.md
CHANGED
|
@@ -7,10 +7,13 @@ sdk: docker
|
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
|
|
|
|
|
|
|
|
|
| 10 |
env:
|
| 11 |
-
HF_HOME: /
|
| 12 |
-
HF_HUB_CACHE: /
|
| 13 |
-
TRANSFORMERS_CACHE: /
|
| 14 |
HF_HUB_DISABLE_XET: "1"
|
| 15 |
LDRAW_LIBRARY_PATH: /home/user/ldraw
|
| 16 |
---
|
|
|
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
| 10 |
+
preload_from_hub:
|
| 11 |
+
- 0xZohar/object-assembler-models
|
| 12 |
+
- openai/clip-vit-base-patch32
|
| 13 |
env:
|
| 14 |
+
HF_HOME: /home/user/.cache/huggingface
|
| 15 |
+
HF_HUB_CACHE: /home/user/.cache/huggingface/hub
|
| 16 |
+
TRANSFORMERS_CACHE: /home/user/.cache/huggingface/transformers
|
| 17 |
HF_HUB_DISABLE_XET: "1"
|
| 18 |
LDRAW_LIBRARY_PATH: /home/user/ldraw
|
| 19 |
---
|