Skip to content

Commit

Permalink
modified: docker-compose.yaml
Browse files Browse the repository at this point in the history
	renamed:    docker-compose.yaml.bak -> local-llm
	new file:   local-llm-gpu
	modified:   superagi/helper/json_cleaner.py
	renamed:    DockerfileTGWUI -> tgwui/DockerfileTGWUI
	deleted:    tgwui/config/place-your-models-here.txt
	deleted:    tgwui/tgwui_requirements.txt
  • Loading branch information
sirajperson committed Jun 11, 2023
1 parent ffead61 commit f133780
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 78 deletions.
43 changes: 0 additions & 43 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ services:
ports:
- "8001:8001"
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
Expand All @@ -21,7 +20,6 @@ services:
context: .
dockerfile: DockerfileCelery
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
Expand All @@ -40,47 +38,6 @@ services:
- /app/node_modules
- /app/.next

super__tgwui:
build:
context: .
#target: llama-cublas # Specify the variant to build
dockerfile: DockerfileTGWUI
# args:
# - LCL_SRC_DIR=text-generation-webui # Developers - see Dockerfile app_base
container_name: text-generation-webui
environment:
- EXTRA_LAUNCH_ARGS="--chat --listen --verbose --extensions openai --threads 4"
# - EXTRA_LAUNCH_ARGS="--listen --no-mmap --verbose --extensions openai --auto-devices --gpu-memory 20 20 --n-gpu-layers 100 --threads 8 --model vicuna-13b-cot.ggmlv3.q8_0.bin" # GPU Custom launch args (e.g., --model MODEL_NAME)
ports:
- 7860:7860 # Default web port
- 5000:5000 # Default API port
- 5005:5005 # Default streaming port
- 5001:5001 # Default OpenAI API extension port
volumes:
- ./tgwui/config/loras:/app/loras
- ./tgwui/config/models:/app/models
- ./tgwui/config/presets:/app/presets
- ./tgwui/config/prompts:/app/prompts
- ./tgwui/config/softprompts:/app/softprompts
- ./tgwui/config/training:/app/training
logging:
driver: json-file
options:
max-file: "3" # number of files or file count
max-size: '10m'
networks:
- super_network
### Uncomment the following lines to run the container using the host machine's GPU resources
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
## device_ids: ['0', '1'] # must comment the above line if this line is uncommented.
# capabilities: [gpu]


super__redis:
image: "docker.io/library/redis:latest"
networks:
Expand Down
37 changes: 33 additions & 4 deletions docker-compose.yaml.bak → local-llm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
ports:
- "8001:8001"
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
Expand All @@ -20,11 +21,12 @@ services:
context: .
dockerfile: DockerfileCelery
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
- super_network

gui:
build: ./gui
ports:
Expand All @@ -38,13 +40,40 @@ services:
- /app/node_modules
- /app/.next

super__tgwui:
build:
context: .
dockerfile: ./tgwui/DockerfileTGWUI
container_name: super__tgwui
environment:
- EXTRA_LAUNCH_ARGS="--listen --verbose --extensions openai --threads 4 --n_ctx 1600"
ports:
- 7860:7860 # Default web port
- 5000:5000 # Default API port
- 5005:5005 # Default streaming port
- 5001:5001 # Default OpenAI API extension port
volumes:
- ./tgwui/config/loras:/app/loras
- ./tgwui/config/models:/app/models
- ./tgwui/config/presets:/app/presets
- ./tgwui/config/prompts:/app/prompts
- ./tgwui/config/softprompts:/app/softprompts
- ./tgwui/config/training:/app/training
logging:
driver: json-file
options:
max-file: "3" # number of files or file count
max-size: '10m'
networks:
- super_network

super__redis:
image: "redis:latest"
image: "docker.io/library/redis:latest"
networks:
- super_network

super__postgres:
image: "postgres:latest"
image: "docker.io/library/postgres:latest"
environment:
- POSTGRES_USER=superagi
- POSTGRES_PASSWORD=password
Expand All @@ -59,6 +88,6 @@ services:
networks:
super_network:
driver: bridge

volumes:
superagi_postgres_data:
107 changes: 107 additions & 0 deletions local-llm-gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
version: '3.8'

services:
backend:
volumes:
- "./:/app"
build: .
ports:
- "8001:8001"
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
- super_network

celery:
volumes:
- "./:/app"
build:
context: .
dockerfile: DockerfileCelery
depends_on:
- super__tgwui
- super__redis
- super__postgres
networks:
- super_network

gui:
build: ./gui
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_API_BASE_URL=http://localhost:8001
networks:
- super_network
volumes:
- ./gui:/app
- /app/node_modules
- /app/.next

super__tgwui:
build:
context: .
target: llama-cublas
dockerfile: ./tgwui/DockerfileTGWUI
# args:
# - LCL_SRC_DIR=text-generation-webui # Developers - see Dockerfile app_base
container_name: super__tgwui
environment:
- EXTRA_LAUNCH_ARGS="--listen --no-mmap --verbose --extensions openai --auto-devices --n_ctx 1600 --gpu-memory 20 20 --n-gpu-layers 128 --threads 8 --model vicuna-13b-cot.ggmlv3.q8_0.bin"
ports:
- 7860:7860 # Default web port
- 5000:5000 # Default API port
- 5005:5005 # Default streaming port
- 5001:5001 # Default OpenAI API extension port
volumes:
- ./tgwui/config/loras:/app/loras
- ./tgwui/config/models:/app/models
- ./tgwui/config/presets:/app/presets
- ./tgwui/config/prompts:/app/prompts
- ./tgwui/config/softprompts:/app/softprompts
- ./tgwui/config/training:/app/training
- ./tgwui/config/embeddings:/app/embeddings
logging:
driver: json-file
options:
max-file: "3" # number of files or file count
max-size: '10m'
networks:
- super_network
### Uncomment the following lines to run the container using the host machine's GPU resources
deploy:
resources:
reservations:
devices:
- driver: nvidia
# count: "all"
device_ids: ['0', '1'] # must comment the above line if this line is uncommented.
capabilities: [gpu]


super__redis:
image: "docker.io/library/redis:latest"
networks:
- super_network

super__postgres:
image: "docker.io/library/postgres:latest"
environment:
- POSTGRES_USER=superagi
- POSTGRES_PASSWORD=password
- POSTGRES_DB=super_agi_main
volumes:
- superagi_postgres_data:/var/lib/postgresql/data/
networks:
- super_network
ports:
- "5432:5432"

networks:
super_network:
driver: bridge

volumes:
superagi_postgres_data:
2 changes: 1 addition & 1 deletion superagi/helper/json_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def extract_json_section(cls, input_str: str = ""):

@classmethod
def remove_escape_sequences(cls, string):
return string.encode('utf-8').decode('unicode_escape').encode('raw_unicode_escape').decode('utf-8')
return string.encode('utf-8').decode('unicode_escape').encode('raw_unicode_escape')

@classmethod
def add_quotes_to_property_names(cls, json_string: str) -> str:
Expand Down
16 changes: 11 additions & 5 deletions DockerfileTGWUI → tgwui/DockerfileTGWUI
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,26 @@ FROM env_base AS app_base
### DEVELOPERS/ADVANCED USERS ###
# Clone oobabooga/text-generation-webui
RUN git clone https://github.com/oobabooga/text-generation-webui /src
# This is required to get multi-gpu support until the main branch updates the requirements.txt file to include llama-cpp-python 0.1.59 or greater.
COPY tgwui/tgwui_requirements.txt /src/requirements.txt
# 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
# This is required to get multi-gpu support until the main branch updates the requirements.txt file to include llama-cpp-python 0.1.59 or greater.

#################################
# Copy source to app
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 tgwui/scripts/build_extensions.sh /scripts/build_extensions.sh
COPY tgwui/scripts/build_extensions.sh /app/scripts/build_extensions.sh
RUN --mount=type=cache,target=/root/.cache/pip \
chmod +x /scripts/build_extensions.sh && . /scripts/build_extensions.sh \
chmod +x /app/scripts/build_extensions.sh && . /app/scripts/build_extensions.sh

## Clone default GPTQ
RUN git clone https://github.com/oobabooga/GPTQ-for-LLaMa.git -b cuda /app/repositories/GPTQ-for-LLaMa
## Build and install default GPTQ ('quant_cuda')
ARG TORCH_CUDA_ARCH_LIST="6.1;7.0;7.5;8.0;8.6+PTX"
#RUN cd /app/repositories/GPTQ-for-LLaMa/ && python3 setup_cuda.py install
RUN cd /app/repositories/GPTQ-for-LLaMa/ && python3 setup_cuda.py install

FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 AS base
# Runtime pre-reqs
Expand All @@ -62,6 +61,13 @@ ENV PYTHONUNBUFFERED=1
ARG BUILD_DATE
ENV BUILD_DATE=$BUILD_DATE
RUN echo "$BUILD_DATE" > /build_date.txt

# Set embeddings model for llama
#ENV OPENEDAI_EMBEDDING_MODEL=/app/embeddings/SGPT-125M-weightedmean-nli-bitfit
#COPY tgwui/config/embeddings/SGPT-125M-weightedmean-nli-bitfit /app/embeddings
#RUN echo -e "Embeddings model $OPENEDAI_EMBEDDING_MODEL"
#RUN python extensions/openai/cache_embedding_model.py

# Run
COPY tgwui/scripts/docker-entrypoint.sh /scripts/docker-entrypoint.sh
RUN chmod +x /scripts/docker-entrypoint.sh
Expand Down
Empty file.
25 changes: 0 additions & 25 deletions tgwui/tgwui_requirements.txt

This file was deleted.

0 comments on commit f133780

Please sign in to comment.