fix(nlp): collapse runaway phrase repetition in automatic transcripts DEV-2733 - #7500
Draft
platreth wants to merge 1 commit into
Draft
fix(nlp): collapse runaway phrase repetition in automatic transcripts DEV-2733#7500platreth wants to merge 1 commit into
platreth wants to merge 1 commit into
Conversation
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.
📣 Summary
Automatic transcripts no longer fill up with the same short phrase repeated hundreds of times.
📖 Description
When automatic transcription got stuck on a short phrase (reported with Swahili audio mixed with French), the transcript came back as pages of the same two words repeated until the end of the recording. Those runaway repeats are now trimmed and the rest of the transcript is kept as is.
💭 Notes
chirp_3) can fall into a decoder loop on low-resource languages: the ticket's audio yieldsna niko,about 300 times, even with thesw:autooverride from DEV-2403 active, so remapping the language code doesn't prevent it._read_batch_result(), the single choke point for both completion paths. Comparison ignores case and punctuation drift; a transcript with nothing to trim comes back byte-identical.ASR_MAX_CONSECUTIVE_REPEATS(default 5, 0 disables), so it can be tuned without a deploy, same asASR_LANGUAGE_CODE_OVERRIDES.👀 Preview steps
Backend only, reproducible with the bundled tests (in the kpi container):
pytest kobo/apps/subsequences/tests/test_repetition.py kobo/apps/subsequences/integrations/tests/test_google_transcribe.py -q🔴 On
main, a batch result whose transcript is<valid text> na niko, na niko, …(×300) is stored verbatim: 2,739 characters of loop.🟢 On this PR, the same payload is stored as the valid text plus 5 repeats (84 characters), and a warning with the sizes is logged.