Files
stemengine_old/stemengine.yml
T
translator 5c2152c57c feat: Omnizart MIDI transcription — phases 1-3
Phase 1 (omnizart-music MVP):
- config.py: add omnizart-music/vocal/vocal-contour to TRANSCRIBE_MODES with
  engine + description fields; add OMNIZART_ENABLED and OMNIZART_SIDECAR_URL
  env-var config constants
- transcriber_service.py: dispatch run_transcription() to basic-pitch or
  omnizart based on mode prefix; extract _run_basic_pitch() helper
- routers/transcribe.py: add 503 guard for omnizart modes when disabled;
  GET /modes now returns available flag per mode

Phase 2 (all three Omnizart modes):
- backend/services/omnizart_service.py (new): WAV conversion via ffmpeg with
  10 s minimum padding; subprocess invocation with cancellation polling;
  vocal mode CWD quirk handled by setting cwd=tmp; all three modes supported

Phase 3 (frontend polish + sidecar):
- types.ts: extend ModeOption with engine, available, description fields
- ProjectDetail.tsx: replace static TRANSCRIBE_MODES with live useQuery call
  to GET /api/transcribe/modes; add TranscribeModeSelect component with
  <optgroup> grouping by engine, disabled options for unavailable modes, and
  title= tooltips from description field; handleTranscribeAll auto-selects
  omnizart-music when available, falls back to polyphonic
- omnizart-sidecar/app.py + Dockerfile (new): minimal FastAPI HTTP wrapper
  around the Omnizart CLI; single POST /transcribe endpoint; GET /health
- stemengine.yml: add omnizart-sidecar service (profiles: [omnizart]); add
  OMNIZART_ENABLED and OMNIZART_SIDECAR_URL env vars to stemengine service
2026-03-14 13:00:36 +09:00

131 lines
5.4 KiB
YAML

services:
# Minimal privileged init container: sets the GPU power limit then exits.
# Runs before stemengine so the main container never needs SYS_ADMIN.
stemengine:
container_name: stemengine
image: ghcr.io/seclusionenthusiast/stemengine:latest
runtime: nvidia
entrypoint: []
restart: unless-stopped
depends_on:
stemengine-gpu-init:
condition: service_completed_successfully
networks:
- t2_proxy
security_opt:
- no-new-privileges:true
ports:
- "8000:8000"
volumes:
# Source code (live mount — changes reflect immediately via uvicorn --reload)
- ${SEFOLDER}/backend:/app/backend
- ${SEFOLDER}/lyrics-sync:/app/lyrics-sync
# Persistent storage for uploaded files and job outputs
- ${SEFOLDER}/jobs:/app/media/jobs
- ${SEFOLDER}/uploads:/app/media/uploads
- ${SEFOLDER}/imports:/app/media/imports
- ${SEFOLDER}/db:/app/media/db
# LRC sync data
- ${SEFOLDER}/lrc_sync:/app/media/lrc_sync
# Model caches (avoid re-downloading after container restart)
- ${SEFOLDER}/stemengine-models:/root/.cache
- ${SEFOLDER}/opt:/opt
# Frontend source — live mount so vite --watch picks up edits without a rebuild.
- ${SEFOLDER}/frontend:/app/frontend
# node_modules overlay: preserves the image-seeded packages; overlays the dir mount above.
- stemengine-node-modules:/app/frontend/node_modules
# Projects folder (where separated stems are stored)
- ${PROJECTS}:/app/media/projects
- ${SEFOLDER}/start.sh:/app/start.sh:ro
command: /app/start.sh
environment:
- PUID=${PUID:-1000}
- PGID=${PGID:-1000}
- TZ=${TZ:-UTC}
# Root media directory — all path defaults derive from this.
- MEDIA_DIR=/app/media
# Storage layout (defaults shown — uncomment and change to override)
- UPLOAD_DIR=/app/media/uploads
- JOBS_DIR=/app/media/jobs
- PROJECTS_DIR=/app/media/projects
- DB_PATH=/app/media/db/stemengine.db
- LRC_SYNC_DIR=/app/media/lrc_sync
- BS_ROFORMER_MODEL_DIR=/opt/bs_roformer_models
- MEL_BAND_MODEL_DIR=/opt/mel_band_models
- MDXNET_MODEL_DIR=/opt/mdxnet_models
- SCNET_MODEL_DIR=/opt/scnet_models
- MEDLEYVOX_MODEL_DIR=/opt/medleyvox_models
- APOLLO_MODEL_DIR=/opt/apollo_models
- ASPIRATION_MODEL_DIR=/opt/aspiration_models
- BANDIT_MODEL_DIR=/opt/bandit_models
- CPU_SEPARATION=${CPU_SEPARATION:-false}
- STEMENGINE_GPU_POWER_LIMIT=${STEMENGINE_GPU_POWER_LIMIT:-100}
- MAX_UPLOAD_MB=${MAX_UPLOAD_MB:-500}
- PYTHONUNBUFFERED=1
# Prevent CUDA OOM from allocator fragmentation when multiple large models
# (Demucs, BS-RoFormer, Whisper) are loaded in the same process.
- PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
# Secret key for encrypting credentials at rest (required for Settings UI storage)
# Generate with: python3 -c "import secrets; print(secrets.token_hex(32))"
- SECRET_KEY=${SECRET_KEY}
# Subsonic server (optional — can also be set via the Settings UI)
- SUBSONIC_URL=${NAVSERVER}
- SUBSONIC_USERNAME=${NAVUSER}
- SUBSONIC_PASSWORD=${NAVPASS}
- HF_TOKEN=${HF_TOKEN}
# Omnizart MIDI transcription (optional — set OMNIZART_ENABLED=true to activate)
# Set to 'true' once the omnizart-sidecar service is running.
- OMNIZART_ENABLED=${OMNIZART_ENABLED:-false}
# URL of the omnizart-sidecar container (used when OMNIZART_ENABLED=true).
# Must be reachable from inside the stemengine container.
- OMNIZART_SIDECAR_URL=${OMNIZART_SIDECAR_URL:-http://omnizart-sidecar:9765}
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
# Persists node_modules across container restarts; seeded from image on first start.
stemengine-node-modules:
# Omnizart sidecar model cache — avoids re-downloading on restart.
omnizart-model-cache:
# ── Omnizart Sidecar ──────────────────────────────────────────────────────
# Build: docker compose -f stemengine.yml build omnizart-sidecar
# Start: docker compose -f stemengine.yml up -d omnizart-sidecar
# Then set OMNIZART_ENABLED=true and restart the stemengine service.
omnizart-sidecar:
container_name: omnizart-sidecar
build:
context: ${SEFOLDER}/omnizart-sidecar
dockerfile: Dockerfile
restart: unless-stopped
networks:
- t2_proxy
ports:
- "9765:9765" # expose for direct testing; remove in production
volumes:
# Cache Omnizart models between restarts (~500 MB)
- omnizart-model-cache:/root/.omnizart
environment:
- PYTHONUNBUFFERED=1
- OMNIZART_BIN=${OMNIZART_BIN:-omnizart}
# No GPU reservation by default — Omnizart can run on CPU (slower).
# Uncomment the block below to grant GPU access:
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
profiles:
# Only started when you explicitly enable the omnizart profile:
# docker compose -f stemengine.yml --profile omnizart up -d
- omnizart
networks:
t2_proxy:
external: true