angre369 commited on
Commit
12879e9
·
1 Parent(s): 615441e

fix: Pre-download Helsinki-NLP/opus-mt-en-zh model in Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -0
Dockerfile CHANGED
@@ -11,6 +11,9 @@ RUN pip install --no-cache-dir -r requirements.txt
11
  # 复制应用代码
12
  COPY . .
13
 
 
 
 
14
  # 暴露端口
15
  EXPOSE 7860
16
 
 
11
  # 复制应用代码
12
  COPY . .
13
 
14
+ # 预下载模型以避免运行时权限问题
15
+ RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; AutoTokenizer.from_pretrained('Helsinki-NLP/opus-mt-en-zh'); AutoModelForSeq2SeqLM.from_pretrained('Helsinki-NLP/opus-mt-en-zh')"
16
+
17
  # 暴露端口
18
  EXPOSE 7860
19