CoolFace
Apppublic

AIEnergyScore/launch-computation-example

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Dockerfile81 linesDownload Raw Back to root
1FROM nvidia/cuda:12.2.0-devel-ubuntu22.042 3ARG PYTORCH_VERSION=2.4.04ARG PYTHON_VERSION=3.95ARG CUDA_VERSION=12.16ARG MAMBA_VERSION=24.3.0-07ARG CUDA_CHANNEL=nvidia8ARG INSTALL_CHANNEL=pytorch9# Automatically set by buildx10ARG TARGETPLATFORM11 12 13#ENV HOME=/home/user \14#	PATH=/home/user/.local/bin:/opt/conda/bin:$PATH15 16ENV PATH=/opt/conda/bin:$PATH17 18RUN mkdir -p .cache19#RUN mkdir -p data20# I'm not sure how to allow later python files used here to write to .cache without making it world-writeable.21RUN chmod 777 -R .cache22#RUN chmod 777 -R data23 24RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \25        build-essential \26        ca-certificates \27        ccache \28        curl \29        python3 \30        python3-pip \31        git && \32        rm -rf /var/lib/apt/lists/*33 34# Install conda35# translating Docker's TARGETPLATFORM into mamba arches36RUN case ${TARGETPLATFORM} in \37         "linux/arm64")  MAMBA_ARCH=aarch64  ;; \38         *)              MAMBA_ARCH=x86_64   ;; \39    esac && \40    curl -fsSL -v -o ~/mambaforge.sh -O  "https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-${MAMBA_ARCH}.sh"41RUN chmod +x ~/mambaforge.sh && \42    bash ~/mambaforge.sh -b -p /opt/conda && \43    rm ~/mambaforge.sh44 45# Install pytorch46# On arm64 we exit with an error code47RUN case ${TARGETPLATFORM} in \48         "linux/arm64")  exit 1 ;; \49         *)              /opt/conda/bin/conda update -y conda &&  \50                         /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)"  ;; \51    esac && \52    /opt/conda/bin/conda clean -ya53 54COPY ./requirements.txt requirements.txt55RUN pip install -r requirements.txt56 57RUN git clone -b energy_star_dev https://github.com/huggingface/optimum-benchmark.git /optimum-benchmark && cd optimum-benchmark && pip install -e .58 59COPY ./.cache /.cache60COPY ./entrypoint.sh /entrypoint.sh61COPY ./pause_space.py /pause_space.py62COPY ./parse_requests.py /parse_requests.py63COPY ./process_runs.py /process_runs.py64COPY ./runs /runs65COPY ./attempts.txt /attempts.txt66COPY ./failed_attempts.txt /failed_attempts.txt67 68 69RUN chmod 777 *.py70RUN chmod 777 -R /runs71RUN chmod 777 -R /.cache72RUN chmod 777 /attempts.txt73RUN chmod 777 /failed_attempts.txt74RUN chmod +x /entrypoint.sh75 76# Expose the secret DEBUG at buildtime and use its value as git remote URL77RUN --mount=type=secret,id=DEBUG,mode=0444,required=true \78 git init && \79 git remote add origin $(cat /run/secrets/DEBUG)80 81ENTRYPOINT ["/entrypoint.sh"]