Georg commited on
Commit
09ba3b6
·
1 Parent(s): 1136732

Prepare job build context

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -34
  2. Dockerfile.base +35 -0
Dockerfile CHANGED
@@ -5,40 +5,6 @@ FROM gpue/foundationpose-base-l2:latest
5
  ENV FOUNDATIONPOSE_MODEL_REPO=gpue/foundationpose-weights
6
  ENV USE_REAL_MODEL=true
7
 
8
- # Ensure NumPy 1.x for CUDA extension compatibility and install SAM/pytorch3d
9
- RUN pip install --no-cache-dir "numpy<2" transformers==4.41.2 \
10
- && pip install --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py310_cu118_pyt210/download.html
11
-
12
- # Set MAX_JOBS=1 BEFORE any CUDA compilation to limit memory usage
13
- ENV MAX_JOBS=1
14
-
15
- # Clone FoundationPose source
16
- RUN git clone --depth 1 https://github.com/NVlabs/FoundationPose.git /app/FoundationPose \
17
- && cd /app/FoundationPose/bundlesdf/mycuda \
18
- && sed -i 's/-std=c++14/-std=c++17/g' setup.py
19
-
20
- # Build CPU-only C++ code
21
- WORKDIR /app/FoundationPose
22
- RUN cd mycpp && mkdir -p build && cd build && cmake .. && make
23
-
24
- # Download model weights (246MB)
25
- WORKDIR /app
26
- COPY download_weights.py ./download_weights.py
27
- RUN python3 download_weights.py
28
-
29
- # Install nvdiffrast (CUDA rasterizer) - needs GPU, build here
30
- RUN git clone --depth 1 https://github.com/NVlabs/nvdiffrast.git /tmp/nvdiffrast \
31
- && cd /tmp/nvdiffrast \
32
- && python3 setup.py build_ext --inplace
33
- RUN python3 -c "import shutil, sysconfig, glob; from pathlib import Path; site=Path(sysconfig.get_paths()['purelib']); src=Path('/tmp/nvdiffrast/nvdiffrast'); dst=site/'nvdiffrast'; shutil.rmtree(dst, ignore_errors=True); shutil.copytree(src, dst); so_files=(glob.glob('/tmp/nvdiffrast/_nvdiffrast_c*.so') + glob.glob('/tmp/nvdiffrast/nvdiffrast/_nvdiffrast_c*.so') + glob.glob('/tmp/nvdiffrast/build/lib.*/*_nvdiffrast_c*.so')); [shutil.copy2(p, site) for p in so_files]"
34
- RUN python3 -c "import sysconfig; from pathlib import Path; site=Path(sysconfig.get_paths()['purelib']); dist=site/'nvdiffrast-0.0.0.dist-info'; dist.mkdir(exist_ok=True); (dist/'METADATA').write_text('Metadata-Version: 2.1\nName: nvdiffrast\nVersion: 0.0.0\n'); (dist/'WHEEL').write_text('Wheel-Version: 1.0\nGenerator: manual\nRoot-Is-Purelib: false\nTag: py3-none-any\n'); (dist/'top_level.txt').write_text('nvdiffrast\n'); (dist/'RECORD').write_text('')"
35
- RUN python3 -c "import nvdiffrast.torch"
36
- RUN rm -rf /tmp/nvdiffrast
37
-
38
- # Build CUDA extensions (requires GPU - only part that needs HuggingFace GPU)
39
- WORKDIR /app/FoundationPose
40
- RUN cd bundlesdf/mycuda && pip install . --no-build-isolation
41
-
42
  # Copy application files
43
  WORKDIR /app
44
  COPY app.py client.py estimator.py masks.py .
 
5
  ENV FOUNDATIONPOSE_MODEL_REPO=gpue/foundationpose-weights
6
  ENV USE_REAL_MODEL=true
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # Copy application files
9
  WORKDIR /app
10
  COPY app.py client.py estimator.py masks.py .
Dockerfile.base CHANGED
@@ -174,3 +174,38 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
174
  WORKDIR /app
175
 
176
  EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  WORKDIR /app
175
 
176
  EXPOSE 7860
177
+
178
+ # ----- L2 build steps to include all installation work -----
179
+ # Install SAM + pytorch3d
180
+ RUN pip install --no-cache-dir "numpy<2" transformers==4.41.2 \
181
+ && pip install --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py310_cu118_pyt210/download.html
182
+
183
+ # Set MAX_JOBS=1 BEFORE any CUDA compilation to limit memory usage
184
+ ENV MAX_JOBS=1
185
+
186
+ # Clone FoundationPose source
187
+ RUN git clone --depth 1 https://github.com/NVlabs/FoundationPose.git /app/FoundationPose \
188
+ && cd /app/FoundationPose/bundlesdf/mycuda \
189
+ && sed -i 's/-std=c++14/-std=c++17/g' setup.py
190
+
191
+ # Build CPU-only C++ code
192
+ WORKDIR /app/FoundationPose
193
+ RUN cd mycpp && mkdir -p build && cd build && cmake .. && make
194
+
195
+ # Download model weights (246MB)
196
+ WORKDIR /app
197
+ COPY download_weights.py ./download_weights.py
198
+ RUN python3 download_weights.py
199
+
200
+ # Install nvdiffrast (CUDA rasterizer) - needs GPU, build here
201
+ RUN git clone --depth 1 https://github.com/NVlabs/nvdiffrast.git /tmp/nvdiffrast \
202
+ && cd /tmp/nvdiffrast \
203
+ && python3 setup.py build_ext --inplace
204
+ RUN python3 -c "import shutil, sysconfig, glob; from pathlib import Path; site=Path(sysconfig.get_paths()['purelib']); src=Path('/tmp/nvdiffrast/nvdiffrast'); dst=site/'nvdiffrast'; shutil.rmtree(dst, ignore_errors=True); shutil.copytree(src, dst); so_files=(glob.glob('/tmp/nvdiffrast/_nvdiffrast_c*.so') + glob.glob('/tmp/nvdiffrast/nvdiffrast/_nvdiffrast_c*.so') + glob.glob('/tmp/nvdiffrast/build/lib.*/*_nvdiffrast_c*.so')); [shutil.copy2(p, site) for p in so_files]"
205
+ RUN python3 -c "import sysconfig; from pathlib import Path; site=Path(sysconfig.get_paths()['purelib']); dist=site/'nvdiffrast-0.0.0.dist-info'; dist.mkdir(exist_ok=True); (dist/'METADATA').write_text('Metadata-Version: 2.1\\nName: nvdiffrast\\nVersion: 0.0.0\\n'); (dist/'WHEEL').write_text('Wheel-Version: 1.0\\nGenerator: manual\\nRoot-Is-Purelib: false\\nTag: py3-none-any\\n'); (dist/'top_level.txt').write_text('nvdiffrast\\n'); (dist/'RECORD').write_text('')"
206
+ RUN python3 -c "import nvdiffrast.torch"
207
+ RUN rm -rf /tmp/nvdiffrast
208
+
209
+ # Build CUDA extensions (requires GPU)
210
+ WORKDIR /app/FoundationPose
211
+ RUN cd bundlesdf/mycuda && pip install . --no-build-isolation