Spaces:
Sleeping
Sleeping
Update Dockerfile
#2
by Yakimask - opened
- Dockerfile +10 -22
Dockerfile
CHANGED
|
@@ -1,33 +1,21 @@
|
|
| 1 |
-
# 1.
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
# 2.
|
| 5 |
-
|
| 6 |
-
build-essential \
|
| 7 |
-
cmake \
|
| 8 |
-
ninja-build \
|
| 9 |
-
ca-certificates \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
# 3. Hugging Faceの標準ルール(ユーザー権限設定)
|
| 13 |
RUN useradd -m -u 1000 user
|
| 14 |
WORKDIR /home/user/app
|
| 15 |
-
RUN chown user:user /home/user/app
|
| 16 |
|
| 17 |
USER user
|
| 18 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
RUN pip install --no-cache-dir --upgrade pip
|
| 22 |
RUN pip install --no-cache-dir huggingface_hub
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
ENV CMAKE_GENERATOR=Ninja
|
| 26 |
-
RUN pip install --no-cache-dir "llama-cpp-python[server]"
|
| 27 |
-
|
| 28 |
-
# 6. ポート公開
|
| 29 |
EXPOSE 7860
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
CMD
|
| 33 |
-
|
|
|
|
| 1 |
+
# 1. 組み立て作業は一切やめる!作者が公開している「完成済みの公式イメージ」を使う
|
| 2 |
+
FROM ghcr.io/abetlen/llama-cpp-python:latest
|
| 3 |
|
| 4 |
+
# 2. Hugging Faceのルール(ユーザー権限)を設定するために一時的にrootになる
|
| 5 |
+
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
WORKDIR /home/user/app
|
| 8 |
+
RUN chown -R user:user /home/user/app
|
| 9 |
|
| 10 |
USER user
|
| 11 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
|
| 13 |
+
# 3. AIモデルをダウンロードするためのツールだけ入れる(これは数秒で終わります)
|
|
|
|
| 14 |
RUN pip install --no-cache-dir huggingface_hub
|
| 15 |
|
| 16 |
+
# 4. ポート公開
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
+
# 5. モデルをダウンロードしてサーバー起動
|
| 20 |
+
CMD python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF', filename='qwen2.5-coder-1.5b-instruct-q4_k_m.gguf', local_dir='./model')" && \
|
| 21 |
+
python3 -m llama_cpp.server --model ./model/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf --host 0.0.0.0 --port 7860 --n_ctx 2048 --n_threads 2 --chat_format chatml
|