Bitnet-Socratic-1-Bit / Dockerfile
st192011's picture
Create Dockerfile
0aa64c9 verified
# Use an official Python runtime as a parent image
FROM python:3.12-slim
# Install system dependencies needed to compile BitNet
RUN apt-get update && apt-get install -y \
cmake \
clang \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Set up a working directory
WORKDIR /app
# Clone the BitNet repo
RUN git clone --recursive https://github.com/microsoft/BitNet.git .
# Apply your proven source code fix
RUN sed -i 's/int8_t \* y_col =/const int8_t * y_col =/g' src/ggml-bitnet-mad.cpp
# Install Python requirements
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir gradio huggingface_hub
# Pre-download the model into the image so the Space boots up instantly
RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='microsoft/bitnet-b1.58-2B-4T-gguf', filename='ggml-model-i2_s.gguf', local_dir='models/BitNet-b1.58-2B-4T')"
# Compile the high-performance kernels
RUN export CC=clang && export CXX=clang++ && python3 setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
# Copy your local app code into the container
COPY app.py .
# Expose the standard port Hugging Face looks for
EXPOSE 7860
# Run the Gradio interface
CMD ["python3", "app.py"]