def __init__(
            self,
            model_name_or_path: str = "BELLE-2/Belle-distilwhisper-large-v2-zh",
            use_cuda: Optional[bool] = has_cuda,
            cuda_device: Optional[int] = -1,
            max_new_tokens: Optional[int] = 128,
            chunk_length_s: Optional[int] = 15,
            batch_size: Optional[int] = 16,
            torch_dtype: Optional[str] = "float16",
            use_flash_attention_2: Optional[bool] = False,
            language: Optional[str] = "zh",
            **kwargs
    ):
        """
        Initialize the speech recognition object.
        :param model_name_or_path: Model name or path, like:
            'BELLE-2/Belle-distilwhisper-large-v2-zh', 'distil-whisper/distil-large-v2', ...
            model in HuggingFace Model Hub and release from
        :param use_cuda: Whether or not to use CUDA for inference.
        :param cuda_device: Which cuda device to use for inference.
        :param max_new_tokens: The maximum number of new tokens to generate, ignoring the number of tokens in the
            prompt.
        :param chunk_length_s: The length in seconds of the audio chunks to feed to the model.
        :param batch_size: The batch size to use for inference.
        :param torch_dtype: The torch dtype to use for inference.
        :param use_flash_attention_2: Whether or not to use the FlashAttention2 module.
        :param language: The language of the model to use.
        :param kwargs: Additional keyword arguments passed along to the pipeline.
        """
        self.device_map = "auto"
        if use_cuda:
            if torch.cuda.is_available():
                if cuda_device == -1:
                    self.device = torch.device("cuda")
                else:
                    self.device = torch.device(f"cuda:{cuda_device}")
                    self.device_map = {"": int(cuda_device)}
            else:
                raise ValueError(
                    "'use_cuda' set to True when cuda is unavailable."
                    "Make sure CUDA is available or set `use_cuda=False`."
                )
        else:
            if torch.backends.mps.is_available():
                self.device = torch.device("mps")
                self.device_map = {"": "mps"}
            else:
                self.device = "cpu"
                self.device_map = {"": "cpu"}

        torch_dtype = (
            torch_dtype
            if torch_dtype in ["auto", None]
            else getattr(torch, torch_dtype)
        )
        self.model = AutoModelForSpeechSeq2Seq.from_pretrained(
            model_name_or_path,
            torch_dtype=torch_dtype,
            low_cpu_mem_usage=True,
            use_flash_attention_2=use_flash_attention_2,
        )
        self.model.to(self.device)

        self.processor = AutoProcessor.from_pretrained(model_name_or_path)
        self.pipe = pipeline(
            "automatic-speech-recognition",
            model=self.model,
            tokenizer=self.processor.tokenizer,
            feature_extractor=self.processor.feature_extractor,
            device=self.device,
            torch_dtype=torch_dtype,
            max_new_tokens=max_new_tokens,
            batch_size=batch_size,
            chunk_length_s=chunk_length_s,
            **kwargs
        )
        if language == 'zh':
            self.pipe.model.config.forced_decoder_ids = (
                self.pipe.tokenizer.get_decoder_prompt_ids(
                    language=language,
                    task="transcribe"
                )
            )
        logger.debug(f"Speech recognition model: {model_name_or_path} has been loaded.")

        Initialize the speech recognition object.
        :param model_name_or_path: Model name or path, like:
            'BELLE-2/Belle-distilwhisper-large-v2-zh', 'distil-whisper/distil-large-v2', ...
            model in HuggingFace Model Hub and release from
        :param use_cuda: Whether or not to use CUDA for inference.
        :param cuda_device: Which cuda device to use for inference.
        :param max_new_tokens: The maximum number of new tokens to generate, ignoring the number of tokens in the
            prompt.
        :param chunk_length_s: The length in seconds of the audio chunks to feed to the model.
        :param batch_size: The batch size to use for inference.
        :param torch_dtype: The torch dtype to use for inference.
        :param use_flash_attention_2: Whether or not to use the FlashAttention2 module.
        :param language: The language of the model to use.
        :param kwargs: Additional keyword arguments passed along to the pipeline.
        
parrots/asr.py