From dc3daedffcb40914e277a35fdc58fda64c4e357d Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Fri, 13 Mar 2026 15:44:38 +0800 Subject: [PATCH 1/3] fix: update llama.cpp submodule with chrono fix --- 3rdparty/llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/llama.cpp b/3rdparty/llama.cpp index 1f86f058d..0e7e4f387 160000 --- a/3rdparty/llama.cpp +++ b/3rdparty/llama.cpp @@ -1 +1 @@ -Subproject commit 1f86f058de0c3f4098dedae2ae8653c335c868a1 +Subproject commit 0e7e4f387c4a49e15b06a26b98d353cb3402c435 From 5dff553cafcf3fc53f29b4e99e78628d316e88f1 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Fri, 13 Mar 2026 02:35:46 +0800 Subject: [PATCH 2/3] Add Dockerfile for containerized deployment - Enables running BitNet in Kubernetes or Docker environments - Uses Python 3.11-slim as base image - Installs all build dependencies (cmake, build-essential) - Includes Python requirements for inference - Resolves: microsoft/BitNet#433 --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e97d64ed9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# syntax=docker/dockerfile:1 +# BitNet Dockerfile - CPU inference for 1-bit LLMs +# Build: docker build -t bitnet . +# Run: docker run --rm -it bitnet python run_inference.py -m models/BitNet-b1.58-2B-4T/ggml-model-i2_s.gguf -p "Your prompt" -cnv + +FROM python:3.11-slim + +# Set environment variables +ENV PYTHONUNBUFFERED=1 \ + DEBIAN_FRONTEND=noninteractive \ + PIP_NO_CACHE_DIR=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + git \ + wget \ + curl \ + libomp-dev \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /workspace + +# Clone BitNet repository (for builds from source) +# If building from local source, copy files instead +COPY . . + +# Install Python dependencies +RUN pip install -r requirements.txt + +# Build the project (optional - can be done at runtime with setup_env.py) +# This creates the native extensions needed for inference +RUN git submodule update --init --recursive 2>/dev/null || true + +# Create models directory +RUN mkdir -p models + +# Default command shows help +CMD ["python", "run_inference.py", "--help"] From f4ed8fb0b374e114caad76a4aa1e3217b439d8d5 Mon Sep 17 00:00:00 2001 From: Jah-yee Date: Fri, 13 Mar 2026 19:23:13 +0800 Subject: [PATCH 3/3] fix: move sys.exit(1) inside except block in run_command The sys.exit(1) was at wrong indentation level - same as try block instead of inside except block. This caused the function to always exit with code 1 after running any command, even on success. Fixes: setup_env.py line 107, utils/e2e_benchmark.py line 23 --- setup_env.py | 2 +- utils/e2e_benchmark.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_env.py b/setup_env.py index 3bf5fb8f7..4ef7683b8 100644 --- a/setup_env.py +++ b/setup_env.py @@ -104,7 +104,7 @@ def run_command(command, shell=False, log_step=None): subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: logging.error(f"Error occurred while running command: {e}") - sys.exit(1) + sys.exit(1) def prepare_model(): _, arch = system_info() diff --git a/utils/e2e_benchmark.py b/utils/e2e_benchmark.py index 07f93ed72..464780bd5 100644 --- a/utils/e2e_benchmark.py +++ b/utils/e2e_benchmark.py @@ -20,7 +20,7 @@ def run_command(command, shell=False, log_step=None): subprocess.run(command, shell=shell, check=True) except subprocess.CalledProcessError as e: logging.error(f"Error occurred while running command: {e}") - sys.exit(1) + sys.exit(1) def run_benchmark(): build_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "build")