-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose_llama_long_context.yml
More file actions
602 lines (589 loc) · 15.6 KB
/
docker-compose_llama_long_context.yml
File metadata and controls
602 lines (589 loc) · 15.6 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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# Pick which GGUF model runs by setting COMPOSE_PROFILES in .env (or pass --profile):
# COMPOSE_PROFILES=35b -> qwen35-35b_q4_gguf
# COMPOSE_PROFILES=27b -> qwen35-27b_q4_gguf
# The app always talks to http://llama-inference:8080 (shared network alias on both model services).
# Each model service uses its own llama.cpp and Hugging Face hub cache volumes so mmproj-F16.gguf
# (same filename per repo) and -hf downloads are not shared across profiles.
# Example CLI commands:
# docker compose -f docker-compose_llama_long_context.yml --profile 35b_36 up -d
# docker compose -f docker-compose_llama_long_context.yml --profile 27b_36 up -d
# docker compose -f docker-compose_llama_long_context.yml --profile 35b up -d
# docker compose -f docker-compose_llama_long_context.yml --profile 27b up -d
# docker compose -f docker-compose_llama_long_context.yml --profile 9b up -d
# docker compose -f docker-compose_llama_long_context.yml --profile gemma4-31b up -d
# docker compose -f docker-compose_llama_long_context.yml --profile gemma4-26b up -d
# Add --build to the above if you want to rebuild the app image.
services:
# Qwen 3.6 27B model setup below requires 24GB of VRAM to run.
qwen36-27b_q4_gguf:
profiles: ["27b_36"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/Qwen3.6-27B-GGUF
- --hf-file
- Qwen3.6-27B-UD-Q4_K_XL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/Qwen3.6-27B-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "131072"
- --fit
- "off"
- --temp
- "0.7"
- --top-k
- "20"
- --top-p
- "0.8"
- --min-p
- "0.0"
- --frequency-penalty
- "1"
- --presence-penalty
- "1"
- --chat-template-kwargs
- "{\"preserve_thinking\": true}"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --image_min_tokens
- "300"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
ports:
- "8000:8080"
volumes:
- ./models:/models
- hf-llama-cache-qwen36-27b:/root/.cache/llama.cpp
- hf-hub-cache-qwen36-27b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
# Qwen 3.5 35B model setup below requires 24GB of VRAM with n-cpu-moe set to 0. For lower VRAM systems, n-cpu-moe ~ 40 could work for a 12GB VRAM system, and n-cpu-moe ~ 20 for a 16GB VRAM system.
qwen36-35b_q4_gguf:
profiles: ["35b_36"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/Qwen3.6-35B-A3B-GGUF
- --hf-file
- Qwen3.6-35B-A3B-UD-IQ4_NL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "196608"
- --fit
- "off"
- --temp
- "0.7"
- --top-k
- "20"
- --top-p
- "0.8"
- --min-p
- "0.0"
- --frequency-penalty
- "1"
- --presence-penalty
- "1"
- --repeat-penalty
- "1"
- --chat-template-kwargs
- "{\"preserve_thinking\": true}"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --n-cpu-moe
- "0" # Increase this value to fit within your available VRAM
- --image_min_tokens
- "300"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
ports:
- "8005:8080"
volumes:
- ./models:/models
- hf-llama-cache-qwen36-35b:/root/.cache/llama.cpp
- hf-hub-cache-qwen36-35b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
# Qwen 3.5 35B model setup below requires 24GB of VRAM with n-cpu-moe set to 0. For lower VRAM systems, n-cpu-moe ~ 40 could work for a 12GB VRAM system, and n-cpu-moe ~ 20 for a 16GB VRAM system.
qwen35-35b_q4_gguf:
profiles: ["35b"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/Qwen3.5-35B-A3B-GGUF
- --hf-file
- Qwen3.5-35B-A3B-UD-IQ4_NL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/Qwen3.5-35B-A3B-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "196608"
- --fit
- "off"
- --temp
- "0.7"
- --top-k
- "20"
- --top-p
- "0.8"
- --min-p
- "0.0"
- --frequency-penalty
- "1"
- --presence-penalty
- "1"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --n-cpu-moe
- "0" # Increase this value to fit within your availableVRAM
- --image_min_tokens
- "300"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
ports:
- "8001:8080"
volumes:
- ./models:/models
- hf-llama-cache-qwen35-35b:/root/.cache/llama.cpp
- hf-hub-cache-qwen35-35b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
# Qwen 3.5 27B model setup below requires 24GB of VRAM to run.
qwen35-27b_q4_gguf:
profiles: ["27b"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/Qwen3.5-27B-GGUF
- --hf-file
- Qwen3.5-27B-UD-Q4_K_XL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/Qwen3.5-27B-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "196608"
- --fit
- "off"
- --temp
- "0.7"
- --top-k
- "20"
- --top-p
- "0.8"
- --min-p
- "0.0"
- --frequency-penalty
- "1"
- --presence-penalty
- "1"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --image_min_tokens
- "300"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
ports:
- "8000:8080"
volumes:
- ./models:/models
- hf-llama-cache-qwen35-27b:/root/.cache/llama.cpp
- hf-hub-cache-qwen35-27b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
qwen9b_q4_gguf:
profiles: ["9b"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/Qwen3.5-9B-GGUF
- --hf-file
- Qwen3.5-9B-UD-Q4_K_XL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/Qwen3.5-9B-A3B-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "131072"
- --fit
- "off"
- --temp
- "0.7"
- --top-k
- "20"
- --top-p
- "0.8"
- --min-p
- "0.0"
- --frequency-penalty
- "1"
- --presence-penalty
- "1"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --n-cpu-moe
- "0" # Increase this value to fit within your availableVRAM
- --image_min_tokens
- "300"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
ports:
- "8003:8080"
volumes:
- ./models:/models
- hf-llama-cache-qwen9b:/root/.cache/llama.cpp
- hf-hub-cache-qwen9b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
# Gemma 4 31B model setup below requires 24GB+ of VRAM to run.
gemma4-31b_q4_gguf:
profiles: ["gemma4-31b"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/gemma-4-31B-it-GGUF
- --hf-file
- gemma-4-31B-it-IQ4_NL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/gemma-4-31B-it-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "196608"
- --fit
- "off"
- --temp
- "1.0"
- --top-k
- "64"
- --top-p
- "0.95"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
- --image_min_tokens
- "300"
ports:
- "8002:8080"
volumes:
- ./models:/models
- hf-llama-cache-gemma4-31b:/root/.cache/llama.cpp
- hf-hub-cache-gemma4-31b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
# Gemma 4 26B model setup below requires 24GB+ of VRAM to run.
gemma4-26b_q4_gguf:
profiles: ["gemma4-26b"]
image: ghcr.io/ggml-org/llama.cpp:server-cuda12
command:
- -hf
- unsloth/gemma-4-26B-A4B-it-GGUF
- --hf-file
- gemma-4-26B-A4B-it-UD-IQ4_NL.gguf
- --mmproj-url
- https://huggingface.co/unsloth/gemma-4-26B-A4B-it-GGUF/resolve/main/mmproj-F16.gguf
- --n-gpu-layers
- "-1"
- --ctx-size
- "65536"
- --fit
- "off"
- --temp
- "1.0"
- --top-k
- "64"
- --top-p
- "0.95"
- --host
- "0.0.0.0"
- --port
- "8080"
- --no-warmup
- --seed
- "42"
- --parallel
- "1"
- --cache-type-k
- "q8_0"
- --cache-type-v
- "q8_0"
- --image_min_tokens
- "300"
ports:
- "8002:8080"
volumes:
- ./models:/models
- hf-llama-cache-gemma4-26b:/root/.cache/llama.cpp
- hf-hub-cache-gemma4-26b:/root/.cache/huggingface
pull_policy: always
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/v1/models >/dev/null || exit 1"]
interval: 30s
timeout: 15s
retries: 8
start_period: 1200s
networks:
redaction-net-llama:
aliases:
- llama-inference
redaction-app-llama:
profiles: ["35b_36", "27b_36", "35b", "27b", "9b", "gemma4-31b", "gemma4-26b"]
image: redaction-app-main
build:
context: . # Look in the current folder
dockerfile: Dockerfile # Use this file
target: gradio # Use the 'gradio' stage from your Dockerfile
args: # Pass your build-time variables here!
- TORCH_GPU_ENABLED=False
- INSTALL_VLM=False
- PADDLE_GPU_ENABLED=True
- INSTALL_PADDLEOCR=True
shm_size: '8gb'
depends_on:
qwen36-35b_q4_gguf:
condition: service_healthy
required: false
qwen36-27b_q4_gguf:
condition: service_healthy
required: false
qwen35-35b_q4_gguf:
condition: service_healthy
required: false
qwen35-27b_q4_gguf:
condition: service_healthy
required: false
qwen9b_q4_gguf:
condition: service_healthy
required: false
gemma4-31b_q4_gguf:
condition: service_healthy
required: false
gemma4-26b_q4_gguf:
condition: service_healthy
required: false
environment:
- FLAGS_fraction_of_gpu_memory_to_use=0.05
- RUN_FASTAPI=True
- APP_MODE=fastapi
- SHOW_PADDLE_MODEL_OPTIONS=True
- SHOW_LOCAL_OCR_MODEL_OPTIONS=True
- SHOW_LOCAL_PII_DETECTION_OPTIONS=True
- SHOW_INFERENCE_SERVER_PII_OPTIONS=True
- SHOW_INFERENCE_SERVER_VLM_OPTIONS=True
- SHOW_HYBRID_MODELS=True
- SHOW_DIFFICULT_OCR_EXAMPLES=True
- SHOW_ALL_OUTPUTS_IN_OUTPUT_FOLDER=True
- SHOW_SUMMARISATION=True
- SHOW_AWS_API_KEYS=True
- DEFAULT_TEXT_EXTRACTION_MODEL=Local OCR model - PDFs without selectable text
- DEFAULT_LOCAL_OCR_MODEL=paddle
- DEFAULT_PII_DETECTION_MODEL=Local
- INFERENCE_SERVER_API_URL=http://llama-inference:8080
- DEFAULT_INFERENCE_SERVER_VLM_MODEL=""
- DEFAULT_INFERENCE_SERVER_PII_MODEL=""
- CUSTOM_VLM_BACKEND=inference_vlm
- MAX_WORKERS=12
- TESSERACT_MAX_WORKERS=8
- PADDLE_MAX_WORKERS=1 # Keep this to 1 to avoid VRAM overflow or errors
- LOAD_PADDLE_AT_STARTUP=False
- EFFICIENT_OCR=True
- SHOW_CUSTOM_VLM_ENTITIES=True
- SESSION_OUTPUT_FOLDER=True
- SAVE_PAGE_OCR_VISUALISATIONS=False
- HYBRID_OCR_CONFIDENCE_THRESHOLD=97
- INCLUDE_OCR_VISUALISATION_IN_OUTPUT_FILES=True
- PREPROCESS_LOCAL_OCR_IMAGES=False
- INFERENCE_SERVER_DISABLE_THINKING=True
- MAX_NEW_TOKENS=196608
- SAVE_EXAMPLE_HYBRID_IMAGES=False
- SAVE_VLM_INPUT_IMAGES=False
- VLM_MAX_DPI=200.0
- DEFAULT_NEW_BATCH_CHAR_COUNT=1250
- REPORT_VLM_OUTPUTS_TO_GUI=True
- REPORT_LLM_OUTPUTS_TO_GUI=True
- ADD_VLM_BOUNDING_BOX_RULES=False
- RUN_MCP_SERVER=True
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
ports:
- "7861:7860"
networks:
- redaction-net-llama
networks:
redaction-net-llama:
driver: bridge
volumes:
hf-llama-cache-qwen36-35b:
hf-llama-cache-qwen36-27b:
hf-llama-cache-qwen35-35b:
hf-llama-cache-qwen35-27b:
hf-llama-cache-qwen9b:
hf-llama-cache-gemma4-31b:
hf-llama-cache-gemma4-26b:
hf-hub-cache-qwen36-35b:
hf-hub-cache-qwen36-27b:
hf-hub-cache-qwen35-35b:
hf-hub-cache-qwen35-27b:
hf-hub-cache-qwen9b:
hf-hub-cache-gemma4-31b:
hf-hub-cache-gemma4-26b: