Spaces:
Build error
Build error
Commit
·
e2d5029
1
Parent(s):
704d2d3
refactor: Use modern Python terrain engine (no C++/CUDA)
Browse files- Remove legacy C++/CUDA terrain compilation
- Uses HuggingFace Kernels + PyTorch Geometric + GPyTorch
- Much simpler and faster Docker build
- Modern terrain engine in tools/modern_terrain_engine.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +19 -103
Dockerfile
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
#
|
|
|
|
| 2 |
FROM python:3.11-slim AS builder
|
| 3 |
|
| 4 |
# Python environment setup for UV
|
|
@@ -6,68 +7,21 @@ ENV UV_COMPILE_BYTECODE=1
|
|
| 6 |
ENV UV_LINK_MODE=copy
|
| 7 |
ENV UV_CACHE_DIR=/tmp/.uv-cache
|
| 8 |
|
| 9 |
-
# System dependencies
|
| 10 |
RUN apt-get update && \
|
| 11 |
apt-get install -y --no-install-recommends \
|
| 12 |
curl \
|
| 13 |
ca-certificates \
|
| 14 |
-
tzdata \
|
| 15 |
-
build-essential \
|
| 16 |
git \
|
| 17 |
-
|
| 18 |
-
ninja-build \
|
| 19 |
-
libgtk-3-dev \
|
| 20 |
-
libpng-dev \
|
| 21 |
-
libjpeg-dev \
|
| 22 |
-
libwebp-dev \
|
| 23 |
-
libtiff-dev \
|
| 24 |
-
libopenexr-dev \
|
| 25 |
libopenblas-dev \
|
| 26 |
-
libx11-dev \
|
| 27 |
-
libavutil-dev \
|
| 28 |
-
libavcodec-dev \
|
| 29 |
-
libavformat-dev \
|
| 30 |
-
libswscale-dev \
|
| 31 |
-
libswresample-dev \
|
| 32 |
-
libssl-dev \
|
| 33 |
-
libva-dev \
|
| 34 |
-
libgstreamer1.0-dev \
|
| 35 |
-
libgstreamer-plugins-base1.0-dev \
|
| 36 |
-
opencl-headers \
|
| 37 |
-
ocl-icd-opencl-dev \
|
| 38 |
-
xvfb \
|
| 39 |
-
xauth \
|
| 40 |
-
g++ \
|
| 41 |
-
gcc \
|
| 42 |
-
libomp-dev \
|
| 43 |
-
libgomp1 \
|
| 44 |
-
coreutils \
|
| 45 |
-
findutils \
|
| 46 |
-
bash \
|
| 47 |
-
procps \
|
| 48 |
-
libc6-dev \
|
| 49 |
-
pkg-config \
|
| 50 |
-
make \
|
| 51 |
-
dos2unix \
|
| 52 |
-
wget \
|
| 53 |
&& rm -rf /var/lib/apt/lists/*
|
| 54 |
|
| 55 |
-
# Install CUDA toolkit for terrain compilation
|
| 56 |
-
RUN wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run -O cuda_installer.run && \
|
| 57 |
-
chmod +x cuda_installer.run && \
|
| 58 |
-
./cuda_installer.run --no-opengl-libs --no-man-page --no-opengl-libs --override --silent --toolkit && \
|
| 59 |
-
rm cuda_installer.run && \
|
| 60 |
-
echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> /etc/profile && \
|
| 61 |
-
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> /etc/profile
|
| 62 |
-
|
| 63 |
-
# Create user for build process
|
| 64 |
-
RUN useradd -ms /bin/bash user
|
| 65 |
-
|
| 66 |
# Install uv
|
| 67 |
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 68 |
ENV PATH="/root/.local/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
| 69 |
|
| 70 |
-
# Clone infinigen from GitHub
|
| 71 |
RUN git clone https://github.com/bjoernbethge/infinigen.git /app
|
| 72 |
|
| 73 |
# Set up working directory
|
|
@@ -78,63 +32,30 @@ RUN uv venv /app/.venv
|
|
| 78 |
ENV VIRTUAL_ENV=/app/.venv
|
| 79 |
ENV PATH="/app/.venv/bin:$PATH"
|
| 80 |
|
| 81 |
-
# Install Python dependencies
|
| 82 |
-
RUN sh -c "ulimit -n 4096 && uv sync --frozen
|
| 83 |
-
|
| 84 |
-
# Compile terrain libraries with CUDA support
|
| 85 |
-
RUN chmod +x scripts/install/compile_terrain.sh && \
|
| 86 |
-
dos2unix scripts/install/compile_terrain.sh && \
|
| 87 |
-
dos2unix infinigen/OcMesher/install.sh && \
|
| 88 |
-
bash -c "set -e; cd /app && bash scripts/install/compile_terrain.sh" && \
|
| 89 |
-
echo "Terrain compilation completed successfully with CUDA support"
|
| 90 |
-
|
| 91 |
-
# Compile Cython terrain libraries
|
| 92 |
-
RUN bash -c "source .venv/bin/activate && python setup.py build_ext --inplace" && \
|
| 93 |
-
echo "Cython terrain compilation completed successfully"
|
| 94 |
-
|
| 95 |
-
# Install additional runtime dependencies
|
| 96 |
-
RUN bash -c "source .venv/bin/activate && pip install PyOpenGL-accelerate"
|
| 97 |
|
| 98 |
-
# Install Gradio and HuggingFace dependencies
|
| 99 |
RUN sh -c "ulimit -n 4096 && uv add gradio>=5.0.0 pydantic-ai[huggingface]>=1.0.8"
|
| 100 |
|
| 101 |
-
#
|
| 102 |
-
RUN
|
| 103 |
-
chown -R user:user /
|
| 104 |
|
| 105 |
# ============================================
|
| 106 |
-
# Runtime stage - minimal image
|
| 107 |
# ============================================
|
| 108 |
FROM python:3.11-slim AS runtime
|
| 109 |
|
| 110 |
-
# Runtime environment
|
| 111 |
ENV UV_COMPILE_BYTECODE=1
|
| 112 |
ENV UV_CACHE_DIR=/tmp/.uv-cache
|
| 113 |
-
ENV DISPLAY=:99
|
| 114 |
-
ENV BLENDER_HEADLESS=1
|
| 115 |
|
| 116 |
-
# Minimal runtime dependencies
|
| 117 |
RUN apt-get update && \
|
| 118 |
apt-get install -y --no-install-recommends \
|
| 119 |
-
curl \
|
| 120 |
-
ca-certificates \
|
| 121 |
-
tzdata \
|
| 122 |
-
libx11-6 \
|
| 123 |
-
libglib2.0-0 \
|
| 124 |
-
libgtk-3-0 \
|
| 125 |
-
libgomp1 \
|
| 126 |
-
libomp5 \
|
| 127 |
libopenblas0 \
|
| 128 |
-
|
| 129 |
-
libtiff6 \
|
| 130 |
-
libwebp7 \
|
| 131 |
-
libssl3 \
|
| 132 |
-
libgstreamer1.0-0 \
|
| 133 |
-
libgstreamer-plugins-base1.0-0 \
|
| 134 |
-
xvfb \
|
| 135 |
-
xauth \
|
| 136 |
-
bash \
|
| 137 |
-
procps \
|
| 138 |
&& rm -rf /var/lib/apt/lists/*
|
| 139 |
|
| 140 |
# Create user (HuggingFace Spaces standard)
|
|
@@ -149,18 +70,13 @@ ENV PATH="/app/.venv/bin:/root/.local/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
|
| 149 |
ENV VIRTUAL_ENV=/app/.venv
|
| 150 |
ENV HOME=/home/user
|
| 151 |
|
| 152 |
-
# Set up working directory
|
| 153 |
WORKDIR /app
|
| 154 |
|
| 155 |
-
# Create startup script for Gradio
|
| 156 |
-
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &\nexport DISPLAY=:99\ncd /app\nexec python app.py' > /usr/local/bin/start-gradio.sh && \
|
| 157 |
-
chmod +x /usr/local/bin/start-gradio.sh
|
| 158 |
-
|
| 159 |
# Copy Gradio app
|
| 160 |
COPY app.py /app/app.py
|
| 161 |
|
| 162 |
-
#
|
| 163 |
-
RUN
|
| 164 |
|
| 165 |
# Switch to user
|
| 166 |
USER user
|
|
@@ -168,5 +84,5 @@ USER user
|
|
| 168 |
# Expose Gradio port
|
| 169 |
EXPOSE 7860
|
| 170 |
|
| 171 |
-
#
|
| 172 |
-
CMD ["
|
|
|
|
| 1 |
+
# Infinigen Agents - Modern Python-based Terrain Engine
|
| 2 |
+
# No legacy C++/CUDA compilation needed - uses HuggingFace Kernels + PyTorch Geometric
|
| 3 |
FROM python:3.11-slim AS builder
|
| 4 |
|
| 5 |
# Python environment setup for UV
|
|
|
|
| 7 |
ENV UV_LINK_MODE=copy
|
| 8 |
ENV UV_CACHE_DIR=/tmp/.uv-cache
|
| 9 |
|
| 10 |
+
# System dependencies (minimal - no CUDA toolkit needed)
|
| 11 |
RUN apt-get update && \
|
| 12 |
apt-get install -y --no-install-recommends \
|
| 13 |
curl \
|
| 14 |
ca-certificates \
|
|
|
|
|
|
|
| 15 |
git \
|
| 16 |
+
build-essential \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
libopenblas-dev \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Install uv
|
| 21 |
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 22 |
ENV PATH="/root/.local/bin:/usr/local/bin:/usr/bin:/bin:$PATH"
|
| 23 |
|
| 24 |
+
# Clone infinigen from GitHub
|
| 25 |
RUN git clone https://github.com/bjoernbethge/infinigen.git /app
|
| 26 |
|
| 27 |
# Set up working directory
|
|
|
|
| 32 |
ENV VIRTUAL_ENV=/app/.venv
|
| 33 |
ENV PATH="/app/.venv/bin:$PATH"
|
| 34 |
|
| 35 |
+
# Install Python dependencies (modern terrain engine uses kernels, torch_geometric, gpytorch)
|
| 36 |
+
RUN sh -c "ulimit -n 4096 && uv sync --frozen"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
# Install Gradio and HuggingFace dependencies for Space
|
| 39 |
RUN sh -c "ulimit -n 4096 && uv add gradio>=5.0.0 pydantic-ai[huggingface]>=1.0.8"
|
| 40 |
|
| 41 |
+
# Create user
|
| 42 |
+
RUN useradd -ms /bin/bash user && \
|
| 43 |
+
chown -R user:user /app
|
| 44 |
|
| 45 |
# ============================================
|
| 46 |
+
# Runtime stage - minimal image
|
| 47 |
# ============================================
|
| 48 |
FROM python:3.11-slim AS runtime
|
| 49 |
|
| 50 |
+
# Runtime environment
|
| 51 |
ENV UV_COMPILE_BYTECODE=1
|
| 52 |
ENV UV_CACHE_DIR=/tmp/.uv-cache
|
|
|
|
|
|
|
| 53 |
|
| 54 |
+
# Minimal runtime dependencies
|
| 55 |
RUN apt-get update && \
|
| 56 |
apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
libopenblas0 \
|
| 58 |
+
libgomp1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
&& rm -rf /var/lib/apt/lists/*
|
| 60 |
|
| 61 |
# Create user (HuggingFace Spaces standard)
|
|
|
|
| 70 |
ENV VIRTUAL_ENV=/app/.venv
|
| 71 |
ENV HOME=/home/user
|
| 72 |
|
|
|
|
| 73 |
WORKDIR /app
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# Copy Gradio app
|
| 76 |
COPY app.py /app/app.py
|
| 77 |
|
| 78 |
+
# Set ownership
|
| 79 |
+
RUN chown -R user:user /app
|
| 80 |
|
| 81 |
# Switch to user
|
| 82 |
USER user
|
|
|
|
| 84 |
# Expose Gradio port
|
| 85 |
EXPOSE 7860
|
| 86 |
|
| 87 |
+
# Start Gradio app
|
| 88 |
+
CMD ["python", "app.py"]
|