Skip to content

Audio Module

speechline.modules.audio_module.AudioModule

Base AudioModule. Inherit this class for other audio models. An AudioModule should have an inference pipeline, and an inference function utilizing the pipeline.

Parameters:

Name Type Description Default
pipeline Pipeline

HuggingFace transformers Pipeline for inference.

required
Source code in speechline/modules/audio_module.py
class AudioModule:
    """
    Base AudioModule. Inherit this class for other audio models.
    An AudioModule should have an inference pipeline,
    and an inference function utilizing the pipeline.

    Args:
        pipeline (Pipeline):
            HuggingFace `transformers` `Pipeline` for inference.
    """

    def __init__(self, pipeline: Pipeline) -> None:
        self.pipeline = pipeline
        self.sampling_rate = self.pipeline.feature_extractor.sampling_rate