Files
stemengine_old/20260317_GPU_Limiter_MIDI_Integration.md
T
2026-03-17 11:39:17 +09:00

1.7 KiB

2026-03-17 — GPU limiter integration for MIDI transcription

Objective

Ensure MIDI transcription engines are governed by the same GPU safety policy used by separation/lyric flows, while preserving existing queue behavior and compatibility.

Recommendation

  1. Keep queue-level serialization as-is (jm.submit_gpu) for MIDI jobs.
  2. Explicitly apply backend GPU safety limits before basic-pitch inference.
  3. Apply a TensorFlow GPU memory cap in omnizart-sidecar using the same reserve-MB policy.
  4. Expose one optional sidecar override variable, defaulting to the global reserve.
  5. Document the behavior in project docs.

Implementation plan (completed)

  • Wire basic-pitch path to existing _apply_cuda_limits() before model load.
  • Add TensorFlow memory-limit setup in omnizart-sidecar/app.py.
  • Add OMNIZART_GPU_VRAM_RESERVE_MB env in compose files with fallback to STEMENGINE_GPU_VRAM_RESERVE_MB.
  • Update README configuration/GPU notes.

Files changed

  • backend/services/transcriber_service.py
  • omnizart-sidecar/app.py
  • stemengine.yml (workspace-level)
  • appdata/stemengine/stemengine.yml (repo-level)
  • README.md

Behavioral outcome

  • basic-pitch now executes after backend GPU limit setup.
  • omnizart-sidecar now configures TensorFlow GPU usage to preserve VRAM headroom:
    • hard cap when total VRAM is detectable via nvidia-smi
    • memory-growth fallback when total VRAM is not detectable
  • Existing single-worker GPU queue semantics remain unchanged.

Notes

  • TensorFlow logical-device configuration must occur before TF runtime initialization.
  • Sidecar applies limiter at process startup (module import path) before loading Omnizart.
  • Set reserve to 0 to disable cap behavior.