Spaces:
Build error
Build error
using docker initial commit
Browse files- Dockerfile +38 -30
- requirements.txt +3 -3
Dockerfile
CHANGED
@@ -1,58 +1,66 @@
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
# Set non-interactive frontend for apt
|
|
|
4 |
ENV DEBIAN_FRONTEND=noninteractive
|
5 |
|
6 |
# Install dependencies for LLVM script and repository
|
|
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
# Add LLVM repository for Clang 18
|
|
|
15 |
RUN wget https://apt.llvm.org/llvm.sh && \
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
# Install system dependencies for bitnet.cpp and Python
|
|
|
21 |
RUN apt-get update && apt-get install -y \
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
# Set Clang as default compiler
|
31 |
-
|
32 |
-
ENV CXX=/usr/bin/clang++-18
|
33 |
|
34 |
# Create a non-root user (Hugging Face Spaces run as non-root)
|
35 |
-
|
36 |
-
USER user
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
# Install Python dependencies
|
40 |
-
COPY requirements.txt .
|
41 |
-
RUN pip3 install --no-cache-dir -r requirements.txt
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
|
50 |
# Copy application code
|
51 |
-
|
52 |
-
COPY app.py .
|
53 |
|
54 |
# Expose port 7860 (required for Hugging Face Spaces)
|
|
|
55 |
EXPOSE 7860
|
56 |
|
57 |
# Run Gradio app
|
|
|
58 |
CMD ["python3", "app.py"]
|
|
|
1 |
FROM ubuntu:22.04
|
2 |
|
3 |
# Set non-interactive frontend for apt
|
4 |
+
|
5 |
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
|
7 |
# Install dependencies for LLVM script and repository
|
8 |
+
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
+
wget \
|
11 |
+
gnupg \
|
12 |
+
lsb-release \
|
13 |
+
software-properties-common \
|
14 |
+
&& rm -rf /var/lib/apt/lists/\*
|
15 |
|
16 |
# Add LLVM repository for Clang 18
|
17 |
+
|
18 |
RUN wget https://apt.llvm.org/llvm.sh && \
|
19 |
+
chmod +x llvm.sh && \
|
20 |
+
./llvm.sh 18 && \
|
21 |
+
rm llvm.sh
|
22 |
|
23 |
# Install system dependencies for bitnet.cpp and Python
|
24 |
+
|
25 |
RUN apt-get update && apt-get install -y \
|
26 |
+
build-essential \
|
27 |
+
cmake \
|
28 |
+
clang-18 \
|
29 |
+
git \
|
30 |
+
python3.9 \
|
31 |
+
python3-pip \
|
32 |
+
&& rm -rf /var/lib/apt/lists/\*
|
33 |
|
34 |
# Set Clang as default compiler
|
35 |
+
|
36 |
+
ENV CC=/usr/bin/clang-18 ENV CXX=/usr/bin/clang++-18
|
37 |
|
38 |
# Create a non-root user (Hugging Face Spaces run as non-root)
|
39 |
+
|
40 |
+
RUN useradd -m -u 1000 user USER user WORKDIR /home/user/app
|
41 |
+
|
42 |
+
# Add user’s local bin to PATH to suppress pip warnings
|
43 |
+
|
44 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
45 |
|
46 |
# Install Python dependencies
|
|
|
|
|
47 |
|
48 |
+
COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt
|
49 |
+
|
50 |
+
# Clone bitnet.cpp with submodules
|
51 |
+
|
52 |
+
RUN git clone --recurse-submodules https://github.com/microsoft/BitNet.git bitnet.cpp WORKDIR /home/user/app/bitnet.cpp RUN mkdir build && cd build && \
|
53 |
+
cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 && \
|
54 |
+
make -j$(nproc)
|
55 |
|
56 |
# Copy application code
|
57 |
+
|
58 |
+
WORKDIR /home/user/app COPY app.py .
|
59 |
|
60 |
# Expose port 7860 (required for Hugging Face Spaces)
|
61 |
+
|
62 |
EXPOSE 7860
|
63 |
|
64 |
# Run Gradio app
|
65 |
+
|
66 |
CMD ["python3", "app.py"]
|
requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
torch
|
2 |
-
git+https://github.com/shumingma/transformers.git
|
3 |
-
accelerate
|
4 |
gradio
|
5 |
numpy
|
6 |
huggingface_hub
|
|
|
1 |
+
# torch
|
2 |
+
# git+https://github.com/shumingma/transformers.git
|
3 |
+
# accelerate
|
4 |
gradio
|
5 |
numpy
|
6 |
huggingface_hub
|