Skip to content

fix(asr): collapse wav2vec2 repeats before dropping the CTC blank - #1957

Open
chessing234 wants to merge 1 commit into
huggingface:mainfrom
chessing234:fix/wav2vec2-ctc-repeats
Open

chessing234 wants to merge 1 commit into
huggingface:mainfrom
chessing234:fix/wav2vec2-ctc-repeats

Conversation

@chessing234

@chessing234 chessing234 commented Nov 20, 2026 •

Copy link
Copy Markdown

Fixes #1947

_call_wav2vec2 decoded with skip_special_tokens, which drops the pad blank before repeated ids are merged. A blank between two copies of the same letter is what keeps them apart, so "fellow" came out as "felow".

The argmax ids are collapsed first (merge repeats, then drop pad_token_id) and then decoded. collapseCtcRepeats([6, 5, 12, 0, 12, 15, 23], 0) is [6, 5, 12, 12, 15, 23]. Consecutive copies with no blank still merge, and a bigint id still matches a numeric blank.

node --test style check of packages/transformers/tests/pipelines/ctc_decode.test.js passed locally (4 cases, including the blank-separated repeat).

skip_special_tokens removes the pad blank before repeated ids are merged, so doubled letters disappear.

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.

wav2vec2 ASR drops repeated letters ("slipper" → "sliper"): blank tokens are skipped before CTC merges repeats

1 participant