GitHub Actions commited on
Commit
79046e7
·
1 Parent(s): 6a75a66

Deploy from GitHub commit 690244100441eb02c409afe289096400aafb604a

Browse files
Files changed (1) hide show
  1. 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.4 GB) into the image:
39
  # Space disk is ephemeral, so without this every wake re-downloads them
40
- # before the first conversion. The trusted_list write mirrors
41
- # app._ensure_torch_hub_trust (altered_midas prompts interactively without
42
- # it and crashes headless builds). chown in the SAME layer so the cache
43
- # isn't duplicated into a second layer.
 
 
 
 
 
44
  RUN python3 -c "import os, torch.hub as hub; \
45
- os.makedirs(hub.get_dir(), exist_ok=True); \
 
46
  open(os.path.join(hub.get_dir(), 'trusted_list'), 'a').write('rwightman_gen-efficientnet-pytorch\n'); \
47
- __import__('intrinsic.pipeline', fromlist=['load_models']).load_models('v2', device='cpu'); \
48
- print('intrinsic weights baked')" && \
 
 
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