Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
fix(realtime): accept bounded partial VAD overrun
LauraGPT980765099dea
diff --git a/funasr/bin/realtime_ws.py b/funasr/bin/realtime_ws.pyindex 02728b2c5..5659b7cc1 100644--- a/funasr/bin/realtime_ws.py+++ b/funasr/bin/realtime_ws.py@@ -1099,7 +1099,8 @@ class RealtimeASRSession:and recent_eligibleand recent_observations >= 2and int(recent_start_ms) == int(seg[0])- and 0 <= tail_gap_ms <= max(100, decode_chunk_ms * 2)+ and -max(100, decode_chunk_ms) <= tail_gap_ms+ and tail_gap_ms <= max(100, decode_chunk_ms * 2)and recent_partialand not recent_hallucinated):diff --git a/tests/test_realtime_ws_service.py b/tests/test_realtime_ws_service.pyindex a3686ff90..6d52b98b4 100644--- a/tests/test_realtime_ws_service.py+++ b/tests/test_realtime_ws_service.py@@ -569,6 +569,48 @@ def test_long_segment_recovers_from_single_character_final():assert text == partial+def test_long_segment_accepts_partial_slightly_past_vad_end():+ module = load_service_module()+ partial = (+ "哎,不好意思,上午好,高雄交通比较混乱,影响人有点。"+ "哎,哎,胡总,各位长官,大家好。"+ )+ session = make_reported_long_segment_reconciliation_session(+ module, partial, partial_end_ms=126976+ )+ session.last_partial_start_ms = 114430+ session.segment_best_partial_start_ms = 114430++ text = session._reconcile_completed_segment_text(+ "哎",+ [114430, 126740],+ decode_succeeded=True,+ )++ assert text == partial+++def test_long_segment_rejects_partial_far_past_vad_end():+ module = load_service_module()+ partial = (+ "哎,不好意思,上午好,高雄交通比较混乱,影响人有点。"+ "哎,哎,胡总,各位长官,大家好。"+ )+ session = make_reported_long_segment_reconciliation_session(+ module, partial, partial_end_ms=128800+ )+ session.last_partial_start_ms = 114430+ session.segment_best_partial_start_ms = 114430++ text = session._reconcile_completed_segment_text(+ "哎",+ [114430, 126740],+ decode_succeeded=True,+ )++ assert text == "哎"++def test_long_segment_recovers_when_an_early_partial_correction_hides_tail_regression():module = load_service_module()partial = (