Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HF Spaces 官方基础镜像,匹配CUDA
|
| 2 |
+
FROM hf-mirror.com/huggingface/transformers-pytorch-gpu:latest
|
| 3 |
+
|
| 4 |
+
# 1. 预装编译flash-attn必需的系统依赖
|
| 5 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
+
gcc g++ build-essential ninja-build cuda-nvcc-12-1 \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# 升级基础打包工具
|
| 10 |
+
RUN pip install --upgrade pip setuptools wheel ninja
|
| 11 |
+
|
| 12 |
+
# 2. 复制依赖并安装,强制源码编译flash-attn,规避wheel不兼容
|
| 13 |
+
COPY requirements.txt /tmp/requirements.txt
|
| 14 |
+
RUN MAX_JOBS=2 pip install \
|
| 15 |
+
--no-cache-dir \
|
| 16 |
+
--no-binary flash-attn \
|
| 17 |
+
--no-build-isolation \
|
| 18 |
+
-r /tmp/requirements.txt \
|
| 19 |
+
gradio[oauth]==5.25.2 \
|
| 20 |
+
"uvicorn>=0.14.0" \
|
| 21 |
+
"websockets>=10.4" \
|
| 22 |
+
spaces
|
| 23 |
+
|
| 24 |
+
# HF Spaces固定启动命令,不要修改
|
| 25 |
+
CMD ["python", "app.py"]
|