thechaiexperiment commited on
Commit
6209c8b
·
1 Parent(s): b6b198e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -1
Dockerfile CHANGED
@@ -11,6 +11,9 @@ RUN apt-get update && apt-get install -y \
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
 
 
 
14
  # Create the nltk_data directory and set permissions
15
  RUN mkdir -p /code/nltk_data && chmod -R 777 /code/nltk_data
16
 
@@ -20,10 +23,17 @@ ENV NLTK_DATA=/code/nltk_data
20
  # Download punkt data for NLTK
21
  RUN python -c "import nltk; nltk.download('punkt')"
22
 
 
 
 
 
 
 
 
23
  # Copy your code and models
24
  COPY . .
25
 
26
  # Run FastAPI
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
28
 
29
- ENV TRANSFORMERS_CACHE=/tmp/cache
 
11
  COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
+ # Install sentencepiece
15
+ RUN pip install sentencepiece
16
+
17
  # Create the nltk_data directory and set permissions
18
  RUN mkdir -p /code/nltk_data && chmod -R 777 /code/nltk_data
19
 
 
23
  # Download punkt data for NLTK
24
  RUN python -c "import nltk; nltk.download('punkt')"
25
 
26
+ # Ensure the transformer cache directory exists
27
+ RUN mkdir -p /code/transformers_cache
28
+ ENV TRANSFORMERS_CACHE=/code/transformers_cache
29
+
30
+ # Download the sentence-transformers model to avoid recreating it
31
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')"
32
+
33
  # Copy your code and models
34
  COPY . .
35
 
36
  # Run FastAPI
37
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
38
 
39
+ ENV TRANSFORMERS_CACHE=/code/transformers_cache