meg HF staff commited on
Commit
0ca9d5a
·
verified ·
1 Parent(s): 0ce31eb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -3
Dockerfile CHANGED
@@ -1,11 +1,43 @@
1
- FROM python:3.9
2
  FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
3
 
4
  RUN useradd -m -u 1000 user
5
-
6
  ENV PATH=/opt/conda/bin:$PATH
7
 
8
- RUN pip install --no-cache-dir --upgrade -r /requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .
10
 
11
  USER user
 
 
1
  FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
2
 
3
  RUN useradd -m -u 1000 user
 
4
  ENV PATH=/opt/conda/bin:$PATH
5
 
6
+
7
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
8
+ build-essential \
9
+ ca-certificates \
10
+ ccache \
11
+ curl \
12
+ python3 \
13
+ python3-pip \
14
+ git && \
15
+ rm -rf /var/lib/apt/lists/*
16
+
17
+ # Install conda
18
+ # translating Docker's TARGETPLATFORM into mamba arches
19
+ RUN case ${TARGETPLATFORM} in \
20
+ "linux/arm64") MAMBA_ARCH=aarch64 ;; \
21
+ *) MAMBA_ARCH=x86_64 ;; \
22
+ esac && \
23
+ curl -fsSL -v -o ~/mambaforge.sh -O "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh"
24
+ RUN chmod +x ~/mambaforge.sh && \
25
+ bash ~/mambaforge.sh -b -p /opt/conda && \
26
+ rm ~/mambaforge.sh
27
+
28
+ # Install pytorch
29
+ # On arm64 we exit with an error code
30
+ RUN case ${TARGETPLATFORM} in \
31
+ "linux/arm64") exit 1 ;; \
32
+ *) /opt/conda/bin/conda update -y conda && \
33
+ /opt/conda/bin/conda install -c "${INSTALL_CHANNEL}" -c "${CUDA_CHANNEL}" -y "python=${PYTHON_VERSION}" "pytorch=$PYTORCH_VERSION" "pytorch-cuda=$(echo $CUDA_VERSION | cut -d'.' -f 1-2)" ;; \
34
+ esac && \
35
+ /opt/conda/bin/conda clean -ya
36
+
37
+
38
+ COPY ./requirements.txt requirements.txt
39
+
40
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
41
  RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .
42
 
43
  USER user