KingHacker9000 commited on
Commit
f6a30e4
·
1 Parent(s): 3afecba

switch setup-10

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -27
Dockerfile CHANGED
@@ -1,59 +1,44 @@
1
- # syntax=docker/dockerfile:1.3
2
-
3
  FROM ghcr.io/huggingface/text-generation-inference:3.3.4@sha256:91822fefc613d742f19f56b321925e81e41690dda29673c070fc68a65ae6bdb2
4
 
5
- # Install system dependencies and Python 3.11
6
  RUN apt-get update && \
7
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
8
  build-essential git cmake ninja-build pkg-config curl ca-certificates gnupg software-properties-common \
9
  python3-pip python3.11 python3.11-dev python3.11-venv python3.11-distutils python3-dev tzdata && \
10
- # Preconfigure timezone to UTC
11
  ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata && \
12
- # Add CUDA keyring and repository
13
  curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | \
14
  gpg --dearmor --batch --yes -o /usr/share/keyrings/cuda-archive-keyring.gpg && \
15
  echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 /" \
16
  > /etc/apt/sources.list.d/cuda.list && \
17
  apt-get update && \
18
  apt-get install -y --no-install-recommends cuda-compiler-11-8 && \
19
- # Clean up
20
  rm -rf /var/lib/apt/lists/* && \
21
  ldconfig
22
 
23
- # Ensure python3 points to 3.11
24
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
25
 
26
- # Upgrade pip and install PyTorch with CUDA support
27
  RUN python3 -m pip install --upgrade pip && \
28
- python3 -m pip install \
29
- torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
30
-
31
- # 1. Create a writeable cache directory
32
- RUN mkdir -p /tmp/hf_cache/hub
33
-
34
- # 2. Grant permissions so any user in the container can write there
35
- RUN chmod -R a+rwX /tmp/hf_cache
36
 
37
- # 3. Point Hugging Face Hub to that cache
38
- ENV HF_HOME=/tmp/hf_cache \
39
- HF_HUB_CACHE=/tmp/hf_cache/hub
40
-
41
- RUN \
42
- # Clone diffvg recursively so we get the thrust submodule too
43
- git clone --depth 1 --recursive https://github.com/BachiLi/diffvg.git /tmp/diffvg && \
44
  cd /tmp/diffvg && \
45
- # Replace bundled pybind11 with the released v2.12.1
46
  rm -rf pybind11 && \
47
  git clone --depth 1 --branch v2.12.1 https://github.com/pybind/pybind11.git pybind11 && \
48
  sed -i 's/^\s*cmake_minimum_required(VERSION .*$/cmake_minimum_required(VERSION 3.5)/' pybind11/CMakeLists.txt && \
49
- # Configure & build without CUDA
50
  mkdir build && cd build && \
51
  cmake .. \
52
  -DCMAKE_BUILD_TYPE=Release \
53
  -DCMAKE_CXX_STANDARD=14 \
54
- -DDIFFVG_CUDA=0 && \
 
55
  make -j$(nproc) && \
56
- # Install and clean up
57
  cd /tmp/diffvg && python3 setup.py install && \
58
  rm -rf /tmp/diffvg
59
 
 
 
 
 
 
 
1
  FROM ghcr.io/huggingface/text-generation-inference:3.3.4@sha256:91822fefc613d742f19f56b321925e81e41690dda29673c070fc68a65ae6bdb2
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && \
5
  DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
6
  build-essential git cmake ninja-build pkg-config curl ca-certificates gnupg software-properties-common \
7
  python3-pip python3.11 python3.11-dev python3.11-venv python3.11-distutils python3-dev tzdata && \
 
8
  ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime && dpkg-reconfigure --frontend noninteractive tzdata && \
 
9
  curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | \
10
  gpg --dearmor --batch --yes -o /usr/share/keyrings/cuda-archive-keyring.gpg && \
11
  echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 /" \
12
  > /etc/apt/sources.list.d/cuda.list && \
13
  apt-get update && \
14
  apt-get install -y --no-install-recommends cuda-compiler-11-8 && \
 
15
  rm -rf /var/lib/apt/lists/* && \
16
  ldconfig
17
 
18
+ # Use Python 3.11 by default
19
  RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
20
 
21
+ # Upgrade pip and install PyTorch
22
  RUN python3 -m pip install --upgrade pip && \
23
+ python3 -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
 
 
 
 
 
 
 
24
 
25
+ # Build and install diffvg (with thrust support)
26
+ RUN git clone --depth 1 --recursive https://github.com/BachiLi/diffvg.git /tmp/diffvg && \
 
 
 
 
 
27
  cd /tmp/diffvg && \
28
+ # Replace internal pybind11, keep thrust submodule
29
  rm -rf pybind11 && \
30
  git clone --depth 1 --branch v2.12.1 https://github.com/pybind/pybind11.git pybind11 && \
31
  sed -i 's/^\s*cmake_minimum_required(VERSION .*$/cmake_minimum_required(VERSION 3.5)/' pybind11/CMakeLists.txt && \
 
32
  mkdir build && cd build && \
33
  cmake .. \
34
  -DCMAKE_BUILD_TYPE=Release \
35
  -DCMAKE_CXX_STANDARD=14 \
36
+ -DDIFFVG_CUDA=0 \
37
+ -DTHRUST_INCLUDE_DIR=/tmp/diffvg/thrust && \
38
  make -j$(nproc) && \
 
39
  cd /tmp/diffvg && python3 setup.py install && \
40
  rm -rf /tmp/diffvg
41
 
42
+ # Entrypoint remains unchanged
43
+ ENTRYPOINT ["/usr/local/bin/text-generation-launcher"]
44
+