Hendrik Langer
2 years ago
5 changed files with 91 additions and 33 deletions
@ -1,46 +1,54 @@ |
|||
ARG BASE_IMAGE=nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04 |
|||
FROM ${BASE_IMAGE} as dev-base |
|||
|
|||
ARG MODEL_NAME |
|||
ENV MODEL_NAME=${MODEL_NAME} |
|||
|
|||
WORKDIR /src |
|||
|
|||
WORKDIR / |
|||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
|||
ENV DEBIAN_FRONTEND noninteractive\ |
|||
SHELL=/bin/bash |
|||
RUN apt-key del 7fa2af80 |
|||
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub |
|||
|
|||
RUN apt-get update --yes && \ |
|||
# - apt-get upgrade is run to patch known vulnerabilities in apt-get packages as |
|||
# the ubuntu base image is rebuilt too seldom sometimes (less than once a month) |
|||
apt-get upgrade --yes && \ |
|||
apt install --yes --no-install-recommends \ |
|||
build-essential \ |
|||
ca-certificates \ |
|||
git \ |
|||
git-lfs \ |
|||
wget \ |
|||
curl \ |
|||
bash \ |
|||
libgl1 \ |
|||
software-properties-common \ |
|||
openssh-server && \ |
|||
apt-get clean && rm -rf /var/lib/apt/lists/* && \ |
|||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen |
|||
|
|||
RUN apt-get update && apt-get install -y --no-install-recommends |
|||
RUN apt-get install software-properties-common -y |
|||
RUN add-apt-repository ppa:deadsnakes/ppa |
|||
RUN apt-get install python3.8 -y |
|||
RUN apt-get install python3-pip -y |
|||
RUN apt-get install python3.8-distutils -y |
|||
RUN apt-key del 7fa2af80 && \ |
|||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub |
|||
|
|||
RUN add-apt-repository ppa:deadsnakes/ppa && \ |
|||
apt-get install python3.10 python3.10-dev python3.10-venv python3-pip -y --no-install-recommends && \ |
|||
apt-get clean && rm -rf /var/lib/apt/lists/* |
|||
|
|||
RUN apt-get install python3.8-dev -y |
|||
RUN apt-get install python3.8-venv -y |
|||
RUN python3.8 -m venv /venv |
|||
ENV PATH=/venv/bin:$PATH |
|||
RUN pip install --upgrade pip && \ |
|||
pip install huggingface-hub && \ |
|||
pip install diffusers && \ |
|||
pip install safetensors && \ |
|||
pip install torch torchvision torchaudio --extra-index-url=https://download.pytorch.org/whl/cu116 && \ |
|||
pip install bitsandbytes && \ |
|||
pip install transformers accelerate xformers triton && \ |
|||
pip install runpod |
|||
|
|||
RUN python3.8 -m pip install --upgrade pip==23.0.1 |
|||
RUN python3.8 -m pip install runpod==0.9.1 |
|||
RUN python3.8 -m pip install torch==2.0.0 |
|||
RUN python3.8 -m pip install transformers==4.27.2 |
|||
RUN mkdir /workspace |
|||
WORKDIR /workspace |
|||
|
|||
COPY model_fetcher.py /src/model_fetcher.py |
|||
RUN python3.8 model_fetcher.py --model_name=${MODEL_NAME} |
|||
COPY model_fetcher.py /workspace/ |
|||
RUN python model_fetcher.py --model_name=${MODEL_NAME} |
|||
#RUN git lfs install && \ |
|||
# git clone --depth 1 https://huggingface.co/${MODEL_NAME} |
|||
|
|||
COPY runpod_infer.py /src/runpod_infer.py |
|||
COPY test_input.json /src/test_input.json |
|||
COPY runpod_infer.py /workspace/ |
|||
COPY test_input.json /workspace/ |
|||
|
|||
CMD python3.8 -u runpod_infer.py --model_name=${MODEL_NAME} |
|||
CMD python -u runpod_infer.py --model_name=${MODEL_NAME} |
|||
|
Loading…
Reference in new issue