0xZohar commited on
Commit
0024048
·
verified ·
1 Parent(s): 2e3f535

Fix: Pre-download models in Dockerfile to avoid runtime hang

Browse files

Root cause analysis:
- preload_from_hub ignores HF_HOME (documented limitation)
- Previous approach caused permission conflicts → fallback to /tmp
- local_files_only=True + no models in /tmp = startup failure

Solution (best practice from research):
- Manually download models in Dockerfile to default ~/.cache location
- Download as 'user' to avoid permission issues
- Keep local_files_only=True (models already cached)
- Build logs show download progress (transparent to user)

Changes:
- README.md: Remove preload_from_hub (has limitations)
- Dockerfile: Add manual model download step (lines 100-119)
- All models download during build → instant runtime startup

Benefits:
✅ Build logs show download progress (no "hanging" confusion)
✅ Runtime startup is instant (models already in image)
✅ No permission conflicts (consistent user ownership)
✅ Works on free tier (no /data persistent storage needed)

Updated: README.md

Files changed (1) hide show
  1. README.md +0 -3
README.md CHANGED
@@ -7,9 +7,6 @@ sdk: docker
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
 
7
  app_port: 7860
8
  pinned: false
9
  license: mit
 
 
 
10
  env:
11
  HF_HOME: /home/user/.cache/huggingface
12
  HF_HUB_CACHE: /home/user/.cache/huggingface/hub