Files
MastersThesis/src/paddle_ocr/docker-compose.workers.yml

93 lines
2.3 KiB
YAML
Raw Normal View History

2026-01-18 08:19:34 +01:00
# docker-compose.workers.yml - Multiple PaddleOCR workers for parallel Ray Tune
#
# Usage:
# GPU (4 workers sharing GPU):
# docker compose -f docker-compose.workers.yml up
#
# CPU (4 workers):
# docker compose -f docker-compose.workers.yml --profile cpu up
#
# Scale workers (e.g., 8 workers):
# NUM_WORKERS=8 docker compose -f docker-compose.workers.yml up
#
# Each worker runs on a separate port: 8001, 8002, 8003, 8004, ...
x-ocr-gpu-common: &ocr-gpu-common
image: seryus.ddns.net/unir/paddle-ocr-gpu:latest
volumes:
- ../dataset:/app/dataset:ro
2026-01-18 18:03:23 +01:00
- ../debugset:/app/debugset:rw
2026-01-18 08:19:34 +01:00
- paddlex-cache:/root/.paddlex
environment:
- PYTHONUNBUFFERED=1
- CUDA_VISIBLE_DEVICES=0
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 120s
x-ocr-cpu-common: &ocr-cpu-common
2026-01-18 17:38:42 +01:00
image: seryus.ddns.net/unir/paddle-ocr-cpu:latest
2026-01-18 08:19:34 +01:00
volumes:
- ../dataset:/app/dataset:ro
2026-01-18 18:03:23 +01:00
- ../debugset:/app/debugset:rw
2026-01-18 08:19:34 +01:00
- paddlex-cache:/root/.paddlex
environment:
- PYTHONUNBUFFERED=1
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 120s
services:
# GPU Workers (gpu profile) - share single GPU
ocr-worker-1:
<<: *ocr-gpu-common
container_name: paddle-ocr-worker-1
ports:
- "8001:8000"
profiles:
- gpu
ocr-worker-2:
<<: *ocr-gpu-common
container_name: paddle-ocr-worker-2
ports:
- "8002:8000"
profiles:
- gpu
# CPU Workers (cpu profile) - for systems without GPU
ocr-cpu-worker-1:
<<: *ocr-cpu-common
container_name: paddle-ocr-cpu-worker-1
ports:
- "8001:8000"
profiles:
- cpu
ocr-cpu-worker-2:
<<: *ocr-cpu-common
container_name: paddle-ocr-cpu-worker-2
ports:
- "8002:8000"
profiles:
- cpu
volumes:
paddlex-cache:
name: paddlex-model-cache