Skip to main content

Module bench

Module bench 

Source
Expand description

The bench’s corpus: the audio a run scores against, taken from this machine’s own material and from the slice the binary carries.

Three sources, and what each can say is different. A saved take is this machine’s own speech with the in-use model’s words beside it - latency on real material, but its text.txt is a model’s output, not truth: the consensus tier reads how far the candidate sits from the model in use, which is a signal and not an error. The read-aloud set is the one source whose words are known, because they are a passage somebody read aloud on purpose - only a clip from it can be scored for term accuracy, and everything here keeps that distinction in the types.

The public slice is the exception to “nothing is embedded”. It is a fixed LibriSpeech test-clean slice carried in the binary and installed beside the models on first bench, so a machine that never recorded anything still has known words to score against.

Re-exports§

use std::path::Path; 🔒
use std::time::Duration; 🔒
use sha2::Digest as _; 🔒
use sha2::Sha256; 🔒
use crate::Config; 🔒
use crate::Error; 🔒
use crate::SAMPLE_RATE; 🔒
use crate::Stages; 🔒

Modules§

assets 🔒
The public bench slice that ships in the binary: LibriSpeech test-clean utterances, their transcripts, and the attribution the licence asks for.

Structs§

Clip
One clip of audio, and whatever is known about it.
ClipOutcome 🔒
One clip’s transcription as the loop needs it.
ClipRun
One clip’s outcome, as the callback sees it while a run is out.
Corpus
The audio a run scores against, and its identity.
CorpusId
What two runs are comparable by: the corpus’s own shape and bytes.
Manifest 🔒
The manifest the installed public slice carries beside its clips.
ManifestClip 🔒
One clip the public manifest names: a wav, its digest, and the words it was read from.
Metrics
What one run measured.
StageTotals
Where one run’s time went, summed over its clips.

Enums§

ClipSource
Where one clip came from.
Tier
Which clips a run scores against, in the names the page uses.

Constants§

KNOWN_TERMS 🔒
The words a mishearing shows up in, across the whole corpus. A term survives when it comes out whole and spelled right, case-insensitively - which is the figure a bench exists to move.
READ_ALOUD_PASSAGE
The passage the read-aloud set is recorded from: the one document whose words are known, so a run over it can be scored rather than compared. Read aloud once, kept like a model artifact, and re-used for every future candidate.

Functions§

corpus
Build one tier’s corpus from the machine’s own material, and the installed public slice where the tier asks for it.
corpus_id 🔒
The identity two runs are comparable by: the clip count, the seconds of audio, and a hash over every clip’s own samples, so two corpora that differ by one take cannot share an id.
decode_reader 🔒
decode_wav 🔒
Decode one 16-bit mono wav at the model’s own rate, refusing anything else by name rather than resampling it.
edits 🔒
Word-level Levenshtein distance: the edits between two word sequences.
install_public_corpus
Install the bundled public slice into models_dir’s public-corpus directory. Idempotent: a slice this binary wrote is left alone, and a manifest it did not write is replaced by the bundled one.
public_corpus
The installed public slice: every clip the manifest names, each verified against its own digest before anything scores it.
ratio
One count’s share of another, 0.0 when there is nothing to divide by.
read_aloud
The read-aloud set: the passage, and every recording of it this machine has kept - each scored against the passage as its truth.
run
Run one corpus through one config, reporting each clip as it lands.
samples_seconds 🔒
A count of samples as seconds at the model’s own rate.
score
Term accuracy and word error rate of text against truth.
store_read_aloud
Write one recording into the read-aloud set: the passage read, the take the words were recorded in, and a manifest naming the wav’s own sha256.
store_read_aloud_at 🔒
store_read_aloud for a caller that brings its own stamp, which is how two recordings in one millisecond are testable at all.
takes
Every complete take in dir, oldest first.
terms
The passage’s own terms: every word in it the vocabulary knows, whole words only, deduplicated, in the passage’s order.
walk 🔒
Walk the corpus, handing each clip’s outcome to on_clip; a Break stops the run where it stands.
wer
Word error rate of text against truth: edits over the truth’s own words, and no error when the truth has none.
words 🔒
A string’s words: lowercased, split on anything that is not a letter or a digit, blanks dropped. The one spelling both axes compare on.