corwen commited on
Commit
78a36ae
·
verified ·
1 Parent(s): c88d1e9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -55
Dockerfile CHANGED
@@ -1,56 +1,53 @@
1
- # 1. 使用与 README 要求一致的 PyTorch 版本 (Torch 2.4.1)
2
- FROM pytorch/pytorch:2.4.1-cuda12.1-cudnn9-devel
3
-
4
- # 设置非交互式安装
5
- ENV DEBIAN_FRONTEND=noninteractive
6
-
7
- # 2. 安装系统依赖 (README 要求安装 FFmpeg)
8
- RUN apt-get update && apt-get install -y \
9
- git \
10
- git-lfs \
11
- ffmpeg \
12
- libgl1-mesa-glx \
13
- libglib2.0-0 \
14
- && rm -rf /var/lib/apt/lists/*
15
-
16
- # 设置工作目录
17
- WORKDIR /app
18
-
19
- # 3. 克隆 InfiniteTalk 仓库
20
- RUN git clone https://github.com/MeiGen-AI/InfiniteTalk.git
21
-
22
- # 进入仓库目录
23
- WORKDIR /app/InfiniteTalk
24
-
25
- # 4. 安装 Python 依赖 (严格按照 README 顺序)
26
- # 先升级 pip
27
- RUN pip install --no-cache-dir --upgrade pip
28
-
29
- # 安装 PyTorch 相关 (基础镜像已有,但为了确保 xformers 匹配,我们可以再次确认或跳过)
30
- # README: pip install -U xformers==0.0.28 --index-url https://download.pytorch.org/whl/cu121
31
- RUN pip install -U xformers==0.0.28 --index-url https://download.pytorch.org/whl/cu121
32
-
33
- # 安装 Flash Attention 及其依赖 (README 步骤 2)
34
- # misaki[en], ninja, psutil, packaging, wheel
35
- RUN pip install --no-cache-dir misaki[en] ninja psutil packaging wheel
36
- # 安装 flash-attn
37
- RUN pip install flash_attn==2.7.4.post1
38
-
39
- # 安装其他依赖 (README 步骤 3)
40
- RUN pip install --no-cache-dir -r requirements.txt
41
- # 补充一些 Space 运行需要的库
42
- RUN pip install --no-cache-dir gradio huggingface_hub
43
-
44
- # 5. 设置权限 (Hugging Face Space 安全要求)
45
- RUN useradd -m -u 1000 user
46
- RUN chown -R user:user /app
47
- USER user
48
-
49
- # 6. 设置 Gradio 环境变量,确保可以通过公网访问
50
- ENV GRADIO_SERVER_NAME="0.0.0.0"
51
-
52
- # 7. 复制我们的启动脚本 (下一步创建)
53
- COPY --chown=user:user run.py /app/InfiniteTalk/run.py
54
-
55
- # 8. 启动
56
  CMD ["python", "run.py"]
 
1
+ # 1. 使用与 README 要求一致的 PyTorch 版本
2
+ FROM pytorch/pytorch:2.4.1-cuda12.1-cudnn9-devel
3
+
4
+ # 设置非交互式安装
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # 2. 安装系统依赖
8
+ RUN apt-get update && apt-get install -y \
9
+ git \
10
+ git-lfs \
11
+ ffmpeg \
12
+ libgl1-mesa-glx \
13
+ libglib2.0-0 \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # 设置工作目录
17
+ WORKDIR /app
18
+
19
+ # 3. 克隆仓库
20
+ RUN git clone https://github.com/MeiGen-AI/InfiniteTalk.git
21
+
22
+ # 进入仓库目录
23
+ WORKDIR /app/InfiniteTalk
24
+
25
+ # 4. 安装 Python 依赖 (关键修改在这里!!!)
26
+ RUN pip install --no-cache-dir --upgrade pip
27
+
28
+ # 确保安装了编译工具 (ninja, packaging 等)
29
+ RUN pip install --no-cache-dir ninja packaging wheel setuptools
30
+
31
+ # 【核心修复】加上 --no-build-isolation
32
+ # 这样它就能找到镜像里自带的 torch 了
33
+ RUN pip install --no-cache-dir --no-build-isolation flash_attn==2.7.4.post1
34
+
35
+ # 继续安装其他依赖
36
+ RUN pip install -U xformers==0.0.28 --index-url https://download.pytorch.org/whl/cu121
37
+ RUN pip install --no-cache-dir misaki[en] psutil
38
+ RUN pip install --no-cache-dir -r requirements.txt
39
+ RUN pip install --no-cache-dir gradio huggingface_hub
40
+
41
+ # 5. 设置权限
42
+ RUN useradd -m -u 1000 user
43
+ RUN chown -R user:user /app
44
+ USER user
45
+
46
+ # 6. 环境变量
47
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
48
+
49
+ # 7. 复制启动脚本 (确保你有 run.py)
50
+ COPY --chown=user:user run.py /app/InfiniteTalk/run.py
51
+
52
+ # 8. 启动
 
 
 
53
  CMD ["python", "run.py"]