Skip to content

Commit

Permalink
fix: Remove sd ggml + minio + traefffik (janhq#63)
Browse files Browse the repository at this point in the history
* fix(inf-sd): Delete gitsubmodule for SD ggml

* chore: Delete custom code for sd.cpp

* chore: Update gitignore for sd models

* chore: Update readme for sd ggml service removal

* chore: Refactor compose file to remove minio, sd, sd-downloader and traeffik

* fix(.env): Removing SD and minio related configuration
  • Loading branch information
hiro-v authored Sep 6, 2023
1 parent 83e2125 commit 34939fe
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 307 deletions.
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@

# Jan inference
jan-inference/llm/models/**

jan-inference/sd/models/**
jan-inference/sd/output/**
jan-inference/sd/sd

# Minio
minio/**
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ export DOCKER_DEFAULT_PLATFORM=linux/$(uname -m)
| web-client | `conf/sample.env_web-client` |

### Install Models

- Download Runway SD 1.5 from HuggingFace
```sh
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors -P jan-inference/sd/models
```

- Download Llama 7Bn ggml from HuggingFace
```sh
wget https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/resolve/main/llama-2-7b-chat.ggmlv3.q4_1.bin -P jan-inference/llm/models
```
Expand Down Expand Up @@ -106,8 +99,7 @@ docker compose up -d
| Web App | http://localhost:3000 | Users are signed up to keycloak, default created user is set via `conf/keycloak_conf/example-realm.json` on keycloak with username: `username`, password: `password` |
| Keycloak Admin | http://localhost:8088 | Admin credentials are set via the environment variables `KEYCLOAK_ADMIN` and `KEYCLOAK_ADMIN_PASSWORD` |
| Hasura App Backend | http://localhost:8080 | Admin credentials are set via the environment variables `HASURA_GRAPHQL_ADMIN_SECRET` in file `conf/sample.env_app-backend` |
| LLM Service | http://localhost:8000 | |
| Stable Diffusion Service | http://localhost:8001 | |
| LLM Service | http://localhost:8000 | |

## Usage

Expand Down
125 changes: 0 additions & 125 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ services:
interval: 5s
timeout: 10s
retries: 30
labels:
- "traefik.enable=true"
- "traefik.http.routers.graphql-engine.entrypoints=jan"
- "traefik.http.routers.graphql-engine.rule=(PathPrefix(`/graphql-engine`))"
- "traefik.http.middlewares.graphql-engine.stripprefix.prefixes=/graphql-engine"
- "traefik.http.middlewares.graphql-engine.stripprefix.forceslash=false"
- "traefik.http.routers.graphql-engine.middlewares=graphql-engine"
networks:
jan_community:
ipv4_address: 172.20.0.12
Expand Down Expand Up @@ -143,12 +136,6 @@ services:
NODE_ENV: development
extra_hosts:
- "localhost:172.20.0.9"
labels:
- "traefik.enable=true"
- "traefik.http.routers.web.entrypoints=jan"
- "traefik.http.routers.web.rule=(Host(`localhost`) && PathPrefix(`/web`))"
- "traefik.http.routers.web.middlewares=rewritepath"
- "traefik.http.middlewares.rewritepath.addprefix.prefix=/web"
depends_on:
graphql-engine:
condition: service_healthy
Expand All @@ -166,122 +153,10 @@ services:
MODEL: /models/${LLM_MODEL_FILE}
PYTHONUNBUFFERED: 1
restart: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.routers.llm.entrypoints=jan"
- "traefik.http.routers.llm.rule=(PathPrefix(`/llm`))"
- "traefik.http.middlewares.llm.stripprefix.prefixes=/llm"
- "traefik.http.middlewares.llm.stripprefix.forceslash=false"
- "traefik.http.routers.llm.middlewares=llm"
networks:
jan_community:
ipv4_address: 172.20.0.18

sd-downloader:
build:
context: ./jan-inference/sd/
dockerfile: compile.Dockerfile
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"
volumes:
- ./jan-inference/sd/models:/models
networks:
jan_community:
ipv4_address: 172.20.0.19

sd:
build:
context: ./jan-inference/sd/
dockerfile: inference.Dockerfile
volumes:
- ./jan-inference/sd/models:/models/
command: /bin/bash -c "python -m uvicorn main:app --proxy-headers --host 0.0.0.0 --port 8000"
environment:
S3_ENDPOINT_URL: ${S3_ENDPOINT_URL}
S3_PUBLIC_ENDPOINT_URL: ${S3_PUBLIC_ENDPOINT_URL}
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
S3_BUCKET_NAME: ${S3_BUCKET_NAME}
MODEL_NAME: ${SD_MODEL_FILE}.q4_0.bin
MODEL_DIR: /models
OUTPUT_DIR: /tmp
SD_PATH: /sd
PYTHONUNBUFFERED: 1
ports:
- 8001:8000
restart: on-failure
depends_on:
sd-downloader:
condition: service_completed_successfully
labels:
- "traefik.enable=true"
- "traefik.http.routers.sd.entrypoints=jan"
- "traefik.http.routers.sd.rule=(PathPrefix(`/sd`))"
- "traefik.http.middlewares.sd.stripprefix.prefixes=/sd"
- "traefik.http.middlewares.sd.stripprefix.forceslash=false"
- "traefik.http.routers.sd.middlewares=sd"
networks:
jan_community:
ipv4_address: 172.20.0.21

minio:
image: minio/minio
ports:
- 9000:9000
- 9001
volumes:
- ./minio/data:/export
- ./minio/config:/root/.minio
environment:
MINIO_ROOT_USER: ${S3_ACCESS_KEY_ID}
MINIO_ROOT_PASSWORD: ${S3_SECRET_ACCESS_KEY}
command: server /export --console-address ":9001"
labels:
- "traefik.enable=true"
- "traefik.http.routers.minio.entrypoints=jan"
- "traefik.http.routers.minio.rule=(PathPrefix(`/minio`))"
- "traefik.http.middlewares.minio.stripprefix.prefixes=/minio"
- "traefik.http.middlewares.minio.stripprefix.forceslash=false"
- "traefik.http.routers.minio.middlewares=minio"
networks:
jan_community:
ipv4_address: 172.20.0.23

createbuckets:
image: minio/mc
depends_on:
- minio
environment:
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY}
S3_BUCKET_NAME: ${S3_BUCKET_NAME}
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add myminio http://minio:9000 ${S3_ACCESS_KEY_ID} ${S3_SECRET_ACCESS_KEY};
/usr/bin/mc rm -r --force myminio/${S3_BUCKET_NAME};
/usr/bin/mc mb myminio/${S3_BUCKET_NAME};
/usr/bin/mc anonymous set public myminio/${S3_BUCKET_NAME};
exit 0;
"
networks:
jan_community:

traefik:
image: traefik:v2.10
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--log.level=debug"
- "--entrypoints.jan.address=:1337"
ports:
- "1337:1337"
- "9090:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
jan_community:
ipv4_address: 172.20.0.22

networks:
jan_community:
driver: bridge
Expand Down
7 changes: 0 additions & 7 deletions jan-inference/sd/.dockerignore

This file was deleted.

10 changes: 0 additions & 10 deletions jan-inference/sd/compile.Dockerfile

This file was deleted.

17 changes: 0 additions & 17 deletions jan-inference/sd/compile.requirements.txt

This file was deleted.

21 changes: 0 additions & 21 deletions jan-inference/sd/inference.Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions jan-inference/sd/inference.requirements.txt

This file was deleted.

90 changes: 0 additions & 90 deletions jan-inference/sd/main.py

This file was deleted.

1 change: 0 additions & 1 deletion jan-inference/sd/sd_cpp
Submodule sd_cpp deleted from c8f85a
13 changes: 1 addition & 12 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,4 @@ KEYCLOAK_ADMIN_PASSWORD=admin
# Inference
## LLM
LLM_MODEL_URL=https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/resolve/main/llama-2-7b-chat.ggmlv3.q4_1.bin
LLM_MODEL_FILE=llama-2-7b-chat.ggmlv3.q4_1.bin

## SD
SD_MODEL_URL=https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
SD_MODEL_FILE=v1-5-pruned-emaonly.safetensors

# Minio
S3_ACCESS_KEY_ID=minio
S3_SECRET_ACCESS_KEY=minio123
S3_BUCKET_NAME=jan
S3_ENDPOINT_URL=http://minio:9000
S3_PUBLIC_ENDPOINT_URL=http://127.0.0.1:9000
LLM_MODEL_FILE=llama-2-7b-chat.ggmlv3.q4_1.bin

0 comments on commit 34939fe

Please sign in to comment.