speechtotext.model.modelWrapper.ModelWrapper
- class ModelWrapper(model_version)[source]
Bases:
ABCAbstract Wrapper for model.
If audio needs to be converted use convert_sample in get_transcript_of_file.
Wrapper for models.
- Parameters:
model_version (WhisperModel) – Model version of whisper to use.
Methods
Benchmark n samples with model.
Benchmark sample with model.
Benchmark samples with model.
Convert sample to correct format.
Get model.
get_transcript_of_fileAttributes
path to temp file that will be created to convert the audio files to an accepted audio format.
-
PATH_OF_TEMP_CONVERTED_AUDIO_FILE:
str= 'converted_audio_file.wav' path to temp file that will be created to convert the audio files to an accepted audio format.
- Type:
PATH_OF_TEMP_CONVERTED_AUDIO_FILE
- _append_error(samples, audio_id, error)[source]
Append error to model_errors.
- Parameters:
samples (SampleDataset) – Dataset of audio.
id (str) – Id of failed sample.
error (str) – Error message.
- _benchmark_sample_with_time(dataset, audio_id, with_cleaning=True)[source]
Benchmark sample for model with timer.
- benchmark_n_samples(dataset, number_of_samples, with_cleaning=True)[source]
Benchmark n samples with model.