diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1fa39ea --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +.dockerignore +compose.yml \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4569ff8..cd423c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store __pycache__/ outputs/* -weights/* \ No newline at end of file +weights/* +!weights/.gitkeep \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8b2f16d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install system dependencies +# We split this to ensure software-properties-common is installed before add-apt-repository +RUN apt-get update && apt-get install -y \ + software-properties-common \ + git \ + git-lfs \ + wget \ + build-essential \ + libgl1 \ + libglib2.0-0 \ + && rm -rf /var/lib/apt/lists/* \ + && git lfs install + +# Add Python 3.8 PPA +RUN add-apt-repository ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install -y \ + python3.8 \ + python3.8-dev \ + python3.8-distutils \ + && rm -rf /var/lib/apt/lists/* + +# Install pip for Python 3.8 +RUN wget https://bootstrap.pypa.io/pip/3.8/get-pip.py && \ + python3.8 get-pip.py && \ + rm get-pip.py + +# Set python3.8 as default python +RUN ln -s /usr/bin/python3.8 /usr/bin/python + +# Install PyTorch and dependencies +# We install torch first to ensure the correct cuda version is picked up +RUN pip install --no-cache-dir torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu118 + +# Copy requirements and install +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the entire repository +COPY . /app + +# Install customized 'Forward-Warp' package +WORKDIR /app/dependency/Forward-Warp +RUN chmod +x install.sh && ./install.sh + +WORKDIR /app \ No newline at end of file diff --git a/README.md b/README.md index 4c2352a..9c0e81e 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ cd StereoCrafter pip install -r requirements.txt ``` - #### 4. Install customized 'Forward-Warp' package for forward splatting ``` cd ./dependency/Forward-Warp @@ -64,6 +63,26 @@ chmod a+x install.sh ./install.sh ``` +## 🛠️ Installation with Docker + +#### 1. Set up the environment +Docker will run the code on Python 3.8 and Cuda 11.8. +You need to install Docker with CUDA support first. + +#### 2. Clone the repo +```bash +# use --recursive to clone the dependent submodules +git clone --recursive https://github.com/TencentARC/StereoCrafter +cd StereoCrafter +``` + +#### 3. Download models +Please refer to "📦 Model Weights" for downloading the models. + +#### 4. Start the Docker image +```bash +docker compose run stereo_crafter --build --remove-orphans +``` ## 📦 Model Weights @@ -71,7 +90,6 @@ chmod a+x install.sh ```bash # in StereoCrafter project root directory -mkdir weights cd ./weights git lfs install git clone https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt-1-1 diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..1317810 --- /dev/null +++ b/compose.yml @@ -0,0 +1,14 @@ +services: + stereo_crafter: + build: + context: . + dockerfile: Dockerfile + volumes: + - ./test:/app/test + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] \ No newline at end of file diff --git a/weights/.gitkeep b/weights/.gitkeep new file mode 100644 index 0000000..e69de29