Skip to content

Drop configurable ASR no-speech markers from transcripts - #171

Open
aviv1ron1 wants to merge 1 commit into
mainfrom
bugfix/asr-no-speech-markers
Open

aviv1ron1 wants to merge 1 commit into
mainfrom
bugfix/asr-no-speech-markers

Conversation

@aviv1ron1

@aviv1ron1 aviv1ron1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

closes #165

Problem

Some ASR models emit a marker such as <|nospeech|> for silence or non-speech. That marker was spliced into the LLM prompt as if the user had said it.

Change

  • New config field asr_no_speech_markers: list[str] | None, set at compose time with a repeatable --asr-no-speech-marker flag. The marker depends on the ASR model, so there is no default: nothing is removed unless configured. Empty markers and a bare string (instead of a list) are rejected.
  • Every occurrence of each configured marker is removed from each transcribed window, before long-audio windows are merged. This covers a marker next to speech, repeated markers, a marker inside one window, and the self_chunks=True path.
  • Only the configured exact strings are removed. Any other tag (timings, emotions, language tags) is kept.
  • The markers are part of the transcriber cache key; the processor passes them through from config.
  • Documented in docs/AUDIO.md (compose flag and config.json form).

Supersedes #169, which only dropped a transcript that was exactly <|nospeech|> and hardcoded that string.

Usage

python -m granite_switch.composer.compose_granite_switch \
  --adapters ... --enable-audio \
  --asr-no-speech-marker "<|nospeech|>"

Existing checkpoints: add "asr_no_speech_markers": ["<|nospeech|>"] to config.json.

Tests

  • New: marker removal (alone, repeated, next to speech, mid-sentence, several markers, other tags kept, no markers configured, self_chunks=True, per-window before merge), cache key, config round-trip and validation, CLI flag parsing, processor passthrough.

Some ASR models emit a marker such as <|nospeech|> for silence or
non-speech, and that marker was spliced into the LLM prompt as if the
user had said it.

Add asr_no_speech_markers to GraniteSwitchConfig, set at compose time
with a repeatable --asr-no-speech-marker flag. The markers are
model-specific, so there is no default and nothing is removed unless
configured. Every occurrence of each marker is removed from each
transcribed window before long-audio windows are merged, so a marker
next to speech, repeated, or inside one chunk is caught as well. Only
the configured exact strings are removed; other tags such as timings,
emotions or language tags are kept.

The markers are part of the transcriber cache key and are documented
in docs/AUDIO.md.

Signed-off-by: aviv ron <rona@il.ibm.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@aviv1ron1
aviv1ron1 marked this pull request as ready for review November 10, 2026 13:52
@aviv1ron1 aviv1ron1 assigned aviv1ron1 and barvhaim and unassigned aviv1ron1 Nov 10, 2026
@aviv1ron1

Copy link
Copy Markdown
Collaborator Author

/gpu-test-audio

@github-actions

Copy link
Copy Markdown

✅ GPU tests passed — vllm30-audio

221 passed, 1 skipped, 2908 deselected, 23 warnings in 668.23s (0:11:08)

Commit: c390236c211c0889fdee2bdbed9ac05a97428714
Full run & artifact log

Last 40 log lines

tests/composer/test_compose_e2e.py:83
  /tmp/granite-switch/tests/composer/test_compose_e2e.py:83: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:124
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:124: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:130
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:130: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:230
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:230: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_upstream_files.py:218
  /tmp/granite-switch/tests/composer/test_upstream_files.py:218: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("upstream_build_e2e")

.venv/lib/python3.12/site-packages/torch/jit/_script.py:365: 14 warnings
  /tmp/granite-switch/.venv/lib/python3.12/site-packages/torch/jit/_script.py:365: DeprecationWarning: `torch.jit.script_method` is deprecated. Please switch to `torch.compile` or `torch.export`.
    warnings.warn(

tests/unit/test_asr.py::TestMonoAndResample::test_resample_real_vllm_backend[8000-16000]
tests/unit/test_asr.py::TestMonoAndResample::test_resample_real_vllm_backend[44100-16000]
  /tmp/granite-switch/.venv/lib/python3.12/site-packages/torch/backends/mkldnn/__init__.py:96: UserWarning: TF32 acceleration on top of oneDNN is available for Intel GPUs. The current Torch version does not have Intel GPU Support. (Triggered internally at /__w/pytorch/pytorch/aten/src/ATen/Context.cpp:265.)
    torch._C._set_onednn_allow_tf32(_allow_tf32)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=== 221 passed, 1 skipped, 2908 deselected, 23 warnings in 668.23s (0:11:08) ===
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
===== ALL GPU TESTS PASSED =====
[14:11:00] <job> Succeeded
[14:11:02] verified: found success sentinel in pod log
[14:11:02] cleanup: deleting <job> (exit=0)
<job> "<job>" deleted

Verdict: PASSED

@github-actions

Copy link
Copy Markdown

✅ GPU tests passed — vllm26-audio

222 passed, 2908 deselected, 21 warnings in 1084.13s (0:18:04)

Commit: c390236c211c0889fdee2bdbed9ac05a97428714
Full run & artifact log

Last 40 log lines
<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute

<frozen importlib._bootstrap>:488
  <frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute

tests/composer/test_compose_e2e.py:83
  /tmp/granite-switch/tests/composer/test_compose_e2e.py:83: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:124
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:124: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:130
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:130: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_multi_audio_compose_e2e.py:230
  /tmp/granite-switch/tests/composer/test_multi_audio_compose_e2e.py:230: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("multi_audio_compose_e2e")

tests/composer/test_upstream_files.py:218
  /tmp/granite-switch/tests/composer/test_upstream_files.py:218: PytestUnknownMarkWarning: Unknown pytest.mark.xdist_group - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.xdist_group("upstream_build_e2e")

.venv/lib/python3.12/site-packages/torch/jit/_script.py:365: 14 warnings
  /tmp/granite-switch/.venv/lib/python3.12/site-packages/torch/jit/_script.py:365: DeprecationWarning: `torch.jit.script_method` is deprecated. Please switch to `torch.compile` or `torch.export`.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======== 222 passed, 2908 deselected, 21 warnings in 1084.13s (0:18:04) ========
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
===== ALL GPU TESTS PASSED =====
[14:19:00] <job> Succeeded
[14:19:03] verified: found success sentinel in pod log
[14:19:03] cleanup: deleting <job> (exit=0)
<job> "<job>" deleted

Verdict: PASSED

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audio: ASR outputs the literal text <|nospeech|> into the LLM prompt

3 participants