Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +5 -4
Dockerfile
CHANGED
@@ -7,8 +7,9 @@ ENV HF_HOME=/home/user/.cache/huggingface
|
|
7 |
|
8 |
WORKDIR /app
|
9 |
|
10 |
-
#
|
11 |
ARG HF_TOKEN
|
|
|
12 |
RUN mkdir -p $HF_HOME && \
|
13 |
echo "$HF_TOKEN" > $HF_HOME/token
|
14 |
|
@@ -16,10 +17,10 @@ RUN mkdir -p $HF_HOME && \
|
|
16 |
COPY --chown=user ./requirements.txt requirements.txt
|
17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
18 |
|
19 |
-
# Pre-load the model
|
20 |
RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
|
21 |
-
AutoTokenizer.from_pretrained('meta-llama/Llama-3.1-8B-Instruct',
|
22 |
-
AutoModelForCausalLM.from_pretrained('meta-llama/Llama-3.1-8B-Instruct',
|
23 |
|
24 |
# Copy app files
|
25 |
COPY --chown=user . /app
|
|
|
7 |
|
8 |
WORKDIR /app
|
9 |
|
10 |
+
# Pass the Hugging Face token as an environment variable
|
11 |
ARG HF_TOKEN
|
12 |
+
ENV HF_TOKEN=${HF_TOKEN}
|
13 |
RUN mkdir -p $HF_HOME && \
|
14 |
echo "$HF_TOKEN" > $HF_HOME/token
|
15 |
|
|
|
17 |
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
|
20 |
+
# Pre-load the model using the updated `token` argument
|
21 |
RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \
|
22 |
+
AutoTokenizer.from_pretrained('meta-llama/Llama-3.1-8B-Instruct', token='$HF_TOKEN'); \
|
23 |
+
AutoModelForCausalLM.from_pretrained('meta-llama/Llama-3.1-8B-Instruct', token='$HF_TOKEN')"
|
24 |
|
25 |
# Copy app files
|
26 |
COPY --chown=user . /app
|