test1111111 / Dockerfile
spitfire4794's picture
Serve SurjoLabs/Surjo-50m-SFT-Only (int8, 2T) on 7860
92dcc4e verified
Raw History Blame Contribute Delete
1.82 kB
# CISM inference Space: builds the native CPU engine and serves
# SurjoLabs/Surjo-50m-SFT-Only as an OpenAI-compatible API on port 7860.
#
# Endpoints once boot finishes:
# GET /health liveness
# GET /ready readiness
# GET /v1/models
# POST /v1/completions
# POST /v1/chat/completions
#
# HF_HOME is pinned so the weights downloaded at build time are the same
# ones the runtime loads -- a cold start therefore loads instead of
# re-downloading.
#
# entrypoint.sh + scripts/autobench_fleet.py (the previous AutoBench fleet
# mode) are left in the repo but not copied into this image; restoring the
# fleet means pointing ENTRYPOINT back at entrypoint.sh.
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PATH=/opt/venv/bin:$PATH \
HF_HOME=/opt/hf_cache
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-dev python3-venv build-essential cmake git \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/venv \
&& pip install --upgrade pip
WORKDIR /cism
# Build deps first for layer caching; source last for fast rebuilds.
COPY pyproject.toml README.md CMakeLists.txt ./
COPY native/ native/
COPY src/ src/
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu \
&& pip install ".[test,server]" \
&& python -c "from cism import _native as n; print('kernel_variant:', n.kernel_variant())"
# Bake the (public) checkpoint into the image.
RUN python -c "from huggingface_hub import snapshot_download; print(snapshot_download('SurjoLabs/Surjo-50m-SFT-Only'))"
EXPOSE 7860
CMD ["cism", "serve", "SurjoLabs/Surjo-50m-SFT-Only", \
"--precision", "int8", \
"--threads", "2", \
"--host", "0.0.0.0", \
"--port", "7860"]