feat: waveform overlay, signal safety, training cancel, dynamic batch size, duplicate detection

- WaveformWorker extracts low-res audio envelope via ffmpeg, drawn as
  green polygon on timeline track
- _safe_disconnect() replaces bare TypeError catches for signal cleanup
- Train button toggles to Cancel during training, calls worker.cancel()
- Dynamic GPU batch sizing: 64 for ≥16GB VRAM, 32 for ≥8GB, 16 default
- Overlap warning before exporting clips that intersect existing markers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 12:53:48 +02:00
parent 2b7dfb330d
commit a0286d5cf9
2 changed files with 120 additions and 14 deletions
+11
View File
@@ -171,7 +171,18 @@ def _extract_w2v_windows(y: np.ndarray, sr: int = _SR,
import torch
model, device = _get_w2v_model(model_name)
is_beats = (model_name or _DEFAULT_EMBED_MODEL) == "BEATS"
# Auto-size batches based on available GPU memory
batch_size = 16
if device == "cuda":
try:
vram_gb = torch.cuda.get_device_properties(0).total_mem / 1e9
if vram_gb >= 16:
batch_size = 64
elif vram_gb >= 8:
batch_size = 32
_log(f"audio_scan: batch_size={batch_size} (VRAM {vram_gb:.1f} GB)")
except Exception:
pass
timestamps = np.arange(n_windows) * hop
embeddings = []