def __init__()

in docker_images/speechbrain/app/pipelines/automatic_speech_recognition.py [0:0]


    def __init__(self, model_id: str):
        model_type = get_type(model_id)
        if model_type is ModelType.ENCODERASR:
            self.model = EncoderASR.from_hparams(source=model_id)
        elif model_type is ModelType.ENCODERDECODERASR:
            self.model = EncoderDecoderASR.from_hparams(source=model_id)
            # Reduce latency
            self.model.mods.decoder.beam_size = 1
        elif model_type is ModelType.WHISPERASR:
            self.model = WhisperASR.from_hparams(source=model_id)
        else:
            raise ValueError(
                f"{model_type.value} is invalid for automatic-speech-recognition"
            )

        # Please define a `self.sampling_rate` for this pipeline
        # to automatically read the input correctly
        self.sampling_rate = self.model.hparams.sample_rate