rikhoffbauer2 commited on
Commit
b4eb46e
·
verified ·
1 Parent(s): dc81bd8

feat: use `htdemucs` model for stem separation instead of `htdemucs_ft`

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -3,7 +3,7 @@
3
  Automatic perfect song lyric acquisition and synchronization.
4
 
5
  Pipeline:
6
- 1. Vocal separation (Demucs htdemucs_ft)
7
  2. Word-level transcription (Whisper large-v3)
8
  3. Song identification (AcoustID / transcript search)
9
  4. Lyrics fetching (LRCLIB)
@@ -96,9 +96,9 @@ def get_demucs_model(device="cpu"):
96
  global _demucs_model
97
  if _demucs_model is None:
98
  from demucs.pretrained import get_model
99
- _demucs_model = get_model("htdemucs_ft")
100
  _demucs_model.eval()
101
- logger.info("Demucs htdemucs_ft loaded")
102
  _demucs_model.to(device)
103
  return _demucs_model
104
 
@@ -492,8 +492,8 @@ def run_pipeline(audio_path: str, artist: str, title: str, progress=gr.Progress(
492
  device = "cuda" if torch.cuda.is_available() else "cpu"
493
  log(f"🖥️ Using device: {device}")
494
 
495
- progress(0.05, desc="🎵 Separating vocals (Demucs htdemucs_ft)...")
496
- log("🎵 Separating vocals with Demucs htdemucs_ft...")
497
  vocals_16k, sr_16k, vocals_44k, sr_44k = separate_vocals(audio_path, device=device)
498
  log(f" ✓ Vocals: {len(vocals_16k)/sr_16k:.1f}s extracted")
499
 
@@ -593,7 +593,7 @@ with gr.Blocks(title="🎵 Lyric Sync", css=".main-title{text-align:center;margi
593
  ass_output = gr.Textbox(label="ASS (karaoke \\k tags)", lines=20, show_copy_button=True, interactive=False)
594
  ass_download = gr.File(label="⬇ Download .ass")
595
  run_btn.click(fn=run_pipeline, inputs=[audio_input, artist_input, title_input], outputs=[status_output, lrc_enhanced_output, lrc_download, lrc_standard_output, srt_output, srt_download, json_output, json_download, ass_output, ass_download])
596
- gr.Markdown("---\n### How it works\n| Step | What | Technology |\n|------|------|---|\n| 1 | Vocal separation | Demucs htdemucs_ft (~9.2 dB SDR) |\n| 2 | Word-level transcription | Whisper large-v3 |\n| 3 | Song identification | AcoustID / LRCLIB text search |\n| 4 | Lyrics acquisition | LRCLIB (free, no auth) |\n| 5 | Alignment | Sequence alignment (LCS + fuzzy matching) |\n| 6 | Timing refinement | Onset/offset detection (librosa, 5.8ms resolution) |\n\n**Tips:** Provide artist & title for best results. Supported: MP3, WAV, FLAC, OGG, M4A. Processing: ~30-90s.")
597
 
598
  if __name__ == "__main__":
599
  demo.launch()
 
3
  Automatic perfect song lyric acquisition and synchronization.
4
 
5
  Pipeline:
6
+ 1. Vocal separation (Demucs htdemucs)
7
  2. Word-level transcription (Whisper large-v3)
8
  3. Song identification (AcoustID / transcript search)
9
  4. Lyrics fetching (LRCLIB)
 
96
  global _demucs_model
97
  if _demucs_model is None:
98
  from demucs.pretrained import get_model
99
+ _demucs_model = get_model("htdemucs")
100
  _demucs_model.eval()
101
+ logger.info("Demucs htdemucs loaded")
102
  _demucs_model.to(device)
103
  return _demucs_model
104
 
 
492
  device = "cuda" if torch.cuda.is_available() else "cpu"
493
  log(f"🖥️ Using device: {device}")
494
 
495
+ progress(0.05, desc="🎵 Separating vocals (Demucs htdemucs)...")
496
+ log("🎵 Separating vocals with Demucs htdemucs...")
497
  vocals_16k, sr_16k, vocals_44k, sr_44k = separate_vocals(audio_path, device=device)
498
  log(f" ✓ Vocals: {len(vocals_16k)/sr_16k:.1f}s extracted")
499
 
 
593
  ass_output = gr.Textbox(label="ASS (karaoke \\k tags)", lines=20, show_copy_button=True, interactive=False)
594
  ass_download = gr.File(label="⬇ Download .ass")
595
  run_btn.click(fn=run_pipeline, inputs=[audio_input, artist_input, title_input], outputs=[status_output, lrc_enhanced_output, lrc_download, lrc_standard_output, srt_output, srt_download, json_output, json_download, ass_output, ass_download])
596
+ gr.Markdown("---\n### How it works\n| Step | What | Technology |\n|------|------|---|\n| 1 | Vocal separation | Demucs htdemucs (~9.2 dB SDR) |\n| 2 | Word-level transcription | Whisper large-v3 |\n| 3 | Song identification | AcoustID / LRCLIB text search |\n| 4 | Lyrics acquisition | LRCLIB (free, no auth) |\n| 5 | Alignment | Sequence alignment (LCS + fuzzy matching) |\n| 6 | Timing refinement | Onset/offset detection (librosa, 5.8ms resolution) |\n\n**Tips:** Provide artist & title for best results. Supported: MP3, WAV, FLAC, OGG, M4A. Processing: ~30-90s.")
597
 
598
  if __name__ == "__main__":
599
  demo.launch()