Repository navigation
fix(asr): collapse wav2vec2 repeats before dropping the CTC blank - #1957
Open
chessing234 wants to merge 1 commit into
Open
chessing234 wants to merge 1 commit into
chessing234 wants to merge 1 commit into
Conversation
skip_special_tokens removes the pad blank before repeated ids are merged, so doubled letters disappear.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1947
_call_wav2vec2decoded withskip_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 --teststyle check ofpackages/transformers/tests/pipelines/ctc_decode.test.jspassed locally (4 cases, including the blank-separated repeat).