kamp0010 commited on
Commit
a4ad4e0
·
verified ·
1 Parent(s): 33a259d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -14,20 +14,22 @@ COPY main.py .
14
 
15
  # HuggingFace Spaces runs as non-root user 1000
16
  RUN useradd -m -u 1000 user
17
- # Pre-download models into the image cache so cold starts are fast
18
- # (comment out these two lines if you want a smaller image and can tolerate the first-run download)
 
19
  RUN python -c "\
20
  import builtins; builtins.input = lambda p='': 'y'; \
21
  import os; os.environ['HF_HUB_VERBOSITY']='error'; \
22
- from transformers import AutoModel, AutoTokenizer; \
23
- AutoModel.from_pretrained('perplexity-ai/pplx-embed-context-v1-0.6B', trust_remote_code=True); \
24
- AutoModel.from_pretrained('perplexity-ai/pplx-embed-v1-0.6B', trust_remote_code=True); \
25
- AutoTokenizer.from_pretrained('perplexity-ai/pplx-embed-v1-0.6B', trust_remote_code=True); \
26
- print('Models cached.')"
27
 
28
  USER user
29
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
30
 
 
 
 
31
  EXPOSE 7860
32
 
33
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
14
 
15
  # HuggingFace Spaces runs as non-root user 1000
16
  RUN useradd -m -u 1000 user
17
+
18
+ # Pre-download model into the image cache so cold starts are fast
19
+ # (comment out if you want a smaller image and can tolerate the first-run download)
20
  RUN python -c "\
21
  import builtins; builtins.input = lambda p='': 'y'; \
22
  import os; os.environ['HF_HUB_VERBOSITY']='error'; \
23
+ from transformers import AutoModel; \
24
+ AutoModel.from_pretrained('jinaai/jina-embeddings-v2-base-code', trust_remote_code=True); \
25
+ print('Model cached.')"
 
 
26
 
27
  USER user
28
  ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
29
 
30
+ # /data is the HuggingFace Spaces persistent volume
31
+ VOLUME ["/data"]
32
+
33
  EXPOSE 7860
34
 
35
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]