bryankhelven commited on
Commit
6b689eb
·
verified ·
1 Parent(s): 7417287

FIX: Dockerfile to download stanza pretrained models

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -7
Dockerfile CHANGED
@@ -1,14 +1,18 @@
1
  FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-runtime
2
  RUN pip install "stanza>=1.2"
3
  WORKDIR /app
 
4
  COPY requirements.txt /app/requirements.txt
5
- RUN pip install -r requirements.txt
6
- COPY stanza_resources /app/stanza_resources
7
- ENV STANZA_RESOURCES_DIR=/app/stanza_resources
8
- COPY static /app/static
9
  COPY . /app
10
- RUN test -f /app/stanza_resources/pt/pretrain/model.pt && cp /app/stanza_resources/pt/pretrain/model.pt /app/stanza_resources/pt/pretrain/conll17.pt || true && \
11
- test -f /app/stanza_resources/pt/forward_charlm/model.pt && cp /app/stanza_resources/pt/forward_charlm/model.pt /app/stanza_resources/pt/forward_charlm/oscar2023.pt || true && \
12
- test -f /app/stanza_resources/pt/backward_charlm/model.pt && cp /app/stanza_resources/pt/backward_charlm/model.pt /app/stanza_resources/pt/backward_charlm/oscar2023.pt || true
 
 
 
 
 
13
  ENV PORT=7860
14
  CMD sh -c 'gunicorn --bind 0.0.0.0:${PORT:-7860} --timeout 1200 app:app'
 
1
  FROM pytorch/pytorch:1.9.0-cuda10.2-cudnn7-runtime
2
  RUN pip install "stanza>=1.2"
3
  WORKDIR /app
4
+
5
  COPY requirements.txt /app/requirements.txt
6
+ RUN pip install -r requirements.txt && pip install requests
7
+
 
 
8
  COPY . /app
9
+
10
+ ENV STANZA_RESOURCES_DIR=/app/stanza_resources
11
+
12
+ RUN python - <<'PY'
13
+ import stanza
14
+ stanza.download('pt', dir='/app/stanza_resources', processors='tokenize,pos,lemma')
15
+ PY
16
+
17
  ENV PORT=7860
18
  CMD sh -c 'gunicorn --bind 0.0.0.0:${PORT:-7860} --timeout 1200 app:app'