mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-28 01:49:00 +09:00
## Summary - **Eliminates HTTP hop** between the audio worker Cloud Run Job and the audio-separator Cloud Run Service by running the `Separator` class directly with an L4 GPU attached - **Adds GPU Docker image** (`karaoke-backend-gpu`) with CUDA 12.6, PyTorch, and pre-baked ensemble preset models - **Moves audio worker to us-east4** with L4 GPU, 4 CPU, 16Gi memory — old separator service kept for rollback ## Changes ### Code - `audio_processor.py` — Ensemble presets wired into local Separator path (2-stage: `instrumental_clean` + `karaoke`) - `audio_worker.py` — Dual-mode support: `MODEL_DIR` env var → local GPU, `AUDIO_SEPARATOR_API_URL` → remote API - `create_audio_processor()` — New `model_file_dir` parameter to enable local GPU mode ### Infrastructure (Pulumi) - `gpu_artifact_registry.py` — New Artifact Registry in us-east4 for GPU images - `cloud_run.py` — Audio worker job: GPU (nvidia-l4), us-east4, 16Gi, `MODEL_DIR=/models` - `__main__.py` — Wire in GPU registry + Cloud Build IAM ### Docker - `Dockerfile.gpu-base` — CUDA 12.6 + Python 3.11 + audio-separator[gpu] + baked models - `cloudbuild-gpu-base.yaml` — Cloud Build config (E2_HIGHCPU_32, 100GB disk, 1h timeout) - `download_models.py` — Bakes `instrumental_clean` + `karaoke` preset models at build time ### Tests - 8 new unit tests covering factory config, mode selection, and preset wiring - Updated existing test patch targets for module-level Separator import ## Testing - [x] 22/22 unit tests pass (8 new + 14 existing) - [x] Code review completed (subagent-driven + final review) - [x] CodeRabbit CLI review completed locally - [ ] GPU image build (requires `gcloud builds submit`) - [ ] Production verification with `under_pressure_harmonies.flac` ## Rollback Plan Set `AUDIO_SEPARATOR_API_URL` back on the audio worker job → falls through to remote API path. Old separator service is still running (scale-to-zero). ## Design & Plan - Design spec: `docs/archive/2026-03-26-direct-gpu-audio-separation-design.md` - Implementation plan: `docs/archive/2026-03-26-direct-gpu-audio-separation-plan.md` @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
YAML
36 lines
1.1 KiB
YAML
# Cloud Build config for GPU base image
|
|
#
|
|
# Builds the CUDA + PyTorch + models base image used by the audio worker.
|
|
# This image is large (~10GB) so builds take 15-30 minutes.
|
|
#
|
|
# Trigger manually:
|
|
# gcloud builds submit --config=backend/cloudbuild-gpu-base.yaml --project=nomadkaraoke --timeout=3600s
|
|
#
|
|
# The app-layer Dockerfile uses this as its BASE_IMAGE for audio worker deploys.
|
|
|
|
steps:
|
|
- name: 'gcr.io/cloud-builders/docker'
|
|
args:
|
|
- 'build'
|
|
- '-f'
|
|
- 'backend/Dockerfile.gpu-base'
|
|
- '-t'
|
|
- 'us-east4-docker.pkg.dev/nomadkaraoke/karaoke-backend-gpu/karaoke-backend-gpu-base:latest'
|
|
- '-t'
|
|
- 'us-east4-docker.pkg.dev/nomadkaraoke/karaoke-backend-gpu/karaoke-backend-gpu-base:$BUILD_ID'
|
|
- '--build-arg'
|
|
- 'BUILD_DATE=$_BUILD_DATE'
|
|
- '--build-arg'
|
|
- 'BUILD_ID=$BUILD_ID'
|
|
- '.'
|
|
|
|
images:
|
|
- 'us-east4-docker.pkg.dev/nomadkaraoke/karaoke-backend-gpu/karaoke-backend-gpu-base:latest'
|
|
- 'us-east4-docker.pkg.dev/nomadkaraoke/karaoke-backend-gpu/karaoke-backend-gpu-base:$BUILD_ID'
|
|
|
|
timeout: '3600s'
|
|
|
|
options:
|
|
machineType: 'E2_HIGHCPU_32'
|
|
diskSizeGb: 100
|