added windows/docker docs (#1027)

This commit is contained in:
loeken 2023-04-18 17:47:43 +02:00 committed by GitHub
parent b0c762ceba
commit 89e22d4d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 174 additions and 4 deletions

9
docker/.dockerignore Normal file
View file

@ -0,0 +1,9 @@
.env
Dockerfile
/characters
/loras
/models
/presets
/prompts
/softprompts
/training

25
docker/.env.example Normal file
View file

@ -0,0 +1,25 @@
# by default the Dockerfile specifies these versions: 3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX
# however for me to work i had to specify the exact version for my card ( 2060 ) it was 7.5
# https://developer.nvidia.com/cuda-gpus you can find the version for your card here
TORCH_CUDA_ARCH_LIST=7.5
# these commands worked for me with roughly 4.5GB of vram
CLI_ARGS=--model llama-7b-4bit --wbits 4 --listen --auto-devices
# the following examples have been tested with the files linked in docs/README_docker.md:
# example running 13b with 4bit/128 groupsize : CLI_ARGS=--model llama-13b-4bit-128g --wbits 4 --listen --groupsize 128 --pre_layer 25
# example with loading api extension and public share: CLI_ARGS=--model llama-7b-4bit --wbits 4 --listen --auto-devices --no-stream --extensions api --share
# example running 7b with 8bit groupsize : CLI_ARGS=--model llama-7b --load-in-8bit --listen --auto-devices
# the port the webui binds to on the host
HOST_PORT=7860
# the port the webui binds to inside the container
CONTAINER_PORT=7860
# the port the api binds to on the host
HOST_API_PORT=5000
# the port the api binds to inside the container
CONTAINER_API_PORT=5000
# the version used to install text-generation-webui from
WEBUI_VERSION=HEAD

170
docker/README.md Normal file
View file

@ -0,0 +1,170 @@
- [Ubuntu 22.04](#ubuntu-2204)
- [0. youtube video](#0-youtube-video)
- [1. update the drivers](#1-update-the-drivers)
- [2. reboot](#2-reboot)
- [3. install docker](#3-install-docker)
- [4. docker \& container toolkit](#4-docker--container-toolkit)
- [5. clone the repo](#5-clone-the-repo)
- [6. prepare models](#6-prepare-models)
- [7. prepare .env file](#7-prepare-env-file)
- [8. startup docker container](#8-startup-docker-container)
- [Manjaro](#manjaro)
- [update the drivers](#update-the-drivers)
- [reboot](#reboot)
- [docker \& container toolkit](#docker--container-toolkit)
- [continue with ubuntu task](#continue-with-ubuntu-task)
- [Windows](#windows)
- [0. youtube video](#0-youtube-video-1)
- [1. choco package manager](#1-choco-package-manager)
- [2. install drivers/dependencies](#2-install-driversdependencies)
- [3. install wsl](#3-install-wsl)
- [4. reboot](#4-reboot)
- [5. git clone \&\& startup](#5-git-clone--startup)
- [6. prepare models](#6-prepare-models-1)
- [7. startup](#7-startup)
- [notes](#notes)
# Ubuntu 22.04
## 0. youtube video
A video walking you through the setup can be found here:
[![oobabooga text-generation-webui setup in docker on ubuntu 22.04](https://img.youtube.com/vi/ELkKWYh8qOk/0.jpg)](https://www.youtube.com/watch?v=ELkKWYh8qOk)
## 1. update the drivers
in the the “software updater” update drivers to the last version of the prop driver.
## 2. reboot
to switch using to new driver
## 3. install docker
```bash
sudo apt update
sudo apt-get install curl
sudo mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose -y
sudo usermod -aG docker $USER
newgrp docker
```
## 4. docker & container toolkit
```bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://nvidia.github.io/libnvidia-container/stable/ubuntu22.04/amd64 /" | \
sudo tee /etc/apt/sources.list.d/nvidia.list > /dev/null
sudo apt update
sudo apt install nvidia-docker2 nvidia-container-runtime -y
sudo systemctl restart docker
```
## 5. clone the repo
```
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
```
## 6. prepare models
download and place the models inside the models folder. tested with:
4bit
https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1483891617
https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1483941105
8bit:
https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1484235789
## 7. prepare .env file
edit .env values to your needs.
```bash
cp .env.example .env
nano .env
```
## 8. startup docker container
```bash
docker-compose up --build
```
# Manjaro
manjaro/arch is similar to ubuntu just the dependency installation is more convenient
## update the drivers
```bash
sudo mhwd -a pci nonfree 0300
```
## reboot
```bash
reboot
```
## docker & container toolkit
```bash
yay -S docker docker-compose buildkit gcc nvidia-docker
sudo usermod -aG docker $USER
newgrp docker
sudo systemctl restart docker # required by nvidia-container-runtime
```
## continue with ubuntu task
continue at [5. clone the repo](#5-clone-the-repo)
# Windows
## 0. youtube video
A video walking you through the setup can be found here:
[![oobabooga text-generation-webui setup in docker on windows 11](https://img.youtube.com/vi/ejH4w5b5kFQ/0.jpg)](https://www.youtube.com/watch?v=ejH4w5b5kFQ)
## 1. choco package manager
install package manager (https://chocolatey.org/ )
```
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```
## 2. install drivers/dependencies
```
choco install nvidia-display-driver cuda git docker-desktop
```
## 3. install wsl
wsl --install
## 4. reboot
after reboot enter username/password in wsl
## 5. git clone && startup
clone the repo and edit .env values to your needs.
```
cd Desktop
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
COPY .env.example .env
notepad .env
```
## 6. prepare models
download and place the models inside the models folder. tested with:
4bit https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1483891617 https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1483941105
8bit: https://github.com/oobabooga/text-generation-webui/pull/530#issuecomment-1484235789
## 7. startup
```
docker-compose up
```
# notes
on older ubuntus you can manually install the docker compose plugin like this:
```
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
export PATH="$HOME/.docker/cli-plugins:$PATH"
```

31
docker/docker-compose.yml Normal file
View file

@ -0,0 +1,31 @@
version: "3.3"
services:
text-generation-webui:
build:
context: .
args:
# specify which cuda version your card supports: https://developer.nvidia.com/cuda-gpus
TORCH_CUDA_ARCH_LIST: ${TORCH_CUDA_ARCH_LIST}
WEBUI_VERSION: ${WEBUI_VERSION}
env_file: .env
ports:
- "${HOST_PORT}:${CONTAINER_PORT}"
- "${HOST_API_PORT}:${CONTAINER_API_PORT}"
stdin_open: true
tty: true
volumes:
- ./characters:/app/characters
- ./extensions:/app/extensions
- ./loras:/app/loras
- ./models:/app/models
- ./presets:/app/presets
- ./prompts:/app/prompts
- ./softprompts:/app/softprompts
- ./training:/app/training
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0']
capabilities: [gpu]