corwen commited on
Commit
c88d1e9
·
verified ·
1 Parent(s): 591722d

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -0
Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"]