Spaces:
Sleeping
Sleeping
# 使用 CUDA 和 cuDNN 的基础镜像(支持 flash-attn 编译) | |
FROM nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04 | |
# 安装系统依赖 | |
RUN apt-get update && apt-get install -y \ | |
git build-essential ffmpeg libsm6 libxext6 libgl1-mesa-glx curl wget \ | |
python3-pip python3.10-venv \ | |
&& rm -rf /var/lib/apt/lists/* | |
# 升级 pip | |
RUN pip install --upgrade pip | |
# 拷贝并安装 Python 依赖(不包含 flash-attn) | |
COPY requirements.txt /tmp/requirements.txt | |
RUN pip install --no-cache-dir -r /tmp/requirements.txt \ | |
&& pip install --no-cache-dir flash-attn || echo "⚠️ flash-attn 安装失败,跳过(use_flash_attn=False 时可正常运行)" | |
# 设置工作目录并复制全部代码 | |
WORKDIR /home/user/app | |
COPY . . | |
# 启动 Gradio 应用(默认执行 app.py) | |
CMD ["python3", "app.py"] | |