Files
llava-docker/Dockerfile
2023-10-20 10:09:28 +02:00

111 lines
2.7 KiB
Docker

# Stage 1: Base
FROM nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 as base
ARG LLAVA_VERSION=v1.1.1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=on \
SHELL=/bin/bash
# Create workspace working directory
WORKDIR /
# Install Ubuntu packages
RUN apt update && \
apt -y upgrade && \
apt install -y --no-install-recommends \
software-properties-common \
build-essential \
python3.10-venv \
python3-pip \
python3-tk \
python3-dev \
nginx \
bash \
dos2unix \
git \
ncdu \
net-tools \
openssh-server \
libglib2.0-0 \
libsm6 \
libgl1 \
libxrender1 \
libxext6 \
ffmpeg \
wget \
curl \
psmisc \
rsync \
vim \
zip \
unzip \
htop \
pkg-config \
libcairo2-dev \
libgoogle-perftools4 \
libtcmalloc-minimal4 \
apt-transport-https \
ca-certificates && \
update-ca-certificates && \
apt clean && \
rm -rf /var/lib/apt/lists/* && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# Set Python
RUN ln -s /usr/bin/python3.10 /usr/bin/python
# Stage 2: Install LLaVA and python modules
FROM base as setup
# Create and use the Python venv
RUN python3 -m venv /venv
# Install Torch
RUN source /venv/bin/activate && \
pip3 install --no-cache-dir torch==2.0.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 && \
pip3 install --no-cache-dir xformers==0.0.22 && \
deactivate
# Clone the git repo of LLaVA and set version
WORKDIR /
RUN git clone https://github.com/ashleykleynhans/LLaVA.git
# cd /LLaVA && \
# git checkout ${LLAVA_VERSION}
# Install the dependencies for LLaVA
WORKDIR /LLaVA
RUN source /venv/bin/activate && \
pip3 install --upgrade pip && \
pip3 install wheel && \
pip3 install -e . && \
pip3 install ninja && \
pip3 install flash-attn --no-build-isolation && \
pip3 install transformers==4.34.1 && \
deactivate
# Install Jupyter
RUN pip3 install -U --no-cache-dir jupyterlab \
jupyterlab_widgets \
ipykernel \
ipywidgets \
gdown
# Install runpodctl
RUN wget https://github.com/runpod/runpodctl/releases/download/v1.10.0/runpodctl-linux-amd -O runpodctl && \
chmod a+x runpodctl && \
mv runpodctl /usr/local/bin
# NGINX Proxy
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/502.html /usr/share/nginx/html/502.html
# Copy the scripts
WORKDIR /
COPY --chmod=755 scripts/* ./
# Start the container
SHELL ["/bin/bash", "--login", "-c"]
CMD [ "/start.sh" ]