Julien Blanchon commited on
Commit
9d70bb5
·
1 Parent(s): a6aff69

Optimize Docker build to avoid OOM during compilation

Browse files

- Reduce CUDA architectures to essential ones (7.5, 8.0, 8.6) for HF Spaces
- Set MAX_JOBS=1 to limit parallel compilation and reduce memory usage
- This should prevent exit code 137 (killed due to memory limits)
- Covers T4 (7.5), A100 (8.0), and A10G (8.6) GPUs commonly used in HF Spaces

Files changed (1) hide show
  1. Dockerfile +6 -5
Dockerfile CHANGED
@@ -46,17 +46,18 @@ ENV HOME=/home/user \
46
  COPY --chown=user pyproject.docker.toml ./pyproject.toml
47
  COPY --chown=user gsplat/ ./gsplat/
48
 
49
- # Set CUDA compilation flags for HF Spaces GPU compatibility
50
- ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0" \
51
- FORCE_CUDA=1
 
52
 
53
  # Create virtual environment and install dependencies
54
  RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
55
  UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
56
 
57
- # Build gsplat wheel for target architecture and reinstall it
58
  RUN cd gsplat && \
59
- uv run python setup.py bdist_wheel && \
60
  mkdir -p ../wheels && \
61
  cp dist/*.whl ../wheels/ && \
62
  cd .. && \
 
46
  COPY --chown=user pyproject.docker.toml ./pyproject.toml
47
  COPY --chown=user gsplat/ ./gsplat/
48
 
49
+ # Set CUDA compilation flags optimized for HF Spaces (reduce memory usage)
50
+ ENV TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6" \
51
+ FORCE_CUDA=1 \
52
+ MAX_JOBS=1
53
 
54
  # Create virtual environment and install dependencies
55
  RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
56
  UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
57
 
58
+ # Build gsplat wheel for target architecture and reinstall it (single-threaded to avoid OOM)
59
  RUN cd gsplat && \
60
+ MAX_JOBS=1 uv run python setup.py bdist_wheel && \
61
  mkdir -p ../wheels && \
62
  cp dist/*.whl ../wheels/ && \
63
  cd .. && \