Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deploy llm-assistant stack on the GPU node #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ansible/gpus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
add_persistent_storage_device: /dev/vdb
add_persistent_storage_mount_point: /mnt/models
- role: setup_nvidia_ctk
- role: deploy_litellm
vars:
deploy_litellm_configfile: ../ollama/litellm-config.yaml
deploy_litellm_project_name: ollama
- role: docker_compose
vars:
docker_compose_envfile: ../ollama/.env
docker_compose_project_name: ollama
docker_compose_srcfile: ../ollama/docker-compose.yaml
- role: pull_ollama_model
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/deploy_litellm/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
deploy_litellm_configfile: ../ollama/litellm-config.yaml
deploy_litellm_project_name: ollama
17 changes: 17 additions & 0 deletions ansible/roles/deploy_litellm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Create /opt/{{ deploy_litellm_project_name }}
become: true
ansible.builtin.file:
path: "/opt/{{ deploy_litellm_project_name }}"
state: directory
owner: deploy
group: deploy
mode: "0755"
- name: Copy litellm-config.yaml to project directory
become: true
ansible.builtin.copy:
src: "{{ deploy_litellm_configfile }}"
dest: "/opt/{{ deploy_litellm_project_name }}/litellm-config.yaml"
owner: deploy
group: deploy
mode: "0644"
1 change: 1 addition & 0 deletions ansible/roles/docker_compose/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
docker_compose_envfile: ../app/.env.example
docker_compose_project_name: app
docker_compose_srcfile: ../app/docker-compose.yaml
11 changes: 10 additions & 1 deletion ansible/roles/docker_compose/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Create {{ docker_compose_project_name }}
- name: Create /opt/{{ docker_compose_project_name }}
become: true
ansible.builtin.file:
path: "/opt/{{ docker_compose_project_name }}"
Expand All @@ -8,6 +8,15 @@
group: deploy
mode: "0755"

- name: Copy env file for {{ docker_compose_project_name }}
become: true
ansible.builtin.template:
src: "{{ docker_compose_envfile }}"
dest: "/opt/{{ docker_compose_project_name }}/.env"
owner: deploy
group: deploy
mode: "0644"

- name: Copy {{ docker_compose_srcfile }}
become: true
ansible.builtin.copy:
Expand Down
4 changes: 4 additions & 0 deletions ollama/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DISCORD_BOT_TOKEN=<DISCORD_BOT_TOKEN>
DISCORD_GUILD_ID=<DISCORD_GUILD_ID>
OPENAI_API_KEY=<OPENAI_API_KEY>
LITELLM_WORKERS_NUM=2
28 changes: 25 additions & 3 deletions ollama/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: vait

services:
ollama:
container_name: ollama
image: ollama/ollama:0.1.25
image: ollama/ollama:0.1.29
ports:
- 11434:11434
volumes:
Expand All @@ -13,5 +15,25 @@ services:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
ollama:
litellm:
container_name: litellm
image: ghcr.io/berriai/litellm:main-v1.33.9
ports:
- 4000:4000
volumes:
- ./litellm-config.yaml:/app/config.yaml
command: "--config /app/config.yaml --num_workers $LITELLM_WORKERS_NUM"
environment:
- OPENAI_API_KEY=$OPENAI_API_KEY
depends_on:
- ollama
llm-bot:
container_name: llm-bot
image: ghcr.io/bifrostlab/llm-assistant/llm-assistant:latest
environment:
- AI_SERVER_URL=http://litellm:4000
- DISCORD_BOT_TOKEN=$DISCORD_BOT_TOKEN
- DISCORD_GUILD_ID=$DISCORD_GUILD_ID
depends_on:
- ollama
- litellm
29 changes: 29 additions & 0 deletions ollama/litellm-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
model_list:
- model_name: gpt-3.5-turbo
litellm_params:
model: gpt-3.5-turbo
api_key: os.environ/OPENAI_API_KEY
- model_name: gpt-4
litellm_params:
model: gpt-4
api_key: os.environ/OPENAI_API_KEY
- model_name: mixtral
litellm_params:
model: ollama/mixtral
api_base: http://ollama:11434
- model_name: mistral
litellm_params:
model: ollama/mistral
api_base: http://ollama:11434
- model_name: llama2
litellm_params:
model: ollama/llama2
api_base: http://ollama:11434

litellm_params:
drop_params: True

router_settings:
num_retries: 2
allowed_fails: 2
timeout: 60