jiang1002 commited on
Commit
8e63062
·
verified ·
1 Parent(s): 810030c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -2
Dockerfile CHANGED
@@ -2,19 +2,21 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # 先升级 pip,然后一次性安装所有依赖
6
  RUN pip install --no-cache-dir --upgrade pip && \
7
  pip install --no-cache-dir \
8
  gradio \
9
  transformers==4.33.2 \
10
  sentencepiece \
11
- torch \
12
  cpm_kernels \
13
  icetk \
14
  fastapi \
15
  uvicorn \
16
  requests
17
 
 
 
 
18
  COPY . .
19
 
20
  EXPOSE 7860
 
2
 
3
  WORKDIR /app
4
 
5
+ # 1. 基础依赖,不指定镜像源,让它自己找最快的
6
  RUN pip install --no-cache-dir --upgrade pip && \
7
  pip install --no-cache-dir \
8
  gradio \
9
  transformers==4.33.2 \
10
  sentencepiece \
 
11
  cpm_kernels \
12
  icetk \
13
  fastapi \
14
  uvicorn \
15
  requests
16
 
17
+ # 2. 专门安装 CPU 版本的 PyTorch (这是解决你最后一张图报错的关键)
18
+ RUN pip install --no-cache-dir torch==2.0.1 --index-url https://download.pytorch.org/whl/cpu
19
+
20
  COPY . .
21
 
22
  EXPOSE 7860