File size: 1,577 Bytes
f35c74b
 
 
 
 
 
 
 
 
9227bc0
f35c74b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99f54b7
 
f35c74b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9abb58f
 
 
 
f35c74b
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.11-slim

ENV DEBIAN_FRONTEND=noninteractive \
    MODEL_REPO=ggml-org/SmolVLM2-2.2B-Instruct-GGUF \
    QUANT=Q4_K_M \
    MODEL_FILE=auto \
    MMPROJ_FILE=auto \
    MMPROJ_PREFER=Q8_0,f16,F16 \
    MODEL_DIR=/data/models/smolvlm2 \
    LLAMA_VERSION=b11277 \
    LLAMA_DIR=/opt/llama.cpp \
    LLAMA_SERVER_BIN=/opt/llama.cpp/llama-server \
    LD_LIBRARY_PATH=/opt/llama.cpp \
    LLAMA_HOST=0.0.0.0 \
    LLAMA_PORT=7860 \
    THREADS=8 \
    CTX_SIZE=8192 \
    BATCH_SIZE=default \
    UBATCH_SIZE=default \
    FLASH_ATTN=default \
    CACHE_TYPE_K=default \
    CACHE_TYPE_V=default \
    IMAGE_MAX_TOKENS=default \
    CHAT_TEMPLATE_FILE=default \
    GPU_LAYERS=0 \
    TEMPERATURE=0.2 \
    TOP_P=0.95 \
    TOP_K=64 \
    REPEAT_PENALTY=1.08 \
    HF_XET_HIGH_PERFORMANCE=1 \
    PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    curl \
    libgomp1 \
    libstdc++6 \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p "${LLAMA_DIR}" \
    && curl -fL "https://github.com/ggml-org/llama.cpp/releases/download/${LLAMA_VERSION}/llama-${LLAMA_VERSION}-bin-ubuntu-x64.tar.gz" \
        | tar -xz --strip-components=1 -C "${LLAMA_DIR}" \
    && chmod +x "${LLAMA_SERVER_BIN}"

# Build-time check: show layout and any missing libs in the build log
RUN find "${LLAMA_DIR}" -maxdepth 3 | head -50 \
    && ldd "$(find "${LLAMA_DIR}" -name llama-server -type f | head -1)"

RUN pip install --no-cache-dir huggingface_hub

WORKDIR /app
COPY app.py /app/app.py

EXPOSE 7860
CMD ["python", "app.py"]