Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -4
Dockerfile
CHANGED
|
@@ -4,13 +4,15 @@ FROM python:3.12-slim
|
|
| 4 |
# Prevent interactive prompts during installation
|
| 5 |
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"
|
| 13 |
ENV GRADIO_SERVER_PORT=7860
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Install system dependencies needed to compile BitNet AND process audio (ffmpeg)
|
| 16 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -20,6 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 20 |
git \
|
| 21 |
ffmpeg \
|
| 22 |
curl \
|
|
|
|
|
|
|
| 23 |
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
|
| 25 |
# Set up working directory
|
|
@@ -44,8 +48,8 @@ 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
|
| 48 |
-
RUN python3 setup_env.py -
|
| 49 |
|
| 50 |
# Copy your local app code into the container
|
| 51 |
COPY app.py .
|
|
|
|
| 4 |
# Prevent interactive prompts during installation
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
ENV CC=/usr/bin/clang
|
| 8 |
+
ENV CXX=/usr/bin/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"
|
| 13 |
ENV GRADIO_SERVER_PORT=7860
|
| 14 |
+
# Ensure runtime finds compiled BitNet shared libraries
|
| 15 |
+
ENV LD_LIBRARY_PATH="/app/build/bin:/app/build/3rdparty/llama.cpp/src:/app/build/3rdparty/llama.cpp/ggml/src:${LD_LIBRARY_PATH}"
|
| 16 |
|
| 17 |
# Install system dependencies needed to compile BitNet AND process audio (ffmpeg)
|
| 18 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 22 |
git \
|
| 23 |
ffmpeg \
|
| 24 |
curl \
|
| 25 |
+
&& update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 \
|
| 26 |
+
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 \
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
| 29 |
# Set up working directory
|
|
|
|
| 48 |
# Pre-download Whisper model so the Space boots instantly without downloading at runtime
|
| 49 |
RUN python3 -c "from transformers import pipeline; pipeline('automatic-speech-recognition', model='openai/whisper-base', device=-1)"
|
| 50 |
|
| 51 |
+
# Compile BitNet kernels using --hf-repo so gen_code() knows the model architecture
|
| 52 |
+
RUN python3 setup_env.py --hf-repo microsoft/BitNet-b1.58-2B-4T -q i2_s || (cat logs/*.log 2>/dev/null && exit 1)
|
| 53 |
|
| 54 |
# Copy your local app code into the container
|
| 55 |
COPY app.py .
|