Implement versioned builds

- Introduce new build arg `VERSION_TAG`
- Update version freshness checking
- Rename docker-compose build example file
pull/24/head
Atinoda 9 months ago
parent 79c7cf645e
commit f85bf702ea

@ -12,10 +12,17 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip3 install --upgrade pip setuptools && \
pip3 install torch torchvision torchaudio
FROM env_base AS app_base
FROM env_base AS app_base
# Copy and enable all scripts
COPY ./scripts /scripts
RUN chmod +x /scripts/*
### DEVELOPERS/ADVANCED USERS ###
# Clone oobabooga/text-generation-webui
RUN git clone https://github.com/oobabooga/text-generation-webui /src
# Use script to check out specific version
ARG VERSION_TAG
ENV VERSION_TAG=${VERSION_TAG}
RUN . /scripts/checkout_src_version.sh
# To use local source: comment out the git clone command then set the build arg `LCL_SRC_DIR`
#ARG LCL_SRC_DIR="text-generation-webui"
#COPY ${LCL_SRC_DIR} /src
@ -26,7 +33,6 @@ RUN cp -ar /src /app
# Install oobabooga/text-generation-webui
RUN --mount=type=cache,target=/root/.cache/pip pip3 install -r /app/requirements.txt
# Install extensions
COPY ./scripts/build_extensions.sh /scripts/build_extensions.sh
RUN --mount=type=cache,target=/root/.cache/pip \
chmod +x /scripts/build_extensions.sh && . /scripts/build_extensions.sh
# Clone default GPTQ
@ -58,6 +64,9 @@ ENV PYTHONUNBUFFERED=1
ARG BUILD_DATE
ENV BUILD_DATE=$BUILD_DATE
RUN echo "$BUILD_DATE" > /build_date.txt
ARG VERSION_TAG
ENV VERSION_TAG=$VERSION_TAG
RUN echo "$VERSION_TAG" > /version_tag.txt
# Copy and enable all scripts
COPY ./scripts /scripts
RUN chmod +x /scripts/*

@ -26,6 +26,7 @@ Each variant has the 'extras' incuded in `default` but has some changes made as
| `llama-cpu` | GPU supported is REMOVED from `llama-cpp`. Suitable for systems without a CUDA-capable GPU. *This is only for when GPU acceleration is not available and is a slower way to run models!* |
| `monkey-patch` | Use LoRAs in 4-Bit `GPTQ-for-llama` mode. ***DEPRECATION WARNING:** This version is outdated, but will remain for now.* |
| `llama-cublas` | CUDA GPU offloading enabled for `llama-cpp`. Use by setting option `n-gpu-layers` > 0. ***DEPRECATION WARNING:** This capability has been rolled into the default. The variant will be removed if the upstream dependency does not conflict with `default`.* |
| `{VARIANT}-version` | Build of each {VARIANT} tagged with the release version of the text-generation-webui (e.g., `default-v1.5`). *Visit [obabooga/text-generation-webui/releases](https://github.com/oobabooga/text-generation-webui/releases) for details.* |
*See: [oobabooga/text-generation-webui/blob/main/docs/GPTQ-models-(4-bit-mode).md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/GPTQ-models-(4-bit-mode).md), [obabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md), and [oobabooga/text-generation-webui/blob/main/docs/ExLlama.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/ExLlama.md) for more information on variants.*

@ -4,7 +4,9 @@ services:
build:
context: .
target: default # Specify the variant to build
# args:
args:
- VERSION_TAG="v1.5" # Checkout this specific tag from upstream. Omit or set `nightly` for latest.
# - BUILD_DATE="1970-01-01" # Set the build date as desired
# - LCL_SRC_DIR=text-generation-webui # Developers - see Dockerfile app_base
container_name: text-generation-webui
environment:

@ -0,0 +1,22 @@
#!/bin/bash
set -x
# Get current directory
cur_dir=$(pwd)
src_dir="/src"
# Go to source code
cd $src_dir
# If the version number is not an empty string
if [ -n "$VERSION_TAG" ]; then
# If NOT the tag is "nightly"...
if [ "$VERSION_TAG" != "nightly" ]; then
# Use the version number as a tag to checkout
git checkout -b $VERSION_TAG $VERSION_TAG
fi
fi
# Go back to the original directory
cd $cur_dir

@ -39,7 +39,8 @@ fi
# Print variant
VARIANT=$(cat /variant.txt)
echo "=== Running text-generation-webui variant: '$VARIANT' ==="
VERSION_TAG_STR=$(cat /version_tag.txt)
echo "=== Running text-generation-webui variant: '$VARIANT' $VERSION_TAG_STR ==="
# Print version freshness
cur_dir=$(pwd)
@ -51,9 +52,9 @@ if [ $? -ne 0 ]; then
COMMITS_BEHIND="UNKNOWN"
else
# The command executed successfully
COMMITS_BEHIND=$(git rev-list HEAD..origin --count)
COMMITS_BEHIND=$(git rev-list HEAD..main --count)
fi
echo "=== (This version is $COMMITS_BEHIND commits behind origin) ==="
echo "=== (This version is $COMMITS_BEHIND commits behind origin main) ==="
cd $cur_dir
# Print build date

Loading…
Cancel
Save