Spaces:
Sleeping
Sleeping
| FROM debian:12-slim | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV VENV_PATH=/BitNet/venv | |
| ENV PATH="$VENV_PATH/bin:$PATH" | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| curl \ | |
| git \ | |
| cmake \ | |
| build-essential \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| python-is-python3 \ | |
| ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Clone BitNet | |
| RUN git clone --recursive https://github.com/microsoft/BitNet.git | |
| # Copy local files | |
| COPY . /BitNet | |
| WORKDIR /BitNet | |
| # Create virtual environment | |
| RUN python3 -m venv $VENV_PATH | |
| # Upgrade pip and install dependencies inside venv | |
| RUN python3 -m pip install --upgrade pip | |
| RUN python3 -m pip install -r requirements.txt | |
| RUN python3 -m pip install huggingface_hub | |
| # Optional: Hugging Face token | |
| ARG HF_TOKEN | |
| RUN huggingface-cli login --token $HF_TOKEN || true | |
| # Download model | |
| RUN python3 -m huggingface_hub download HF1BitLLM/Llama3-8B-1.58-100B-tokens --local-dir models/Llama3-8B-1.58-100B-tokens | |
| # Setup environment / quantization | |
| RUN python3 -m setup_env -md models/Llama3-8B-1.58-100B-tokens -q i2_s | |
| # Build C++ runtime | |
| RUN mkdir -p build && cd build && cmake .. && make -j$(nproc) | |
| # Default command | |
| CMD ["python3", "app.py"] | |