diff --git a/README.md b/README.md index e2780316..b724310a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..a361bfbf --- /dev/null +++ b/docker/Dockerfile @@ -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 . \ No newline at end of file diff --git a/docs/zh_CN/README.md b/docs/zh_CN/README.md index 21f8c6d7..d84d4d7d 100644 --- a/docs/zh_CN/README.md +++ b/docs/zh_CN/README.md @@ -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),了解项目结构以及如何使用配置文件。 ## 模型权重