st192011 commited on
Commit
0c1543a
·
verified ·
1 Parent(s): 38bc2cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -5
Dockerfile CHANGED
@@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive
6
  ENV PYTHONUNBUFFERED=1
7
  ENV CC=clang
8
  ENV CXX=clang++
9
- # Centralize HF cache inside /app so non-root user 1000 can access pre-cached Whisper
10
  ENV HF_HOME="/app/.cache"
11
  # Hugging Face Spaces port configuration
12
  ENV GRADIO_SERVER_NAME="0.0.0.0"
@@ -25,11 +25,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
25
  # Set up working directory
26
  WORKDIR /app
27
 
28
- # Clone BitNet with submodules and checkout stable May 18, 2025 commit
29
  RUN git clone --recursive https://github.com/microsoft/BitNet.git . && \
30
- git checkout 6c2c08f4305f6bfd9d83df9ebfd30d740eb61e38 && \
31
  git submodule update --init --recursive
32
 
 
 
 
 
 
33
 
34
  # Install CPU-optimized PyTorch first
35
  RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
@@ -44,8 +49,9 @@ RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(rep
44
  # Pre-download Whisper model so the Space boots instantly without downloading at runtime
45
  RUN python3 -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-base', device=-1)"
46
 
47
- # Compile high-performance kernels (as used in your working setup)
48
- RUN export CC=clang && export CXX=clang++ && python3 setup_env.py -md models/BitNet-b1.58-2B-4T -q i2_s
 
49
 
50
  # Copy your local app code into the container
51
  COPY app.py .
 
6
  ENV PYTHONUNBUFFERED=1
7
  ENV CC=clang
8
  ENV CXX=clang++
9
+ # Centralize HF cache inside /app so non-root user 1000 can access pre-cached models
10
  ENV HF_HOME="/app/.cache"
11
  # Hugging Face Spaces port configuration
12
  ENV GRADIO_SERVER_NAME="0.0.0.0"
 
25
  # Set up working directory
26
  WORKDIR /app
27
 
28
+ # Clone BitNet with submodules and checkout stable June 2025 commit
29
  RUN git clone --recursive https://github.com/microsoft/BitNet.git . && \
30
+ git checkout 404980eecae38affa4871c3e419eae3f44536a95 && \
31
  git submodule update --init --recursive
32
 
33
+ # 1. Apply your proven Clang const-pointer source code fix (file exists in June)
34
+ RUN sed -i 's/int8_t \* y_col =/const int8_t * y_col =/g' src/ggml-bitnet-mad.cpp
35
+
36
+ # 2. Provide the LUT kernel header that CMake unconditionally requires
37
+ RUN cp preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h include/bitnet-lut-kernels.h
38
 
39
  # Install CPU-optimized PyTorch first
40
  RUN pip install --no-cache-dir torch torchaudio --index-url https://download.pytorch.org/whl/cpu
 
49
  # Pre-download Whisper model so the Space boots instantly without downloading at runtime
50
  RUN python3 -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-base', device=-1)"
51
 
52
+ # Compile directly with CMake (now succeeds because bitnet-lut-kernels.h is present)
53
+ RUN cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ && \
54
+ cmake --build build --config Release -j$(nproc)
55
 
56
  # Copy your local app code into the container
57
  COPY app.py .