Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +18 -0
Dockerfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Giai đoạn 1: Download model bằng Python
|
| 2 |
+
FROM python:3.10-slim AS downloader
|
| 3 |
+
|
| 4 |
+
# Cài đặt thư viện cần thiết
|
| 5 |
+
RUN pip install --no-cache-dir huggingface_hub
|
| 6 |
+
|
| 7 |
+
# Tải model (Thay 'id/model' bằng model bạn cần, ví dụ 'Qwen/Qwen2.5-7B-Instruct')
|
| 8 |
+
# local_dir='/model_weight' là nơi chứa file sau khi tải
|
| 9 |
+
RUN python -c "from huggingface_hub import snapshot_download; \
|
| 10 |
+
snapshot_download(repo_id='Qwen/Qwen2.5-7B-Instruct', \
|
| 11 |
+
local_dir='/model_weight', \
|
| 12 |
+
ignore_patterns=['*.msgpack', '*.h5', '*.ot'])"
|
| 13 |
+
|
| 14 |
+
# Giai đoạn 2: Tạo Image siêu nhẹ chỉ chứa Weight
|
| 15 |
+
# Sử dụng alpine hoặc busybox để image có sẵn shell (dễ cp ra ngoài)
|
| 16 |
+
FROM alpine:latest
|
| 17 |
+
COPY --from=downloader /model_weight /models
|
| 18 |
+
CMD ["sh", "-c", "sleep infinity"]
|