Skip to content

Commit

Permalink
Clean up and update build
Browse files Browse the repository at this point in the history
  • Loading branch information
bartowski1182 committed Mar 19, 2024
1 parent 562f173 commit 2488486
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
15 changes: 7 additions & 8 deletions .env
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
MODEL_DIR=/media/teamgroup/models
MODEL=dolphin-2.6-mistral-7b-dpo-exl2
EXTENSIONS_DIR=/home/me/git_repos/extensions/
CHARACTERS_DIR=/media/teamgroup/characters
SETTINGS_DIR=/media/teamgroup/settings
COMMITHASH=1edf321362b3f5b3c2486fca8fd3931628c8b669
MODEL_DIR=/media/sandisk/models
MODEL=Hyperion-3.0-Mistral-7B-alpha-exl2-8_0
EXTENSIONS_DIR=~./git_repos/extensions/
CHARACTERS_DIR=./characters
SETTINGS_DIR=./settings
LOGS_DIR=./logs
DATASETS_DIR=/media/teamgroup/loras/datasets
LORAS_DIR=/media/teamgroup/loras
DATASETS_DIR=./datasets
LORAS_DIR=./loras
PRESETS_DIR=./presets
PROMPTS_DIR=./prompts
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ docker_build.log
nohup.out
presets/
prompts/
characters/
settings/
datasets/
loras/
dev_build.sd
release.sh
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 as builder

# Using conda to transfer python env from builder to runtime later
COPY --from=continuumio/miniconda3:23.5.2-0 /opt/conda /opt/conda
COPY --from=continuumio/miniconda3:23.10.0-1 /opt/conda /opt/conda
ENV PATH=/opt/conda/bin:$PATH

# Update base image
Expand All @@ -12,32 +12,30 @@ RUN apt-get update && apt-get upgrade -y \
&& mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd

# Create new conda environment
RUN conda create -y -n textgen python=3.11.5
RUN conda create -y -n textgen python=3.11.8
SHELL ["conda", "run", "-n", "textgen", "/bin/bash", "-c"]

ENV CUDA_DOCKER_ARCH=all

ARG CACHEBUST=1

# Installing torch and ninja
RUN pip3 install torch torchvision torchaudio xformers --index-url https://download.pytorch.org/whl/cu121
RUN pip3 install torch==2.2.* torchvision==0.17.* torchaudio==2.2.* xformers --index-url https://download.pytorch.org/whl/cu121

RUN pip3 install ninja packaging sentence-transformers

ARG clone_arg
ARG commit
ARG CACHEBUST=1

# Pulling latest text-generation-webui branch
RUN git clone https://github.com/oobabooga/text-generation-webui/ $clone_arg \
&& cd text-generation-webui \
&& if [ -n "$commit" ]; then git checkout $commit; fi \
&& pip3 install -r requirements.txt
&& pip3 install -r requirements.txt --upgrade

# Install all the extension requirements
RUN bash -c 'for i in text-generation-webui/extensions/*/requirements.txt ; do pip3 install -r $i ; done'

# Prepare cache for faster first time runs -- removed until its fixed
#RUN cd /text-generation-webui/extensions/openai/ && python3 cache_embedding_model.py

RUN conda clean -afy

# Using ubuntu 22.04 for runtime
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Next, build the image. This will use the latest from the text-generation-webui r

```sh
cd text-generation-webui-docker
docker build -t text-generation-webui-docker:latest .
docker build -t text-gen-ui-gpu:latest .
```

Alternatively you can run the build script, which will also just pull latest unless you have a COMMITHASH variable in a .env file or specify a commit while running the script like below:
Expand All @@ -42,12 +42,10 @@ cd text-generation-webui-docker
./build.sh 7a3ca2c68f1ca49ac4e4b62f016718556fd3805c
```

(note it will call it noneabove1182/text-generation-webui-docker since that's what I use, and tag it as well, may change this later)

# Running the image with docker run

```sh
docker run --gpus all -p 7860:7860 -v /media/teamgroup/models:/models -v ./logs:/logs text-generation-webui-docker:latest --model WizardLM-13B-V1.1-GPTQ --chat --listen --listen-port 7860
docker run --gpus all -p 7860:7860 -v /media/teamgroup/models:/models -v ./logs:/logs text-gen-ui-gpu:latest --model WizardLM-13B-V1.1-GPTQ --chat --listen --listen-port 7860
```

# Running the image with docker compose
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ LATEST_COMMIT=$(curl -s $REPO_URL | grep 'sha' | cut -d\" -f4 | head -n 1)

echo $LATEST_COMMIT

docker build --build-arg commit="$LATEST_COMMIT" -t noneabove1182/text-gen-ui-gpu .
docker build --build-arg commit="$LATEST_COMMIT" -t text-gen-ui-gpu .
2 changes: 1 addition & 1 deletion dev_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

docker build --build-arg CACHEBUST=$(date +%s) --build-arg clone_arg="--branch dev" -t noneabove1182/text-gen-ui-gpu .
docker build --build-arg CACHEBUST=$(date +%s) --build-arg clone_arg="--branch gradio4" -t text-gen-ui-gpu .
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
- '5000:5000'
image: 'noneabove1182/text-gen-ui-gpu:latest'
environment:
- PUID=1000
- PGID=1000
- OPENEDAI_EMBEDDING_DEVICE=cuda
ulimits:
memlock: -1
Expand All @@ -30,7 +32,7 @@ services:
reservations:
devices:
- driver: nvidia
count: 1
device_ids: [ '1', '0' ]
capabilities: [ gpu ]
command:
[
Expand Down
Empty file modified release.sh
100755 → 100644
Empty file.

0 comments on commit 2488486

Please sign in to comment.