Skip to content

Commit

Permalink
[feature]: add dockerfile (#362)
Browse files Browse the repository at this point in the history
* add opensora dockerfile

* update README
  • Loading branch information
Luo-Yihang authored May 3, 2024
1 parent 42f0449 commit 8db6870
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ Other useful documents and links are listed below.

## Installation

### Install from Source

```bash
# create a virtual env
conda create -n opensora python=3.10
Expand Down Expand Up @@ -180,6 +182,20 @@ cd Open-Sora
pip install -v .
```

### Use Docker

Run the following command to build a docker image from Dockerfile provided.

```bash
docker build -t opensora ./docker
```

Run the following command to start the docker container in interactive mode.

```bash
docker run -ti --gpus all -v {MOUNT_DIR}:/data opensora
```

## Model Weights

### Open-Sora 1.1 Model Weights
Expand Down
25 changes: 25 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM hpcaitech/pytorch-cuda:2.1.0-12.1.0

# metainformation
LABEL org.opencontainers.image.source = "https://github.com/hpcaitech/Open-Sora"
LABEL org.opencontainers.image.licenses = "Apache License 2.0"
LABEL org.opencontainers.image.base.name = "docker.io/library/hpcaitech/pytorch-cuda:2.1.0-12.1.0"

COPY . /workspace/Open-Sora

# inatall library dependencies
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y

# install flash attention
RUN pip install flash-attn --no-build-isolation

# install apex
RUN 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

# install xformers
RUN pip install xformers --index-url https://download.pytorch.org/whl/cu121

# install this project
RUN git clone https://github.com/hpcaitech/Open-Sora && \
cd Open-Sora && \
pip install -v .
15 changes: 15 additions & 0 deletions docs/zh_CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

## 安装

### 从源码安装
```bash
# create a virtual env
conda create -n opensora python=3.10
Expand All @@ -112,6 +113,20 @@ cd Open-Sora
pip install -v .
```

### 使用Docker镜像

运行如下指令使用提供的Dockerfile构建镜像:

```bash
docker build -t opensora ./docker
```

运行以下命令以启动交互模式下的 Docker 容器:

```bash
docker run -ti --gpus all -v {MOUNT_DIR}:/data opensora
```

安装完成后,建议阅读[结构](structure.md),了解项目结构以及如何使用配置文件。

## 模型权重
Expand Down

0 comments on commit 8db6870

Please sign in to comment.