Tonic commited on
Commit
88b7d0d
·
unverified ·
1 Parent(s): da2a1ed

using docker initial commit

Browse files
Files changed (2) hide show
  1. Dockerfile +38 -30
  2. 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
- wget \
9
- gnupg \
10
- lsb-release \
11
- software-properties-common \
12
- && rm -rf /var/lib/apt/lists/*
13
 
14
  # Add LLVM repository for Clang 18
 
15
  RUN wget https://apt.llvm.org/llvm.sh && \
16
- chmod +x llvm.sh && \
17
- ./llvm.sh 18 && \
18
- rm llvm.sh
19
 
20
  # Install system dependencies for bitnet.cpp and Python
 
21
  RUN apt-get update && apt-get install -y \
22
- build-essential \
23
- cmake \
24
- clang-18 \
25
- git \
26
- python3.9 \
27
- python3-pip \
28
- && rm -rf /var/lib/apt/lists/*
29
 
30
  # Set Clang as default compiler
31
- ENV CC=/usr/bin/clang-18
32
- ENV CXX=/usr/bin/clang++-18
33
 
34
  # Create a non-root user (Hugging Face Spaces run as non-root)
35
- RUN useradd -m -u 1000 user
36
- USER user
37
- WORKDIR /home/user/app
 
 
 
38
 
39
  # Install Python dependencies
40
- COPY requirements.txt .
41
- RUN pip3 install --no-cache-dir -r requirements.txt
42
 
43
- # Clone and build bitnet.cpp
44
- RUN git clone https://github.com/microsoft/BitNet.git bitnet.cpp
45
- WORKDIR /home/user/app/bitnet.cpp
46
- RUN mkdir build && cd build && \
47
- cmake .. -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 && \
48
- make -j$(nproc)
 
49
 
50
  # Copy application code
51
- WORKDIR /home/user/app
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