fix: Update docker compose for sd and llm
This commit is contained in:
parent
dd8ecba78c
commit
858c872b1b
@ -125,7 +125,6 @@ services:
|
|||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 5s
|
start_period: 5s
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
jan_community:
|
jan_community:
|
||||||
ipv4_address: 172.20.0.14
|
ipv4_address: 172.20.0.14
|
||||||
@ -152,39 +151,9 @@ services:
|
|||||||
jan_community:
|
jan_community:
|
||||||
ipv4_address: 172.20.0.15
|
ipv4_address: 172.20.0.15
|
||||||
|
|
||||||
# Service to download a model file.
|
|
||||||
downloader:
|
|
||||||
image: busybox
|
|
||||||
# The command extracts the model filename from MODEL_URL and downloads it if it doesn't exist.
|
|
||||||
command: /bin/sh -c "LLM_MODEL_FILE=$(basename ${MODEL_URL}); if [ ! -f /models/$LLM_MODEL_FILE ]; then wget -O /models/$LLM_MODEL_FILE ${MODEL_URL}; fi"
|
|
||||||
# Mount a local directory to store the downloaded model.
|
|
||||||
volumes:
|
|
||||||
- ./jan-inference/llm/models:/models
|
|
||||||
|
|
||||||
networks:
|
|
||||||
jan_community:
|
|
||||||
ipv4_address: 172.20.0.16
|
|
||||||
|
|
||||||
# Service to wait for the downloader service to finish downloading the model.
|
|
||||||
wait-for-downloader:
|
|
||||||
image: busybox
|
|
||||||
# The command waits until the model file (specified in MODEL_URL) exists.
|
|
||||||
command: /bin/sh -c "LLM_MODEL_FILE=$(basename ${MODEL_URL}); echo 'Waiting for downloader to finish'; while [ ! -f /models/$LLM_MODEL_FILE ]; do sleep 1; done; echo 'Model downloaded!'"
|
|
||||||
# Specifies that this service should start after the downloader service has started.
|
|
||||||
depends_on:
|
|
||||||
downloader:
|
|
||||||
condition: service_started
|
|
||||||
# Mount the same local directory to check for the downloaded model.
|
|
||||||
volumes:
|
|
||||||
- ./jan-inference/llm/models:/models
|
|
||||||
|
|
||||||
networks:
|
|
||||||
jan_community:
|
|
||||||
ipv4_address: 172.20.0.17
|
|
||||||
|
|
||||||
# Service to run the Llama web application.
|
# Service to run the Llama web application.
|
||||||
llm:
|
llm:
|
||||||
image: ghcr.io/abetlen/llama-cpp-python:latest
|
image: ghcr.io/abetlen/llama-cpp-python@sha256:b6d21ff8c4d9baad65e1fa741a0f8c898d68735fff3f3cd777e3f0c6a1839dd4
|
||||||
# Mount the directory that contains the downloaded model.
|
# Mount the directory that contains the downloaded model.
|
||||||
volumes:
|
volumes:
|
||||||
- ./jan-inference/llm/models:/models
|
- ./jan-inference/llm/models:/models
|
||||||
@ -192,20 +161,74 @@ services:
|
|||||||
- 8000:8000
|
- 8000:8000
|
||||||
environment:
|
environment:
|
||||||
# Specify the path to the model for the web application.
|
# Specify the path to the model for the web application.
|
||||||
MODEL: /models/llama-2-7b-chat.ggmlv3.q4_1.bin
|
MODEL: /models/${LLM_MODEL_FILE}
|
||||||
PYTHONUNBUFFERED: 1
|
PYTHONUNBUFFERED: 1
|
||||||
# Restart policy configuration
|
# Restart policy configuration
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
# Specifies that this service should start only after wait-for-downloader has completed successfully.
|
# Specifies that this service should start only after wait-for-downloader has completed successfully.
|
||||||
depends_on:
|
|
||||||
wait-for-downloader:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
# Connect this service to two networks: inference_net and traefik_public.
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
jan_community:
|
jan_community:
|
||||||
ipv4_address: 172.20.0.18
|
ipv4_address: 172.20.0.18
|
||||||
|
|
||||||
|
sd-downloader:
|
||||||
|
build:
|
||||||
|
context: ./jan-inference/sd/
|
||||||
|
dockerfile: compile.Dockerfile
|
||||||
|
# The command extracts the model filename from MODEL_URL and downloads it if it doesn't exist.
|
||||||
|
command: /bin/sh -c "if [ ! -f /models/*.bin ]; then python /sd.cpp/sd_cpp/models/convert.py --out_type q4_0 --out_file /models/${SD_MODEL_FILE}.q4_0.bin /models/${SD_MODEL_FILE}; fi"
|
||||||
|
# Mount a local directory to store the downloaded model.
|
||||||
|
volumes:
|
||||||
|
- ./jan-inference/sd/models:/models
|
||||||
|
networks:
|
||||||
|
jan_community:
|
||||||
|
ipv4_address: 172.20.0.19
|
||||||
|
|
||||||
|
# Service to run the SD web application.
|
||||||
|
sd:
|
||||||
|
build:
|
||||||
|
context: ./jan-inference/sd/
|
||||||
|
dockerfile: inference.Dockerfile
|
||||||
|
# Mount the directory that contains the downloaded model.
|
||||||
|
volumes:
|
||||||
|
- ./jan-inference/sd/models:/models
|
||||||
|
- ./jan-inference/sd/output/:/serving/output
|
||||||
|
command: /bin/bash -c "python -m uvicorn main:app --proxy-headers --host 0.0.0.0 --port 8000"
|
||||||
|
environment:
|
||||||
|
# Specify the path to the model for the web application.
|
||||||
|
BASE_URL: http://0.0.0.0:8000
|
||||||
|
MODEL_NAME: ${SD_MODEL_FILE}.q4_0.bin
|
||||||
|
MODEL_DIR: "/models"
|
||||||
|
SD_PATH: "/sd"
|
||||||
|
PYTHONUNBUFFERED: 1
|
||||||
|
ports:
|
||||||
|
- 8001:8000
|
||||||
|
# Restart policy configuration
|
||||||
|
restart: on-failure
|
||||||
|
# Specifies that this service should start only after wait-for-downloader has completed successfully.
|
||||||
|
depends_on:
|
||||||
|
sd-downloader:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
networks:
|
||||||
|
jan_community:
|
||||||
|
ipv4_address: 172.20.0.21
|
||||||
|
|
||||||
|
# Service for Traefik, a modern HTTP reverse proxy and load balancer.
|
||||||
|
# traefik:
|
||||||
|
# image: traefik:v2.10
|
||||||
|
# ports:
|
||||||
|
# # Map port 80 in the container to port 80 on the host.
|
||||||
|
# - "80:80"
|
||||||
|
# # Map port 8080 in the container (Traefik's dashboard) to port 8080 on the host.
|
||||||
|
# - "8080:8080"
|
||||||
|
# # Mount the Docker socket to allow Traefik to listen to Docker's API.
|
||||||
|
# volumes:
|
||||||
|
# - /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
# - ./traefik/traefik.yml:/traefik.yml:ro
|
||||||
|
# - ./traefik/config.yml:/config.yml:ro
|
||||||
|
# networks:
|
||||||
|
# jan_community:
|
||||||
|
# ipv4_address: 172.20.0.22
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
jan_community:
|
jan_community:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user