Skip to content
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

feat: add Dockerfile to install on docker #159

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel
WORKDIR /workspace
ENV CUDA_HOME=/usr/local/cuda
COPY . /workspace/Open-Sora

RUN apt-get update && apt-get install -y git \
&& pip3 install torch torchvision \
&& pip install opencv-python-headless \
&& pip install packaging ninja \
&& pip install flash-attn --no-build-isolation \
&& pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git \
&& pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu121 \
&& cd Open-Sora \
&& pip install -v .
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Videos are downsampled to `.gif` for display. Click for original videos. Prompts
* [Citation](#citation)

## Installation

### On Linux
```bash
# create a virtual env
conda create -n opensora python=3.10
Expand Down Expand Up @@ -116,6 +116,15 @@ pip install -v .

After installation, we suggest reading [structure.md](docs/structure.md) to learn the project structure and how to use the config files.

### Docker build
```bash
# Build
docker build -t <tag name> .
# Run
docker run -v /path/to/t5-v1_1-xxl:/workspace/Open-Sora/pretrained_models/t5_ckpts/t5-v1_1-xxl -v /path/to/pth:/workspace/pth -it --gpus all <tag name> bash
```
You may meet some trouble while building, see [常见问题](docs/docker_qa_zh.md).

## Model Weights

| Resolution | Data | #iterations | Batch Size | GPU days (H800) | URL |
Expand Down
11 changes: 11 additions & 0 deletions docs/docker_qa_zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 构建过程常见问题
## Failed to build apex / subprocess.CalledProcessError
检查构建过程日志在编译过程中是否出现 `Killed` 字样,若有则说明内存不足以构建该镜像。降低构建过程CPU数量可减小并发编译内存消耗。对于 Windows Docker Desktop 用户尝试编辑`.wslconfig`文件,加入以下字段。
```
memory=16GB # 越接近你的机器最大内存越好
processors=4 # 适当减小该数值
```
## SSL Error
对于处于互联网审查区域的用户,尝试换源,或者使用审查绕过方案连接互联网。
## 构建时间过长
在i7-10700@16GB的机器上耗费了约53min完成构建。若构建时间过长,尝试换源,或者使用审查绕过方案连接互联网。