Delete Dockerfile with huggingface_hub
Browse files- Dockerfile +0 -45
Dockerfile
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
# ---- Build stage: 编译 llama.cpp 的 llama-server (CPU only) ----
|
| 2 |
-
FROM python:3.11-slim AS build
|
| 3 |
-
|
| 4 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
-
build-essential cmake git libcurl4-openssl-dev ca-certificates \
|
| 6 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
-
RUN git clone --depth 1 https://github.com/ggml-org/llama.cpp /llama.cpp
|
| 9 |
-
WORKDIR /llama.cpp
|
| 10 |
-
|
| 11 |
-
# GGML_NATIVE=OFF: HF Space的CPU型号不确定,不能假设AVX512等指令集,
|
| 12 |
-
# 用通用编译避免"illegal instruction"崩溃。LLAMA_CURL=ON 让 -hf 直接从HF拉模型。
|
| 13 |
-
RUN cmake -B build -DGGML_NATIVE=OFF -DLLAMA_CURL=ON -DCMAKE_BUILD_TYPE=Release \
|
| 14 |
-
&& cmake --build build --target llama-server -j "$(nproc)"
|
| 15 |
-
|
| 16 |
-
# ---- Runtime stage ----
|
| 17 |
-
FROM python:3.11-slim
|
| 18 |
-
|
| 19 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 20 |
-
libcurl4 ca-certificates \
|
| 21 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
-
|
| 23 |
-
COPY --from=build /llama.cpp/build/bin/llama-server /usr/local/bin/llama-server
|
| 24 |
-
|
| 25 |
-
# HF Space Docker容器默认以非root用户运行,/tmp通常可写,用它做模型缓存目录
|
| 26 |
-
ENV HF_HOME=/tmp/hf_cache
|
| 27 |
-
RUN mkdir -p /tmp/hf_cache && chmod -R 777 /tmp/hf_cache
|
| 28 |
-
|
| 29 |
-
# ---- 可在Space的 Settings > Variables 里覆盖,无需重新构建镜像 ----
|
| 30 |
-
ENV MODEL_REPO="Qwen/Qwen3-4B-Instruct-2507-GGUF"
|
| 31 |
-
ENV MODEL_QUANT="Q4_K_M"
|
| 32 |
-
ENV CTX_SIZE="4096"
|
| 33 |
-
ENV N_THREADS="2"
|
| 34 |
-
|
| 35 |
-
EXPOSE 7860
|
| 36 |
-
|
| 37 |
-
# --jinja: 启用chat template里的tool-calling语法解析,让 /v1/chat/completions
|
| 38 |
-
# 支持传 tools=[...] 并正确输出 tool_calls
|
| 39 |
-
CMD ["sh", "-c", "llama-server \
|
| 40 |
-
-hf ${MODEL_REPO}:${MODEL_QUANT} \
|
| 41 |
-
--host 0.0.0.0 \
|
| 42 |
-
--port 7860 \
|
| 43 |
-
-c ${CTX_SIZE} \
|
| 44 |
-
-t ${N_THREADS} \
|
| 45 |
-
--jinja"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|