-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
258 lines (248 loc) · 7.75 KB
/
docker-compose.yml
File metadata and controls
258 lines (248 loc) · 7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
services:
web:
build:
context: ./web
dockerfile: Dockerfile
image: safelens-web
ports:
- "8000:8000"
env_file:
- ./web/.env
environment:
WHISPER_DEVICE: "cuda"
WHISPER_COMPUTE_TYPE: "float16"
WHISPER_MODEL: "large-v2"
WHISPER_MAX_CONCURRENT: "1"
WARMUP_ON_START: "true"
NLTK_DATA: "/root/nltk_data"
DATABASE_URL: "postgresql+psycopg://${WEB_DB_USER}:${WEB_DB_PASSWORD}@web_db:5432/${WEB_DB_NAME}"
QWEN_VLLM_BASE_URL: "http://qwen_router:8080/v1"
ANALYSIS_LLM_BACKEND: "http"
ANALYSIS_LLM_HTTP_URL: "http://llama_router:8080/v1"
QWEN_VLLM_MAX_INFLIGHT: "4"
gpus:
- driver: nvidia
device_ids: ["3"]
capabilities: [gpu]
volumes:
- videos_data:/app/videos
- hf_cache:/root/.cache/huggingface
- torch_cache:/root/.cache/torch
- easyocr_cache:/root/.EasyOCR
- nltk_data:/root/nltk_data
depends_on:
web_db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python3 -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health/ready', timeout=3)\""]
interval: 30s
timeout: 5s
retries: 10
restart: unless-stopped
profiles:
- core
web_db:
image: postgres:17.5
environment:
POSTGRES_USER: ${WEB_DB_USER}
POSTGRES_PASSWORD: ${WEB_DB_PASSWORD}
POSTGRES_DB: ${WEB_DB_NAME}
ports:
- "5432:5432"
volumes:
- web_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U socialaistudio -d harmful_moderation"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
profiles:
- core
auth_db:
image: postgres:17.5
environment:
POSTGRES_USER: ${AUTH_DB_USER}
POSTGRES_PASSWORD: ${AUTH_DB_PASSWORD}
POSTGRES_DB: ${AUTH_DB_NAME}
ports:
- "5433:5432"
volumes:
- auth_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U socialaistudio -d socialai_auth"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
profiles:
- core
vllm_llama:
image: vllm/vllm-openai:nightly
command:
- "--host"
- "0.0.0.0"
- "--port"
- "8192"
- "--model"
- "meta-llama/Meta-Llama-3-8B-Instruct"
- "--enable-lora"
- "--lora-modules"
- "SafeLens/llama-3-8b=/models/lora"
environment:
HF_TOKEN: ${HF_TOKEN}
gpus:
- driver: nvidia
device_ids: ["0"]
capabilities: [gpu]
ports:
- "8192:8192"
volumes:
- ./web/lora_adapter:/models/lora:ro
- vllm_cache:/root/.cache/huggingface
restart: unless-stopped
profiles:
- gpu
vllm_qwen:
image: vllm/vllm-openai:nightly
command:
- "--host"
- "0.0.0.0"
- "--port"
- "8193"
- "--model"
- "${VLLM_QWEN_MODEL:-Qwen/Qwen2.5-VL-7B-Instruct}"
- "--trust-remote-code"
- "--max-model-len"
- "${VLLM_QWEN_MAX_MODEL_LEN:-8192}"
- "--gpu-memory-utilization"
- "${VLLM_QWEN_GPU_UTIL:-0.6}"
- "--tensor-parallel-size"
- "${VLLM_QWEN_TP:-1}"
environment:
HF_TOKEN: ${HF_TOKEN}
gpus:
- driver: nvidia
device_ids: ["1"]
capabilities: [gpu]
ports:
- "8193:8193"
volumes:
- vllm_cache:/root/.cache/huggingface
healthcheck:
test: ["CMD-SHELL", "python3 -c \"import urllib.request; urllib.request.urlopen('http://localhost:8193/v1/models', timeout=3)\""]
interval: 30s
timeout: 5s
retries: 5
restart: unless-stopped
profiles:
- gpu
vllm_qwen_2:
image: vllm/vllm-openai:nightly
command:
- "--host"
- "0.0.0.0"
- "--port"
- "8194"
- "--model"
- "${VLLM_QWEN_MODEL:-Qwen/Qwen2.5-VL-7B-Instruct}"
- "--trust-remote-code"
- "--max-model-len"
- "${VLLM_QWEN_MAX_MODEL_LEN:-8192}"
- "--gpu-memory-utilization"
- "${VLLM_QWEN_GPU_UTIL:-0.6}"
- "--tensor-parallel-size"
- "${VLLM_QWEN_TP:-1}"
environment:
HF_TOKEN: ${HF_TOKEN}
gpus:
- driver: nvidia
device_ids: ["2"]
capabilities: [gpu]
ports:
- "8194:8194"
volumes:
- vllm_cache:/root/.cache/huggingface
healthcheck:
test: ["CMD-SHELL", "python3 -c \"import urllib.request; urllib.request.urlopen('http://localhost:8194/v1/models', timeout=3)\""]
interval: 30s
timeout: 5s
retries: 5
restart: unless-stopped
profiles:
- gpu
qwen_router:
build:
context: ./qwen-router
dockerfile: Dockerfile
image: safelens-qwen-router
environment:
# Override for remote/shared backends:
# export QWEN_ROUTER_BACKENDS="http://host:8193,http://host2:8194"
LLM_ROUTER_BACKENDS: "${QWEN_ROUTER_BACKENDS:-http://vllm_qwen:8193,http://vllm_qwen_2:8194}"
LLM_ROUTER_MAX_RETRIES: "1"
LLM_ROUTER_COOLDOWN_SEC: "5"
LLM_ROUTER_EWMA_ALPHA: "0.2"
LLM_ROUTER_LATENCY_WEIGHT: "0"
ports:
- "8080:8080"
depends_on:
vllm_qwen:
condition: service_started
restart: unless-stopped
profiles:
- gpu
llama_router:
image: safelens-qwen-router
environment:
# Override for remote/shared backends:
# export LLAMA_ROUTER_BACKENDS="http://host:8192"
LLM_ROUTER_BACKENDS: "${LLAMA_ROUTER_BACKENDS:-http://vllm_llama:8192}"
LLM_ROUTER_MAX_RETRIES: "1"
LLM_ROUTER_COOLDOWN_SEC: "5"
LLM_ROUTER_EWMA_ALPHA: "0.2"
LLM_ROUTER_LATENCY_WEIGHT: "0.001"
ports:
- "8081:8080"
depends_on:
vllm_llama:
condition: service_started
restart: unless-stopped
profiles:
- gpu
cloudflared_web:
image: cloudflare/cloudflared:latest
command:
- "tunnel"
- "--config"
- "/home/dylan/.cloudflared/harmful-moderation-config.yml"
- "run"
volumes:
- ${HOME}/.cloudflared:/home/dylan/.cloudflared:ro
depends_on:
web:
condition: service_started
restart: unless-stopped
profiles:
- edge
cloudflared_auth:
image: cloudflare/cloudflared:latest
command:
- "tunnel"
- "--config"
- "/home/dylan/.cloudflared/socialai-auth-config.yml"
- "run"
volumes:
- ${HOME}/.cloudflared:/home/dylan/.cloudflared:ro
restart: unless-stopped
profiles:
- edge
volumes:
videos_data:
hf_cache:
torch_cache:
easyocr_cache:
nltk_data:
web_db_data:
auth_db_data:
vllm_cache: