Spaces:
Runtime error
Runtime error
- Dockerfile +15 -8
Dockerfile
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
ENV HF_HOME="/code/.cache/huggingface"
|
| 8 |
-
|
|
|
|
| 9 |
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
build-essential \
|
|
@@ -14,18 +18,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 14 |
COPY ./requirements.txt /code/requirements.txt
|
| 15 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
# 1. Create the cache directory
|
| 20 |
RUN mkdir -p $HF_HOME
|
| 21 |
|
| 22 |
-
#
|
|
|
|
| 23 |
RUN chmod -R 777 $HF_HOME
|
| 24 |
|
| 25 |
-
#
|
|
|
|
| 26 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
| 27 |
|
| 28 |
-
#
|
| 29 |
|
| 30 |
COPY ./app /code/app
|
| 31 |
|
|
|
|
| 1 |
+
|
| 2 |
FROM python:3.11-slim
|
| 3 |
|
| 4 |
WORKDIR /code
|
| 5 |
|
| 6 |
+
#Set the env vars for both runtime and buildtime
|
| 7 |
+
|
| 8 |
+
#This tells the RUN command below where to save the model
|
| 9 |
+
|
| 10 |
ENV HF_HOME="/code/.cache/huggingface"
|
| 11 |
+
|
| 12 |
+
#--- REMOVED DSPY ENV VAR ---
|
| 13 |
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
build-essential \
|
|
|
|
| 18 |
COPY ./requirements.txt /code/requirements.txt
|
| 19 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 20 |
|
| 21 |
+
#--- START: PRE-BAKE MODEL FIX (WITH PERMISSIONS) ---
|
| 22 |
+
|
| 23 |
+
#1. Create the cache directory
|
| 24 |
|
|
|
|
| 25 |
RUN mkdir -p $HF_HOME
|
| 26 |
|
| 27 |
+
#2. Give all users full read/write/execute permissions
|
| 28 |
+
|
| 29 |
RUN chmod -R 777 $HF_HOME
|
| 30 |
|
| 31 |
+
#3. Now, pre-bake the model. It will save to the directory we just made.
|
| 32 |
+
|
| 33 |
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
| 34 |
|
| 35 |
+
#--- END: PRE-BAKE MODEL FIX ---
|
| 36 |
|
| 37 |
COPY ./app /code/app
|
| 38 |
|