From 9a556218b13a270a9d11e7c26840372209a254d8 Mon Sep 17 00:00:00 2001 From: Adhiraj Deshmukh Date: Tue, 5 May 2026 19:21:29 +0530 Subject: [PATCH 1/2] Fix automatic span prediction bug --- sam_audio/model/model.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sam_audio/model/model.py b/sam_audio/model/model.py index 1bf5c586..9afa8812 100644 --- a/sam_audio/model/model.py +++ b/sam_audio/model/model.py @@ -267,6 +267,13 @@ def separate( ), ) + forward_args["anchor_ids"] = self._repeat_for_reranking( + batch.anchor_ids, reranking_candidates + ) + forward_args["anchor_alignment"] = self._repeat_for_reranking( + batch.anchor_alignment, reranking_candidates + ) + audio_features = forward_args["audio_features"] B, T, C = audio_features.shape C = C // 2 # we stack audio_features, so the actual channels is half From 7632825a979fff68e7761be639dfaffd289129f2 Mon Sep 17 00:00:00 2001 From: Adhiraj Deshmukh Date: Sun, 24 May 2026 17:18:20 +0530 Subject: [PATCH 2/2] Cleaner fix for PR predict_spans() mutates batch.anchor_ids / batch.anchor_alignment. Refresh the cached forward args so the ODE uses predicted temporal anchors. --- sam_audio/model/model.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sam_audio/model/model.py b/sam_audio/model/model.py index 9afa8812..2ac5ddc7 100644 --- a/sam_audio/model/model.py +++ b/sam_audio/model/model.py @@ -267,11 +267,16 @@ def separate( ), ) - forward_args["anchor_ids"] = self._repeat_for_reranking( - batch.anchor_ids, reranking_candidates - ) - forward_args["anchor_alignment"] = self._repeat_for_reranking( - batch.anchor_alignment, reranking_candidates + # Refresh anchor conditioning created by predict_spans() + forward_args.update( + { + "anchor_ids": self._repeat_for_reranking( + batch.anchor_ids, reranking_candidates + ), + "anchor_alignment": self._repeat_for_reranking( + batch.anchor_alignment, reranking_candidates + ), + } ) audio_features = forward_args["audio_features"]