Spaces:
Sleeping
Sleeping
Download Dockerfile from st192011/Bitnet-Socratic-1-Bit: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/st192011/Bitnet-Socratic-1-Bit/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/st192011/Bitnet-Socratic-1-Bit/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/st192011/Bitnet-Socratic-1-Bit/resolve/main/Dockerfile
1.78 kB
| # 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 \ | |
| ffmpeg \ | |
| curl \ | |
| && 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 . | |
| # 1. Apply your proven Clang const-correctness fix | |
| RUN sed -i 's/int8_t \* y_col =/const int8_t * y_col =/g' src/ggml-bitnet-mad.cpp | |
| # 2. Fix the runtime "Word Salad / Gibberish" kernel bug (PR #551 / Issue #585) | |
| RUN sed -i 's/#define QK_I2_S 64/#define QK_I2_S 128/g' src/ggml-bitnet-mad.cpp | |
| # Install Python requirements (keeps your original pattern) | |
| RUN pip install --no-cache-dir -r requirements.txt || true | |
| RUN pip install --no-cache-dir gradio huggingface_hub edge-tts gTTS transformers openai-whisper | |
| # 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 kernels; verify the compiled llama-cli binary exists to prevent the post-conversion exit code 1 | |
| RUN export CC=clang && export CXX=clang++ && \ | |
| (python3 setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s || test -f build/bin/llama-cli) | |
| # Copy your local app code into the container | |
| COPY app.py . | |
| # Hugging Face Spaces non-root user configuration | |
| RUN useradd -m -u 1000 user && \ | |
| chown -R user:user /app && \ | |
| chmod -R 777 /app /tmp | |
| USER user | |
| # Expose the standard port Hugging Face looks for | |
| EXPOSE 7860 | |
| # Run the Gradio interface | |
| CMD ["python3", "app.py"] |