Spaces:
Paused
Paused
GitHub Actions commited on
Commit ·
79046e7
1
Parent(s): 6a75a66
Deploy from GitHub commit 690244100441eb02c409afe289096400aafb604a
Browse files- Dockerfile +16 -8
Dockerfile
CHANGED
|
@@ -35,17 +35,25 @@ COPY requirements-base.txt requirements-gpu-cu126.txt ./
|
|
| 35 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 36 |
pip install --no-cache-dir -r requirements-gpu-cu126.txt
|
| 37 |
|
| 38 |
-
# R4-1 — bake the intrinsic-decomposition weights (~1.
|
| 39 |
# Space disk is ephemeral, so without this every wake re-downloads them
|
| 40 |
-
# before the first conversion.
|
| 41 |
-
#
|
| 42 |
-
#
|
| 43 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
RUN python3 -c "import os, torch.hub as hub; \
|
| 45 |
-
os.
|
|
|
|
| 46 |
open(os.path.join(hub.get_dir(), 'trusted_list'), 'a').write('rwightman_gen-efficientnet-pytorch\n'); \
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
chown -R user:1000 /home/user/.cache
|
| 50 |
|
| 51 |
# Copy the rest of the application files
|
|
|
|
| 35 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 36 |
pip install --no-cache-dir -r requirements-gpu-cu126.txt
|
| 37 |
|
| 38 |
+
# R4-1 — bake the intrinsic-decomposition weights (~1.7 GB) into the image:
|
| 39 |
# Space disk is ephemeral, so without this every wake re-downloads them
|
| 40 |
+
# before the first conversion. We DOWNLOAD the checkpoints only — we must NOT
|
| 41 |
+
# call load_models() here, because instantiating all five v2 stages at once
|
| 42 |
+
# spikes CPU RAM past the build container's cap (exit 137 / OOMKilled). At
|
| 43 |
+
# runtime load_models() finds these cached by filename in hub/checkpoints and
|
| 44 |
+
# skips the network; only the tiny backbone source zips are fetched on first
|
| 45 |
+
# request. The trusted_list write mirrors app._ensure_torch_hub_trust
|
| 46 |
+
# (altered_midas prompts interactively without it and crashes headless
|
| 47 |
+
# builds). chown in the SAME layer so the cache isn't duplicated into a
|
| 48 |
+
# second layer.
|
| 49 |
RUN python3 -c "import os, torch.hub as hub; \
|
| 50 |
+
ckpt = os.path.join(hub.get_dir(), 'checkpoints'); \
|
| 51 |
+
os.makedirs(ckpt, exist_ok=True); \
|
| 52 |
open(os.path.join(hub.get_dir(), 'trusted_list'), 'a').write('rwightman_gen-efficientnet-pytorch\n'); \
|
| 53 |
+
base = 'https://github.com/compphoto/Intrinsic/releases/download/v2.0'; \
|
| 54 |
+
[hub.download_url_to_file(base + '/stage_%d.pt' % n, os.path.join(ckpt, 'stage_%d.pt' % n)) for n in range(5)]; \
|
| 55 |
+
hub.download_url_to_file('https://download.pytorch.org/models/ig_resnext101_32x8-c38310e5.pth', os.path.join(ckpt, 'ig_resnext101_32x8-c38310e5.pth')); \
|
| 56 |
+
print('intrinsic weights baked (download-only)')" && \
|
| 57 |
chown -R user:1000 /home/user/.cache
|
| 58 |
|
| 59 |
# Copy the rest of the application files
|