Repository navigation
Keep the transcript when speakers can't be labelled on import or recovery - #37
Merged
Merged
Conversation
…rt or recovery With Detect speakers on, `transcribe` resolved models with diarization, so import and crash recovery failed before transcribing when the speaker- detection pack wasn't installed, showing the resolver's file list. A diarization error after transcription also threw the transcript away. `transcribe` now resolves the transcription models only and labels speakers as a separate step, shared with Stop (`label_speakers`). If labelling fails, the transcript comes back without speakers and with a note, in the same shape Stop returns (`NewTranscript`). A missing pack gets a plain note: "The speaker-detection pack isn't installed, so this transcript has no speakers. Add it on the Models page." Stop shows that note too now. The app opens imports and recoveries from the result's `speakersLabelled` and shows its note; a recovery puts it after the usual recovered note. Closes #35
From a Codex review of #37. Stop resolved the models, read the whole recording, and only then found the speaker models missing, holding about 230 MB per hour of audio just to return the note. On main, resolving with speakers on failed before the audio was read. `speaker_engine` now checks for the models and builds the engine; `label_speakers` runs it. Stop calls the first before reading the recording. The comment on `transcribe` no longer claims a failing speaker pack can't cost the transcript: resolving still unpacks every verified pack, so one that fails to unpack stops transcription (#38, already the case on main).
From /simplify on #37; behaviour is unchanged. - `finish_transcript` builds the result for Import, recovery and Stop: labels speakers if asked, applies the vocabulary file, reports progress (at engine::PROGRESS_TRANSCRIBE_END, not a literal 0.95) and turns a labelling error into the note. The speaker-less transcript is built only when it's used. - `speaker_engine` no longer checks for the speaker models itself: `SherpaEngine::new` already does, and its ModelNotFound becomes the "pack isn't installed" note. The speaker step passes anyhow errors up (anyhow was already in the tree through `engine`). - `resolve_models_dir` and `resolve_verified_models_dir` lose their `diarize` flag, which every caller set to false. The resolver's doc says the app relies on its folder holding every verified pack (#38). - App: `FinishedRecording` extends `NewTranscript`, and `openNewTranscript` takes the result instead of six arguments.
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.
Closes #35.
What changed
With Detect speakers on,
transcribe(app/src-tauri/src/commands.rs) resolved models with diarization. So import and crash recovery failed before transcribing when the speaker-detection pack wasn't installed, and showed the resolver's list of missing files. A diarization error after transcription also threw the finished transcript away.transcriberesolves the transcription models only, then labels speakers as a separate step. If that step fails, the transcript is kept, without speakers and with a note saying why.speaker_enginebuilds the speaker engine, which checks for the speaker models.label_speakersruns it. Together they replace Stop's private copy, and Stop builds the engine before it reads the recording.finish_transcriptbuilds the result for all three. It labels speakers if asked, applies the vocabulary file, reports progress and turns a labelling error into the note.NewTranscript(transcript,speakersLabelled,note) replacesStoppedRecording.speakersLabelledand show its note. A recovery puts the note after its usual "Recovered from a recording that had no transcript…".openNewTranscripttakes the whole result, andFinishedRecordingextendsNewTranscript.diarizeflag, which every caller now sets to false.Not in this PR:
main; fixing it means changing how packs are cached.engine::processis unchanged. The app no longer calls it, but the command-line example still fails outright on a diarization error.speaker_engineandlabel_speakersdon't need anAppHandle, so it's practical, but it wasn't one of the agreed tests.Reviews
Codex
Two P2 findings, both addressed in the second commit:
main, resolving with speakers on failed before the audio was read. Fixed: Stop builds the speaker engine, which checks for the models, before reading the recording.main, so it's filed as A speaker pack that fails to unpack still stops transcription #38. The code comment and this description no longer claim otherwise./simplifyThe third commit changes no behaviour:
diarizeflag.main, and changing it changes what happens if a pack is removed mid-recording.Tests
The two tests agreed on #35, in
app/src/App.test.tsx, both failed before the fix (segments is not iterable, no note) and pass now:transcribereturns a transcript and a note: it opens without speakers, shows the note, and savesdiarized: false.The default
transcribemock now returns the new result shape; no assertions changed.cargo check --all-targetswith no warningsVerified in the desktop app
tauri devon macOS, withKINDTECH_MODELS_DIRpointing at a models folder that has no speaker-detection models:The transcript opened in paragraph mode with the note "Recovered from a recording that had no transcript. The last moment of audio may be missing. The speaker-detection pack isn't installed, so this transcript has no speakers. Add it on the Models page." The saved session has
diarized: falseand all 44 words, and the recording left the interrupted list.Runs after the Codex fixes and after
/simplifygave the same result. The last run checks that the engine's "model not found" error becomes the plain note.The app was driven through Accessibility only, without keystrokes. Three paths weren't driven:
cargo check.transcribecommand.