jayman commited on
Commit
b7b9eee
·
verified ·
1 Parent(s): 3452715

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -12
Dockerfile CHANGED
@@ -1,11 +1,10 @@
1
- # 1. Use NVIDIA's stable Ubuntu 22.04 image (Most reliable for L40S drivers)
2
  FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
3
 
4
  # Prevent interactive prompts
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # 2. Install Python 3.12 and Add PPA for modern C++ libraries
8
- # This fixes the CXXABI_1.3.15 error on Ubuntu 22.04
9
  RUN apt-get update && apt-get install -y software-properties-common && \
10
  add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
11
  add-apt-repository ppa:deadsnakes/ppa -y && \
@@ -24,7 +23,7 @@ RUN apt-get update && apt-get install -y software-properties-common && \
24
  RUN useradd -m -u 1000 user
25
  USER user
26
 
27
- # 4. Set Architecture to 8.9 (L40S) and Paths
28
  ENV HOME=/home/user \
29
  PATH=/home/user/venv/bin:/usr/local/cuda/bin:$PATH \
30
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
@@ -37,24 +36,35 @@ WORKDIR $HOME/app
37
  # 5. Set up Virtual Environment
38
  RUN python3.12 -m venv $HOME/venv
39
 
40
- # 6. Install PyTorch for CUDA 12.1
41
- RUN pip install --no-cache-dir --upgrade pip && \
42
  pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
43
 
44
- # 7. CRITICAL FIX: Update requirements on the fly
45
- # We replace spconv-cu118 with spconv-cu120 (required for L40S)
46
  COPY --chown=user requirements.txt .
47
- RUN sed -i 's/spconv-cu118/spconv-cu120/g' requirements.txt && \
 
 
 
48
  pip install --no-cache-dir -r requirements.txt
49
 
50
- # 8. Copy application files
 
 
 
 
 
 
 
 
 
 
51
  COPY --chown=user . .
52
 
53
- # 9. App settings
54
  EXPOSE 7860
55
  ENV GRADIO_SERVER_NAME="0.0.0.0"
56
  ENV GRADIO_SERVER_PORT="7860"
57
- # Since you have 48GB, we disable LOW_VRAM and optimize allocation
58
  ENV PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
59
 
60
  # Run the app
 
1
+ # 1. Use NVIDIA's stable Ubuntu 22.04 image
2
  FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
3
 
4
  # Prevent interactive prompts
5
  ENV DEBIAN_FRONTEND=noninteractive
6
 
7
+ # 2. Install Python 3.12 and modern C++ libraries (fixes the CXXABI error natively)
 
8
  RUN apt-get update && apt-get install -y software-properties-common && \
9
  add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
10
  add-apt-repository ppa:deadsnakes/ppa -y && \
 
23
  RUN useradd -m -u 1000 user
24
  USER user
25
 
26
+ # 4. Set Architecture for L40S (8.9) and CUDA paths
27
  ENV HOME=/home/user \
28
  PATH=/home/user/venv/bin:/usr/local/cuda/bin:$PATH \
29
  LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH \
 
36
  # 5. Set up Virtual Environment
37
  RUN python3.12 -m venv $HOME/venv
38
 
39
+ # 6. Install PyTorch & Compilation Tools
40
+ RUN pip install --no-cache-dir --upgrade pip wheel setuptools ninja && \
41
  pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
42
 
43
+ # 7. THE L40S FIX: Remove incompatible pre-compiled wheels
 
44
  COPY --chown=user requirements.txt .
45
+
46
+ # We use 'sed' to dynamically delete the lines containing JeffreyXiang's pre-built .whl files
47
+ # so pip doesn't install the broken binaries, then we install the rest of the file safely.
48
+ RUN sed -i '/JeffreyXiang.*\.whl/d' requirements.txt && \
49
  pip install --no-cache-dir -r requirements.txt
50
 
51
+ # 8. Compile the 3D CUDA extensions natively for your L40S
52
+ # Note: Because it is building heavy CUDA kernels from scratch, this step will
53
+ # take roughly 10 to 15 minutes during the Space build. Let it run!
54
+ RUN pip install --no-cache-dir flash-attn --no-build-isolation && \
55
+ pip install --no-cache-dir git+https://github.com/JeffreyXiang/CuMesh.git && \
56
+ pip install --no-cache-dir git+https://github.com/JeffreyXiang/FlexGEMM.git && \
57
+ pip install --no-cache-dir git+https://github.com/microsoft/TRELLIS.2.git#subdirectory=o-voxel && \
58
+ pip install --no-cache-dir git+https://github.com/NVlabs/nvdiffrast.git && \
59
+ pip install --no-cache-dir git+https://github.com/JeffreyXiang/nvdiffrec.git@renderutils
60
+
61
+ # 9. Copy application files
62
  COPY --chown=user . .
63
 
64
+ # 10. App settings
65
  EXPOSE 7860
66
  ENV GRADIO_SERVER_NAME="0.0.0.0"
67
  ENV GRADIO_SERVER_PORT="7860"
 
68
  ENV PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
69
 
70
  # Run the app