medkit.audio.transcription.sb_transcriber_function#

This module needs extra-dependencies not installed as core dependencies of medkit. To install them, use pip install medkit-lib[sb-transcriber_function].

Classes:

SBTranscriberFunction(model, needs_decoder)

Transcriber function based on a SpeechBrain model.

class SBTranscriberFunction(model, needs_decoder, add_trailing_dot=True, capitalize=True, cache_dir=None, device=- 1, batch_size=1)[source]#

Transcriber function based on a SpeechBrain model.

To be used within a DocTranscriber

Parameters
  • model (Union[str, Path]) – Name of the model on the Hugging Face models hub, or local path.

  • needs_decoder (bool) – Whether the model should be used with the speechbrain EncoderDecoderASR class or the EncoderASR class. If unsure, check the code snippets on the model card on the hub.

  • add_trailing_dot (bool) – If True, a dot will be added at the end of each transcription text.

  • capitalize (bool) – It True, the first letter of each transcription text will be uppercased and the rest lowercased.

  • cache_dir (Union[str, Path, None]) – Directory where to store the downloaded model. If None, speechbrain will use “pretrained_models/” and “model_checkpoints/” directories in the current working directory.

  • device (int) – Device to use for pytorch models. Follows the Hugging Face convention (-1 for cpu and device number for gpu, for instance 0 for “cuda:0”)

  • batch_size (int) – Number of segments in batches processed by the model.