suvasis commited on
Commit
babc5b1
·
1 Parent(s): 3034ad7

feat: auto-download Qwen model at Docker build time

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -1
Dockerfile CHANGED
@@ -60,7 +60,38 @@ COPY docker-entrypoint.sh ./
60
  RUN chmod +x docker-entrypoint.sh
61
 
62
  # Create directories for model cache and training data
63
- RUN mkdir -p /app/models /app/data/games /app/data/training /app/logs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  # Expose the application port
66
  EXPOSE 8000
 
60
  RUN chmod +x docker-entrypoint.sh
61
 
62
  # Create directories for model cache and training data
63
+ RUN mkdir -p /app/models /app/data/games /app/data/training /app/logs \
64
+ /app/models/Qwen_Qwen2.5-0.5B-Instruct \
65
+ /app/models/meta-llama_Llama-3.2-1B-Instruct
66
+
67
+ # ── Download models at build time ────────────────────────────────────────────
68
+ # Qwen2.5-0.5B — no token required
69
+ RUN pip install --no-cache-dir huggingface_hub && \
70
+ python3 -c " \
71
+ from huggingface_hub import snapshot_download; \
72
+ snapshot_download( \
73
+ repo_id='Qwen/Qwen2.5-0.5B-Instruct', \
74
+ local_dir='/app/models/Qwen_Qwen2.5-0.5B-Instruct', \
75
+ local_dir_use_symlinks=False, \
76
+ ignore_patterns=['*.msgpack','*.h5','flax_model*','tf_model*'] \
77
+ )"
78
+
79
+ # Llama-3.2-1B — requires HF token (pass as build arg: --build-arg HF_TOKEN=hf_...)
80
+ ARG HF_TOKEN=""
81
+ RUN if [ -n "$HF_TOKEN" ]; then \
82
+ python3 -c " \
83
+ from huggingface_hub import snapshot_download; \
84
+ snapshot_download( \
85
+ repo_id='meta-llama/Llama-3.2-1B-Instruct', \
86
+ local_dir='/app/models/meta-llama_Llama-3.2-1B-Instruct', \
87
+ local_dir_use_symlinks=False, \
88
+ token='${HF_TOKEN}', \
89
+ ignore_patterns=['*.msgpack','*.h5','flax_model*','tf_model*'] \
90
+ )"; \
91
+ fi
92
+
93
+ ENV WHITE_MODEL=/app/models/Qwen_Qwen2.5-0.5B-Instruct
94
+ ENV BLACK_MODEL=/app/models/meta-llama_Llama-3.2-1B-Instruct
95
 
96
  # Expose the application port
97
  EXPOSE 8000