Commit 53e38505 authored by helloyongyang's avatar helloyongyang
Browse files

update docker doc and dockerfile

parent 78e87f24
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel AS base
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
# use tsinghua source
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list \
&& sed -i 's|http://security.ubuntu.com/ubuntu/|https://mirrors.tuna.tsinghua.edu.cn/ubuntu/|g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y vim tmux zip unzip wget git build-essential libibverbs-dev ca-certificates \
curl iproute2 ffmpeg libsm6 libxext6 kmod ccache libnuma-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
RUN pip install --no-cache-dir packaging ninja cmake scikit-build-core uv ruff pre-commit -U
RUN git clone https://github.com/vllm-project/vllm.git && cd vllm \
&& python use_existing_torch.py && pip install -r requirements/build.txt \
&& pip install --no-cache-dir --no-build-isolation -v -e .
RUN git clone https://github.com/sgl-project/sglang.git && cd sglang/sgl-kernel \
&& make build && make clean
RUN pip install --no-cache-dir diffusers transformers tokenizers accelerate safetensors opencv-python numpy imageio \
imageio-ffmpeg einops loguru qtorch ftfy easydict
RUN git clone https://github.com/Dao-AILab/flash-attention.git --recursive
RUN cd flash-attention && python setup.py install && rm -rf build
RUN cd flash-attention/hopper && python setup.py install && rm -rf build
# RUN git clone https://github.com/thu-ml/SageAttention.git
# # install sageattention with hopper gpu sm9.0
# RUN cd SageAttention && sed -i 's/set()/{"9.0"}/' setup.py && EXT_PARALLEL=4 NVCC_APPEND_FLAGS="--threads 8" MAX_JOBS=32 pip install --no-cache-dir -v -e .
WORKDIR /workspace
...@@ -27,14 +27,14 @@ We strongly recommend using the Docker environment, which is the simplest and fa ...@@ -27,14 +27,14 @@ We strongly recommend using the Docker environment, which is the simplest and fa
#### 1. Pull Image #### 1. Pull Image
Visit LightX2V's [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags) and select a tag with the latest date, such as `25080104`: Visit LightX2V's [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags), select a tag with the latest date, such as `25080601-cu128`:
```bash ```bash
# Pull the latest version of LightX2V image # Pull the latest version of LightX2V image, this image does not have SageAttention installed
docker pull lightx2v/lightx2v:25080104 docker pull lightx2v/lightx2v:25080601-cu128
``` ```
If you need to use `SageAttention`, you can use docker image versions with the `-SageSmXX` suffix. The use of `SageAttention` requires selection based on GPU type, where: If you need to use `SageAttention`, you can use image versions with the `-SageSmXX` suffix. The use of `SageAttention` requires selection based on GPU type, where:
1. A100: -SageSm80 1. A100: -SageSm80
2. RTX30 series: -SageSm86 2. RTX30 series: -SageSm86
...@@ -42,13 +42,24 @@ If you need to use `SageAttention`, you can use docker image versions with the ` ...@@ -42,13 +42,24 @@ If you need to use `SageAttention`, you can use docker image versions with the `
4. H100: -SageSm90 4. H100: -SageSm90
5. RTX50 series: -SageSm120 5. RTX50 series: -SageSm120
For example, to use `SageAttention` on 4090 or H100, the docker image pull command would be: For example, to use `SageAttention` on 4090 or H100, the image pull commands are:
```bash ```bash
# For 4090 # For 4090, with SageAttention installed
docker pull lightx2v/lightx2v:25080104-SageSm89 docker pull lightx2v/lightx2v:25080601-cu128-SageSm89
# For H100 # For H100, with SageAttention installed
docker pull lightx2v/lightx2v:25080104-SageSm90 docker pull lightx2v/lightx2v:25080601-cu128-SageSm90
```
We recommend using the `cuda128` environment for faster inference speed. If you need to use the `cuda124` environment, you can use image versions with the `-cu124` suffix:
```bash
# cuda124 version, without SageAttention installed
docker pull lightx2v/lightx2v:25080601-cu124
# For 4090, cuda124 version, with SageAttention installed
docker pull lightx2v/lightx2v:25080601-cu124-SageSm89
# For H100, cuda124 version, with SageAttention installed
docker pull lightx2v/lightx2v:25080601-cu124-SageSm90
``` ```
#### 2. Run Container #### 2. Run Container
...@@ -59,20 +70,29 @@ docker run --gpus all -itd --ipc=host --name [container_name] -v [mount_settings ...@@ -59,20 +70,29 @@ docker run --gpus all -itd --ipc=host --name [container_name] -v [mount_settings
#### 3. Domestic Mirror Source (Optional) #### 3. Domestic Mirror Source (Optional)
For users in mainland China, if the network is unstable when pulling images, you can pull from Aliyun: For mainland China, if the network is unstable when pulling images, you can pull from Alibaba Cloud:
```bash ```bash
# Replace [tag] with the desired image tag to download # Replace [tag] with the required image tag to download
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:[tag] docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:[tag]
# For example, download 25080104 # For example, download 25080601-cu128
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128
# For example, download 25080601-cu128-SageSm89
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128-SageSm89
# For example, download 25080601-cu128-SageSm90
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128-SageSm90
# For example, download 25080601-cu124
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124
# For example, download 25080104-SageSm89 # For example, download 25080601-cu124-SageSm89
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104-SageSm89 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124-SageSm89
# For example, download 25080104-SageSm90 # For example, download 25080601-cu124-SageSm90
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104-SageSm90 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124-SageSm90
``` ```
### 🐍 Conda Environment Setup ### 🐍 Conda Environment Setup
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
#### 1. 拉取镜像 #### 1. 拉取镜像
访问 LightX2V 的 [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags),选择一个最新日期的 tag,比如 `25080104` 访问 LightX2V 的 [Docker Hub](https://hub.docker.com/r/lightx2v/lightx2v/tags),选择一个最新日期的 tag,比如 `25080601-cu128`
```bash ```bash
# 拉取最新版本的 LightX2V 镜像 # 拉取最新版本的 LightX2V 镜像,此镜像没有安装 SageAttention
docker pull lightx2v/lightx2v:25080104 docker pull lightx2v/lightx2v:25080601-cu128
``` ```
如果需要使用`SageAttention`,可以使用带`-SageSmXX`后缀的镜像版本,`SageAttention`的使用需要针对GPU类型进行选择,其中: 如果需要使用`SageAttention`,可以使用带`-SageSmXX`后缀的镜像版本,`SageAttention`的使用需要针对GPU类型进行选择,其中:
...@@ -45,10 +45,21 @@ docker pull lightx2v/lightx2v:25080104 ...@@ -45,10 +45,21 @@ docker pull lightx2v/lightx2v:25080104
比如要在4090或者H100上使用`SageAttention`,则拉取镜像命令为: 比如要在4090或者H100上使用`SageAttention`,则拉取镜像命令为:
```bash ```bash
# 对于4090 # 对于4090,安装了 SageAttention
docker pull lightx2v/lightx2v:25080104-SageSm89 docker pull lightx2v/lightx2v:25080601-cu128-SageSm89
# 对于H100 # 对于H100,安装了 SageAttention
docker pull lightx2v/lightx2v:25080104-SageSm90 docker pull lightx2v/lightx2v:25080601-cu128-SageSm90
```
我们推荐使用`cuda128`环境,以获得更快的推理速度,若需要使用`cuda124`环境,可以使用带`-cu124`后缀的镜像版本:
```bash
# cuda124版本,没有安装 SageAttention
docker pull lightx2v/lightx2v:25080601-cu124
# 对于4090,cuda124版本,安装了 SageAttention
docker pull lightx2v/lightx2v:25080601-cu124-SageSm89
# 对于H100,cuda124版本,安装了 SageAttention
docker pull lightx2v/lightx2v:25080601-cu124-SageSm90
``` ```
#### 2. 运行容器 #### 2. 运行容器
...@@ -65,14 +76,23 @@ docker run --gpus all -itd --ipc=host --name [容器名] -v [挂载设置] --ent ...@@ -65,14 +76,23 @@ docker run --gpus all -itd --ipc=host --name [容器名] -v [挂载设置] --ent
# 修改[tag]为所需下载的镜像tag # 修改[tag]为所需下载的镜像tag
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:[tag] docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:[tag]
# 比如下载 25080104 # 比如下载 25080601-cu128
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128
# 比如下载 25080104-SageSm89 # 比如下载 25080601-cu128-SageSm89
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104-SageSm89 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128-SageSm89
# 比如下载 25080104-SageSm90 # 比如下载 25080601-cu128-SageSm90
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080104-SageSm90 docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu128-SageSm90
# 比如下载 25080601-cu124
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124
# 比如下载 25080601-cu124-SageSm89
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124-SageSm89
# 比如下载 25080601-cu124-SageSm90
docker pull registry.cn-hangzhou.aliyuncs.com/yongyang/lightx2v:25080601-cu124-SageSm90
``` ```
### 🐍 Conda 环境搭建 ### 🐍 Conda 环境搭建
...@@ -91,7 +111,7 @@ cd LightX2V ...@@ -91,7 +111,7 @@ cd LightX2V
```bash ```bash
# 创建并激活 conda 环境 # 创建并激活 conda 环境
conda create -n lightx2v python=3.12 -y conda create -n lightx2v python=3.11 -y
conda activate lightx2v conda activate lightx2v
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment