Skip to content

Commit 5d6d2a2

Browse files
authored
Update Dockerfile
1 parent 930f244 commit 5d6d2a2

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,58 @@
11
# Base image with CUDA 12.6 and Ubuntu 24.04 (includes Python 3.12)
22
FROM nvidia/cuda:12.6.0-devel-ubuntu24.04
33

4-
# Set environment variables to non-interactive (prevents prompts during build)
4+
# Set environment variables
55
ENV DEBIAN_FRONTEND=noninteractive
66
ENV PYTHONUNBUFFERED=1
77
ENV PYTHONDONTWRITEBYTECODE=1
8+
ENV TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9;9.0"
89

9-
# Set the working directory to /workspace (Standard for Runpod)
10+
# Set the working directory
1011
WORKDIR /workspace
1112

1213
# 1. Install System Dependencies
13-
# 'ffmpeg' is often required for video processing tasks in SAM3
1414
RUN apt-get update && apt-get install -y --no-install-recommends \
1515
git \
1616
wget \
1717
curl \
1818
vim \
1919
ffmpeg \
20+
libgl1-mesa-glx \
21+
libglib2.0-0 \
2022
python3-pip \
2123
python3-dev \
2224
python3-venv \
2325
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2426

25-
# 2. Setup Python 3.12 as default 'python'
26-
# Ubuntu 24.04 ships with Python 3.12. We ensure 'python' points to it.
27+
# 2. Setup Python 3.12 as default
2728
RUN ln -s /usr/bin/python3 /usr/bin/python
2829

29-
# 3. Install PyTorch 2.7+ with CUDA 12.6 support
30-
# Using the specific index URL provided in the SAM3 README
31-
RUN pip install --no-cache-dir --upgrade pip && \
30+
# 3. Install PyTorch 2.7.0 with PINNED dependencies
31+
# We pin torchvision==0.22.0 and torchaudio==2.7.0 to prevent conflicts
32+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
3233
pip install --no-cache-dir \
3334
torch==2.7.0 \
34-
torchvision \
35-
torchaudio \
35+
torchvision==0.22.0 \
36+
torchaudio==2.7.0 \
3637
--index-url https://download.pytorch.org/whl/cu126
3738

3839
# 4. Clone and Install SAM3
39-
# Cloning into /workspace/sam3
4040
RUN git clone https://github.com/facebookresearch/sam3.git && \
4141
cd sam3 && \
42-
# Install the package in editable mode
4342
pip install -e . && \
44-
# Install optional dependencies for notebooks and dev as recommended
4543
pip install -e ".[notebooks,dev,train]"
4644

47-
# 5. (Optional) Install Jupyter for Runpod interactive mode
45+
# 5. Install JupyterLab
4846
RUN pip install jupyterlab
4947

50-
# 6. Setup Entrypoint
51-
# Create a script to help with Hugging Face login (required for checkpoints)
48+
# 6. Setup Entrypoint for Hugging Face Login
5249
RUN echo '#!/bin/bash\n\
5350
echo "----------------------------------------------------------------"\n\
54-
echo "SAM3 Setup Complete."\n\
55-
echo "NOTE: You must log in to Hugging Face to download checkpoints."\n\
51+
echo "SAM3 Environment Ready."\n\
5652
echo "Run: huggingface-cli login"\n\
57-
echo "Then follow the instructions in the README to download weights."\n\
5853
echo "----------------------------------------------------------------"\n\
5954
exec "$@"' > /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
6055

6156
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
6257

63-
# Default command: Start Jupyter Lab (common for Runpod) or sleep infinity
6458
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--allow-root", "--no-browser"]

0 commit comments

Comments
 (0)