-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/main'
- Loading branch information
Showing
1 changed file
with
29 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as builder | ||
|
||
RUN apt-get update && \ | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw apt-get update && \ | ||
apt-get install --no-install-recommends -y git vim build-essential python3-dev python3-venv && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN git clone https://github.com/oobabooga/GPTQ-for-LLaMa /build | ||
RUN git clone --depth=1 https://github.com/oobabooga/GPTQ-for-LLaMa /build | ||
|
||
WORKDIR /build | ||
|
||
RUN python3 -m venv /build/venv | ||
RUN . /build/venv/bin/activate && \ | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw \ | ||
python3 -m venv /build/venv && \ | ||
. /build/venv/bin/activate && \ | ||
pip3 install --upgrade pip setuptools wheel && \ | ||
pip3 install torch torchvision torchaudio && \ | ||
pip3 install -r requirements.txt | ||
|
@@ -25,48 +26,50 @@ FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 | |
LABEL maintainer="Your Name <[email protected]>" | ||
LABEL description="Docker image for GPTQ-for-LLaMa and Text Generation WebUI" | ||
|
||
RUN apt-get update && \ | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw apt-get update && \ | ||
apt-get install --no-install-recommends -y python3-dev libportaudio2 libasound-dev git python3 python3-pip make g++ ffmpeg && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN --mount=type=cache,target=/root/.cache/pip pip3 install virtualenv | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw pip3 install virtualenv | ||
RUN mkdir /app | ||
|
||
WORKDIR /app | ||
|
||
ARG WEBUI_VERSION | ||
RUN test -n "${WEBUI_VERSION}" && git reset --hard ${WEBUI_VERSION} || echo "Using provided webui source" | ||
|
||
# Create virtualenv | ||
RUN virtualenv /app/venv | ||
RUN . /app/venv/bin/activate && \ | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw \ | ||
. /app/venv/bin/activate && \ | ||
pip3 install --upgrade pip setuptools wheel && \ | ||
pip3 install torch torchvision torchaudio | ||
pip3 install torch torchvision torchaudio sentence_transformers xformers | ||
|
||
# Copy and install GPTQ-for-LLaMa | ||
COPY --from=builder /build /app/repositories/GPTQ-for-LLaMa | ||
RUN . /app/venv/bin/activate && \ | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw \ | ||
. /app/venv/bin/activate && \ | ||
pip3 install /app/repositories/GPTQ-for-LLaMa/*.whl | ||
|
||
COPY extensions/api/requirements.txt /app/extensions/api/requirements.txt | ||
COPY extensions/elevenlabs_tts/requirements.txt /app/extensions/elevenlabs_tts/requirements.txt | ||
COPY extensions/google_translate/requirements.txt /app/extensions/google_translate/requirements.txt | ||
COPY extensions/silero_tts/requirements.txt /app/extensions/silero_tts/requirements.txt | ||
COPY extensions/whisper_stt/requirements.txt /app/extensions/whisper_stt/requirements.txt | ||
COPY extensions/superbooga/requirements.txt /app/extensions/superbooga/requirements.txt | ||
COPY extensions/openai/requirements.txt /app/extensions/openai/requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/api && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/elevenlabs_tts && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/google_translate && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/silero_tts && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/whisper_stt && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/superbooga && pip3 install -r requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip . /app/venv/bin/activate && cd extensions/openai && pip3 install -r requirements.txt | ||
|
||
# Install main requirements | ||
COPY requirements.txt /app/requirements.txt | ||
RUN . /app/venv/bin/activate && \ | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw \ | ||
. /app/venv/bin/activate && \ | ||
pip3 install -r requirements.txt | ||
|
||
COPY . /app/ | ||
|
||
RUN cp /app/venv/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda118.so /app/venv/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so | ||
|
||
COPY . /app/ | ||
# Install extension requirements | ||
RUN --mount=type=cache,target=/root/.cache/pip,rw \ | ||
. /app/venv/bin/activate && \ | ||
for ext in /app/extensions/*/requirements.txt; do \ | ||
cd "$(dirname "$ext")"; \ | ||
pip3 install -r requirements.txt; \ | ||
done | ||
|
||
ENV CLI_ARGS="" | ||
|
||
EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005} | ||
CMD . /app/venv/bin/activate && python3 server.py ${CLI_ARGS} |