Files
sokhan/deploy/docker-compose.yml
T
Abolfazl Ranjbaran 4821d812dc feat(accuracy): Persian accuracy stack v2 — measured -24.3 WER points on the default stack
Every decision below is measured on the 12-clip Common Voice fa fixture
with a reproducible harness; no number is hand-written.

- fa_polish module: orthographic-only repair (ZWNJ fusion, split
  imperatives like 'بی پوش' -> 'بپوش', Arabic code points, digits).
  Wired into the pipeline (FA_POLISH=true) and ported 1:1 to the browser
  demo (16-case parity test vs Python). -3.6 WER points.
- Persian orthography initial_prompt as the default: whisper copies the
  prompt's script style. -1.3 points (small), -4.8 (fine-tuned).
- Default engine small -> medium: 56.2% WER vs 75.0% (v2 harness) at
  ~1.1x realtime on 2 CPU cores. small stays the speed-first profile.
- Browser demo: default model base -> small (90.2% -> 75.0% under v2),
  polished output identical to the server's shape.
- benchmarks/tune_decode.py: the sweep harness behind every decision
  (prompt x beam x VAD x condition_on_previous_text).
- training/export_web_onnx.py: LoRA merge -> ONNX -> int8 -> HF Hub so
  the next fine-tune can run inside the browser demo.
- baseline.json regenerated for the v2 harness; weekly benchmark now
  guards small AND medium; gate test updated.

Fixture: small 80.5% -> 75.0%, fine-tuned 79.3% -> 75.0%, medium 56.2%.
2026-11-26 09:44:41 +00:00

105 lines
3.5 KiB
YAML

services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-sokhan}
# Required on purpose: shipping a default credential means every
# deployment that forgets the .env runs an open database.
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}
POSTGRES_DB: ${POSTGRES_DB:-sokhan}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sokhan"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
redis:
image: redis:7-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
api:
# Published to GHCR by the Docker workflow (pushes to main, version
# tags): `docker compose pull api worker` runs the prebuilt image
# without building; `up -d --build` keeps building locally.
image: ghcr.io/abolfazlrwm/sokhan-api:latest
build:
context: ../backend
environment: &backend-env
DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-sokhan}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD must be set (see .env.example)}@postgres:5432/${POSTGRES_DB:-sokhan}
REDIS_URL: redis://redis:6379/0
CELERY_ENABLED: "true"
DATA_DIR: /data
SOKHAN_CORS_ORIGINS: ${SOKHAN_CORS_ORIGINS:-}
WHISPER_MODEL_SIZE: ${WHISPER_MODEL_SIZE:-medium}
WHISPER_DEVICE: ${WHISPER_DEVICE:-cpu}
WHISPER_COMPUTE_TYPE: ${WHISPER_COMPUTE_TYPE:-int8}
WHISPER_BEAM_SIZE: ${WHISPER_BEAM_SIZE:-5}
WHISPER_INITIAL_PROMPT: ${WHISPER_INITIAL_PROMPT:-}
FA_POLISH: ${FA_POLISH:-true}
PUNCTUATION_ENABLED: ${PUNCTUATION_ENABLED:-true}
LOW_CONFIDENCE_THRESHOLD: ${LOW_CONFIDENCE_THRESHOLD:-0.5}
STREAMING_DECODE: ${STREAMING_DECODE:-true}
WEBHOOK_SIGNING_SECRET: ${WEBHOOK_SIGNING_SECRET:-}
FREE_MINUTES_PER_USER_PER_MONTH: ${FREE_MINUTES_PER_USER_PER_MONTH:-30}
PLAN_FREE_MAX_FILE_MINUTES: ${PLAN_FREE_MAX_FILE_MINUTES:-10}
PLAN_PRO_MAX_FILE_MINUTES: ${PLAN_PRO_MAX_FILE_MINUTES:-180}
PLAN_PRO_MONTHLY_MINUTES: ${PLAN_PRO_MONTHLY_MINUTES:-1200}
ADMIN_API_KEY: ${ADMIN_API_KEY:-}
MAX_UPLOAD_MB: ${MAX_UPLOAD_MB:-200}
SUMMARY_ENABLED: ${SUMMARY_ENABLED:-false}
LLM_API_BASE: ${LLM_API_BASE:-}
LLM_API_KEY: ${LLM_API_KEY:-}
LLM_MODEL: ${LLM_MODEL:-}
DIARIZATION_ENGINE: ${DIARIZATION_ENGINE:-stub}
PYANNOTE_MODEL: ${PYANNOTE_MODEL:-pyannote/speaker-diarization-3.1}
PYANNOTE_HF_TOKEN: ${PYANNOTE_HF_TOKEN:-}
volumes:
- sokhan-data:/data
ports:
- "${SOKHAN_API_PORT:-8000}:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
worker:
image: ghcr.io/abolfazlrwm/sokhan-api:latest
build:
context: ../backend
command: celery -A sokhan.worker.celery_app.celery_app worker --loglevel=info --concurrency=1
environment: *backend-env
volumes:
- sokhan-data:/data
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
web:
image: ghcr.io/abolfazlrwm/sokhan-web:latest
build:
context: ../web
args:
NEXT_PUBLIC_API_BASE: ${NEXT_PUBLIC_API_BASE:-http://localhost:8000}
ports:
- "${SOKHAN_WEB_PORT:-3000}:3000"
depends_on:
- api
restart: unless-stopped
volumes:
postgres-data:
sokhan-data: