AurelioAguirre commited on
Commit
70865a3
·
1 Parent(s): ea61392

Fixing model download issue v11

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -24
Dockerfile CHANGED
@@ -28,30 +28,14 @@ RUN pip install --no-cache-dir -r requirements.txt
28
  RUN mkdir -p /app/main/checkpoints && \
29
  chmod 777 /app/main/checkpoints
30
 
31
- # The token will be passed during build time
32
- ARG HF_TOKEN
33
- ENV HF_TOKEN=${HF_TOKEN}
34
-
35
- # Verify token and environment
36
- RUN echo "Token length: ${#HF_TOKEN}" && \
37
- echo "Cache directory:" && \
38
- ls -la /app/.cache/huggingface && \
39
- echo "Checkpoints directory:" && \
40
- ls -la /app/main/checkpoints && \
41
- echo "Testing huggingface-cli" && \
42
- huggingface-cli whoami
43
-
44
- # Download model using litgpt command line with verbose output
45
- RUN if [ -n "$HF_TOKEN" ]; then \
46
- echo "Starting model download..." && \
47
- litgpt download mistralai/Mistral-7B-Instruct-v0.3 \
48
- --access_token ${HF_TOKEN} \
49
- --checkpoint_dir /app/main/checkpoints \
50
- --verbose || { echo "Download failed with status $?"; exit 1; }; \
51
- else \
52
- echo "No Hugging Face token provided. Models will need to be downloaded separately."; \
53
- exit 1; \
54
- fi
55
 
56
  # Copy the rest of the application
57
  COPY . .
 
28
  RUN mkdir -p /app/main/checkpoints && \
29
  chmod 777 /app/main/checkpoints
30
 
31
+ # Download model using litgpt command line with proper secret mounting
32
+ RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
33
+ export HF_TOKEN=$(cat /run/secrets/HF_TOKEN) && \
34
+ echo "Starting model download..." && \
35
+ litgpt download mistralai/Mistral-7B-Instruct-v0.3 \
36
+ --access_token ${HF_TOKEN} \
37
+ --checkpoint_dir /app/main/checkpoints \
38
+ --verbose || { echo "Download failed with status $?"; exit 1; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  # Copy the rest of the application
41
  COPY . .