[feature]: add dockerfile (#362)

* add opensora dockerfile

* update README
This commit is contained in:
Luo Yihang 2024-05-03 13:48:28 +08:00 committed by GitHub
parent ed04275d0c
commit 98388ee37a
3 changed files with 56 additions and 0 deletions

View file

@ -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
@ -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

25
docker/Dockerfile Normal file
View file

@ -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 .

View file

@ -87,6 +87,7 @@
## 安装
### 从源码安装
```bash
# create a virtual env
conda create -n opensora python=3.10
@ -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),了解项目结构以及如何使用配置文件。
## 模型权重