Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rdparty/llama.cpp
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion setup_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion utils/e2e_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down