def __init__()

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


    def __init__(self, model_id: str):
        # IMPLEMENT_THIS
        # Preload all the elements you are going to need at inference.
        # For instance your model, processors, tokenizer that might be needed.
        # This function is only called once, so do all the heavy processing I/O here

        # Precheck for API key
        is_token_available = HfFolder.get_token() is not None

        # Prepare file name from model_id
        filename = model_id.split("/")[-1] + ".nemo"
        path = hf_hub_download(
            repo_id=model_id, filename=filename, use_auth_token=is_token_available
        )

        # Load model
        self.model = nemo_asr.models.ASRModel.restore_from(path)
        self.model.freeze()

        # Pre-Initialize RNNT decoding strategy
        if hasattr(self.model, "change_decoding_strategy"):
            self.model.change_decoding_strategy(None)

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