Repository navigation
Unpack each model pack on its own, so a broken speaker pack can't stop transcription - #40
Merged
Merged
Conversation
… can't stop transcription The resolver unpacked every verified speech pack into one shared cache folder. One pack that failed to unpack (a corrupt entry, a full disk) stopped every import, recovery and recording, speakers on or off. Each pack now unpacks into its own folder, verified-models/pack-<sha256>/, like the LLM pack's llm-<sha256>/: - Transcription verifies `asr` packs only, picks one whose zip lists the model's files (each carries Silero VAD), and unpacks only that pack. - The speaker step resolves the `diarization` pack on its own (`resolve_verified_speaker_dir`). No pack gives the "isn't installed" note; one that can't be unpacked gives "Speakers couldn't be labelled". - Stop resolves only the speaker pack, so it no longer re-hashes the transcription packs. - The old shared folders (64-hex names) are removed when resolving. The engine gains `Diarizer`, which needs only the speaker models, and `speaker_model_files()`; SherpaEngine's diarize hands off to it. Tests sign packs with the committed test key through a dev-dependency on tools/modelpack-sign. The `diarize = true` resolver test is replaced by the speaker resolver's `Ok(None)` case. Closes #38
From /simplify on #40. - `verified_packs` takes the task and returns verified packs newest first; `verified_packs_of` and `pick_pack` are gone. Transcription stops at the newest pack whose zip lists its files, opening fewer zips. The speaker step takes the newest verified speaker pack, so one missing its files says "Speakers couldn't be labelled (…)" rather than "isn't installed". - One `unpacked(pack, cache_base, prefix)` serves speech packs (`pack-`) and the LLM pack (`llm-`), and the LLM resolver shares the newest-first rule. - `with_installed` builds the packs folder, cache folder, key and engine versions once for the three AppHandle wrappers; `packs_dir` reuses `app_cache_base`. - Engine: `transcription_model_files(asr_model)` sits beside `speaker_model_files()`; `required_model_files` combines them. `SherpaEngine::new` and `Diarizer::new` share `require_files` and `model_path`, and `Diarizer` moves below the trait impl so the impl's diff stays small. - The recorder's `Finished` keeps only `num_threads`, not a whole config; the debug override's file check is shared (`holds_all`).
The dev-dependency on tools/modelpack-sign changed the features of crates sherpa-onnx-sys's build uses (rand_core/getrandom, ring, rustls, ureq). On CI's partly matching cache, sherpa-onnx-sys was then rebuilt without re-fetching its prebuilt native library, and the app backend jobs on Linux and Windows failed to find `sherpa-onnx-c-api`. The tests now sign packs with ed25519-dalek (already a dev-dependency) and `modelpack::canonicalize`, encoding the signature with base64, which is already in the tree through `modelpack` with the same features.
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 #38.
What changed
The verified-pack resolver (
app/src-tauri/src/models.rs) unpacked every verified speech pack into one shared cache folder, named by a hash of the whole set. If any one pack failed to unpack (a corrupt entry, a full disk), the error stopped everything:After #37, unpacking was the last place a broken speaker pack could still cost the transcript.
Each pack now unpacks into its own folder,
verified-models/pack-<manifest sha256>/, like the LLM pack's existingllm-<sha256>/:asrpacks, and takes the newest one whose zip lists every file the model needs (each ASR pack carries Silero VAD). Only that pack is unpacked.resolve_verified_speaker_dirresolves the newest verifieddiarizationpack on its own.verified-models/are removed when transcription models resolve. Thepack-…andllm-…folders stay.Diarizerneeds only the speaker models;SherpaEngine'sdiarizehands off to it, soprocessand the examples are unchanged.speaker_model_files()andtranscription_model_files()are the file lists;required_model_filescombines them.diarizeflag, and the Keep the transcript when speakers can't be labelled on import or recovery #37 notes saying the app relied on the shared folder./simplifyThe second commit changes no tested behaviour.
Fixed:
SherpaEngineandDiarizershare one file check.Diarizermoved below the trait impl, so that impl no longer shows as moved.Skipped:
pack-<sha>/folder stays. Removing it deletes more than was agreed (old shared folders only), so that's for a follow-up.main. Verifying only the chosen pack would mean reading an unverified zip's directory first.diarizer_fortest hook: the approved speaker-step test needs it.Tests
Test packs are built and signed during the tests with the committed test key, using
ed25519-dalek(already a dev-dependency) andmodelpack::canonicalize. There are no new binary fixtures.The first version signed through a dev-dependency on
tools/modelpack-sign. That changed the features of cratessherpa-onnx-sys's build uses. On CI's partly matching cache,sherpa-onnx-syswas then rebuilt without re-fetching its prebuilt library, so the Linux and Windows app-backend jobs failed with "could not find native static librarysherpa-onnx-c-api". The third commit drops that dependency, and all 12 checks pass.a_speaker_pack_that_fails_to_unpack_does_not_stop_transcription_models_resolving.mainit failed withextracting zip entry sherpa-onnx-pyannote-segmentation-3-0/model.onnx: Invalid checksum.speaker_models_resolve_from_the_speaker_pack_alone, includingOk(None)when only an ASR pack is installed.resolving_removes_the_old_shared_cache_folders.the_speaker_step_says_why_a_transcript_has_no_speakers: the speaker-step test approved on Keep the transcript when speakers can't be labelled on import or recovery #37, giving the exact "isn't installed" note, and the "couldn't be labelled" note for a pack that fails to unpack.resolve_verified_models_dir_in_fails_closed_when_diarization_models_missingtested the removeddiarize = truemode. TheOk(None)case above covers it.Results:
cargo check --all-targets: no warnings for app or enginescripts/check-no-network.sh: passesVerified in the desktop app
tauri devon macOS, on the release-style verified-pack path:KINDTECH_PACKS_DIRpointed at packs signed with the test key: a real Parakeet v2 int8 pack (from the bench models) and a speaker pack.KINDTECH_MODELS_DIR.verified-models/pack-b3a9…/with all 44 words anddiarized: false. The note read "…Speakers couldn't be labelled, so this transcript has none. (clearing partial cache …: Not a directory (os error 20))". A planted old-layout folder was removed.Both cases were run again after
/simplify, with the same results.The app was driven through Accessibility only, without keystrokes. Stop with speakers on wasn't driven, because it would record from the microphone; it shares the speaker step above.