Skip to content

Feature/docker #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Ignore the following files and directories when building the Docker image
*.pyc
__pycache__/
*.ipynb_checkpoints
*.log
*.csv
*.tsv
*.h5
*.pth
*.pt
*.zip
*.tar.gz
*.egg-info/
dist/
build/
.env
venv/
.env.local
*.DS_Store
*.egg
*.whl
*.pkl
*.json
*.yaml
*.yml
submodules/
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04

# Set the working directory
WORKDIR /EDGS

# Install system dependencies first, including git, build-essential, and cmake
RUN apt-get update && apt-get install -y \
git \
wget \
build-essential \
cmake \
ninja-build \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

# Copy only essential files for cloning submodules first (e.g., .gitmodules)
# Or, if submodules are public, you might not need to copy anything specific for this step
# For simplicity, we'll copy everything, but this could be optimized
COPY . .

# Initialize and update submodules
RUN git submodule init && git submodule update --recursive

# Install Miniconda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /opt/conda && \
rm /tmp/miniconda.sh
ENV PATH="/opt/conda/bin:${PATH}"

# Create the conda environment and install dependencies
RUN conda create -y -n edgs python=3.10 pip && \
conda clean -afy && \
echo "source activate edgs" > ~/.bashrc

# Set CUDA architectures to compile for
ENV TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;8.9;9.0+PTX"

# Activate the environment and install Python dependencies
RUN /bin/bash -c "source activate edgs && \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 && \
pip install -e ./submodules/gaussian-splatting/submodules/diff-gaussian-rasterization && \
pip install -e ./submodules/gaussian-splatting/submodules/simple-knn && \
pip install pycolmap wandb hydra-core tqdm torchmetrics lpips matplotlib rich plyfile imageio imageio-ffmpeg && \
pip install -e ./submodules/RoMa && \
pip install gradio plotly scikit-learn moviepy==2.1.1 ffmpeg open3d"

# Expose the port for Gradio
EXPOSE 7862

# Command to run the Gradio demo
CMD ["bash", "-c", "source activate edgs && python gradio_demo.py --port 7862"]
39 changes: 4 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,45 +69,14 @@ Alternatively, check our [Colab notebook](https://colab.research.google.com/gith
<a id="sec-install"></a>
## 🛠️ Installation

You can either run `install.sh` or manually install using the following:
You can install it just:

```bash
git clone git@github.com:CompVis/EDGS.git --recursive
cd EDGS
git submodule update --init --recursive

conda create -y -n edgs python=3.10 pip
conda activate edgs

# Set up path to your CUDA. In our experience similar versions like 12.2 also work well
export CUDA_HOME=/usr/local/cuda-12.1
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export PATH=$CUDA_HOME/bin:$PATH

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y
conda install nvidia/label/cuda-12.1.0::cuda-toolkit -y

pip install -e submodules/gaussian-splatting/submodules/diff-gaussian-rasterization
pip install -e submodules/gaussian-splatting/submodules/simple-knn

# For COLMAP and pycolmap
# Optionally install original colmap but probably pycolmap suffices
# conda install conda-forge/label/colmap_dev::colmap
pip install pycolmap


pip install wandb hydra-core tqdm torchmetrics lpips matplotlib rich plyfile imageio imageio-ffmpeg
conda install numpy=1.26.4 -y -c conda-forge --override-channels

pip install -e submodules/RoMa
conda install anaconda::jupyter --yes

# Stuff necessary for gradio and visualizations
pip install gradio
pip install plotly scikit-learn moviepy==2.1.1 ffmpeg
pip install open3d
docker compose up
```

or you can install with running `install.sh`.

<a id="sec-data"></a>
## 📦 Data

Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
edgs-app:
build: . # Instructs Docker Compose to build using the Dockerfile in the current directory
image: edgs-app # This is the name of the image you built
ports:
- "7862:7862" # Map port 7862 on the host to port 7862 in the container
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all # Use all available GPUs
capabilities: [gpu] # Request GPU capabilities
volumes:
- ./data:/EDGS/data # Example: map a local 'data' folder to '/EDGS/data' in the container
- ./output:/EDGS/output # Example: map a local 'output' folder