src/transformers/pipelines/automatic_speech_recognition.py/AutomaticSpeechRecognitionPipeline/_forward
class AutomaticSpeechRecognitionPipeline:    def _forward(self, model_inputs):
        model_class = self.model.__class__
        if model_class in MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING.values():
            encoder = self.model.get_encoder()
            # we need to pass `processed.get("attention_mask")` here since audio encoder
            # attention mask  length is different from expected text decoder `encoder_attention_mask` length
            # `generate` magic to create the mask automatically won't work, we basically need to help
            # it here.
            tokens = self.model.generate(
                encoder_outputs=encoder(**model_inputs), attention_mask=model_inputs.get("attention_mask")
            )
            tokens = tokens.squeeze(0)
        elif model_class in MODEL_FOR_CTC_MAPPING.values():
            outputs = self.model(**model_inputs)
            tokens = outputs.logits.squeeze(0).argmax(dim=-1)
        return tokens