Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +48 -19
Dockerfile
CHANGED
@@ -1,26 +1,55 @@
|
|
1 |
-
#
|
2 |
-
FROM
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
#
|
8 |
-
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
|
16 |
-
#
|
17 |
-
|
|
|
18 |
|
19 |
-
#
|
20 |
-
RUN
|
|
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
|
25 |
-
#
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use Ubuntu + CUDA base image for full GPU support
|
2 |
+
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
|
3 |
|
4 |
+
# Set environment variables
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
+
ENV PATH=/root/miniconda3/bin:$PATH
|
7 |
+
ENV CONDA_ENV_NAME=cosmos-predict1
|
8 |
|
9 |
+
# Install dependencies
|
10 |
+
RUN apt-get update && apt-get install -y \
|
11 |
+
git curl wget sudo build-essential ca-certificates libglib2.0-0 libsm6 libxext6 libxrender-dev \
|
12 |
+
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Install Miniconda
|
15 |
+
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
|
16 |
+
bash miniconda.sh -b -p /root/miniconda3 && \
|
17 |
+
rm miniconda.sh && \
|
18 |
+
conda clean -ya
|
19 |
|
20 |
+
# Copy project files
|
21 |
+
WORKDIR /workspace
|
22 |
+
COPY . .
|
23 |
|
24 |
+
# Create and activate conda environment
|
25 |
+
RUN conda env create -f cosmos-predict1.yaml && \
|
26 |
+
echo "conda activate cosmos-predict1" >> ~/.bashrc
|
27 |
|
28 |
+
# Activate env and install Python packages
|
29 |
+
SHELL ["conda", "run", "-n", "cosmos-predict1", "/bin/bash", "-c"]
|
30 |
|
31 |
+
# Install remaining pip requirements
|
32 |
+
RUN pip install -r requirements.txt
|
33 |
+
|
34 |
+
# Patch Transformer Engine headers
|
35 |
+
RUN ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/ && \
|
36 |
+
ln -sf $CONDA_PREFIX/lib/python3.10/site-packages/nvidia/*/include/* $CONDA_PREFIX/include/python3.10
|
37 |
+
|
38 |
+
# Install Transformer Engine
|
39 |
+
RUN pip install transformer-engine[pytorch]==1.12.0
|
40 |
+
|
41 |
+
# Install Apex
|
42 |
+
RUN git clone https://github.com/NVIDIA/apex && \
|
43 |
+
CUDA_HOME=$CONDA_PREFIX pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation \
|
44 |
+
--config-settings "--build-option=--cpp_ext" \
|
45 |
+
--config-settings "--build-option=--cuda_ext" \
|
46 |
+
./apex
|
47 |
+
|
48 |
+
# Install MoGe
|
49 |
+
RUN pip install git+https://github.com/microsoft/MoGe.git
|
50 |
+
|
51 |
+
# (Optional) Test the environment
|
52 |
+
RUN CUDA_HOME=$CONDA_PREFIX PYTHONPATH=$(pwd) python scripts/test_environment.py
|
53 |
+
|
54 |
+
# Set the command to run app (replace with your app script or gradio interface)
|
55 |
+
CMD ["conda", "run", "--no-capture-output", "-n", "cosmos-predict1", "python", "app.py"]
|