
from ...processing_utils import ProcessorMixin


class   __lowerCAmelCase		(		A__					):



      """simple docstring"""







      A__		:	Tuple         =			'''WhisperFeatureExtractor'''
      A__		:	Union[str, Any]         =			'''WhisperTokenizer'''




      def __init__(					self						:				Optional[int] ,				_snake_case						:				Optional[int] ,				_snake_case						:				Optional[int] ):
          super().__init__(_snake_case ,				_snake_case )
          __lowercase						:	Any					=				self.feature_extractor
          __lowercase						:	Optional[Any]					=				False




      def 						snake_case_	(					self						:				List[str] ,				_snake_case						:				str=None ,				_snake_case						:				Dict=None ,				_snake_case						:				Dict=True ):
          return self.tokenizer.get_decoder_prompt_ids(task=_snake_case ,				language=_snake_case ,				no_timestamps=_snake_case )




      def __call__(					self						:				Optional[Any] ,				*_snake_case						:				Optional[int] ,				**_snake_case						:				Any ):






          if self._in_target_context_manager:
              return self.current_processor(*_snake_case ,				**_snake_case )

          __lowercase						:	str					=				kwargs.pop('''audio''' ,				_snake_case )
          __lowercase						:	Dict					=				kwargs.pop('''sampling_rate''' ,				_snake_case )
          __lowercase						:	Optional[Any]					=				kwargs.pop('''text''' ,				_snake_case )
          if len(_snake_case ) > 0:
              __lowercase						:	Optional[Any]					=				args[0]
              __lowercase						:	Tuple					=				args[1:]

          if audio is None and text is None:
              raise ValueError('''You need to specify either an `audio` or `text` input to process.''' )

          if audio is not None:
              __lowercase						:	int					=				self.feature_extractor(_snake_case ,				*_snake_case ,				sampling_rate=_snake_case ,				**_snake_case )
          if text is not None:
              __lowercase						:	Tuple					=				self.tokenizer(_snake_case ,				**_snake_case )

          if text is None:
              return inputs

          elif audio is None:
              return encodings
          else:
              __lowercase						:	str					=				encodings["input_ids"]
              return inputs




      def 						snake_case_	(					self						:				Any ,				*_snake_case						:				Optional[Any] ,				**_snake_case						:				List[str] ):
          return self.tokenizer.batch_decode(*_snake_case ,				**_snake_case )




      def 						snake_case_	(					self						:				List[str] ,				*_snake_case						:				Tuple ,				**_snake_case						:				Optional[Any] ):
          return self.tokenizer.decode(*_snake_case ,				**_snake_case )




      def 						snake_case_	(					self						:				Dict ,				_snake_case						:				str ,				_snake_case						:				str="np" ):
          return self.tokenizer.get_prompt_ids(_snake_case ,				return_tensors=_snake_case )










from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase	:							Optional[int]				=logging.get_logger(__name__)

lowerCamelCase	:							Dict				={
    '''facebook/s2t-wav2vec2-large-en-de''': (
        '''https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json'''
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}





class 			__a  (    A__       ):
 _lowerCAmelCase       :       Tuple        = '''speech_to_text_2'''
 _lowerCAmelCase       :       Dict        = ['''past_key_values''']
 _lowerCAmelCase       :       Any        = {'''num_attention_heads''': '''decoder_attention_heads''', '''hidden_size''': '''d_model'''}







 def __init__(		self					:   List[str]							,   SCREAMING_SNAKE_CASE					:   Union[str, Any]=1_00_00							,   SCREAMING_SNAKE_CASE					:   List[Any]=6							,   SCREAMING_SNAKE_CASE					:   List[Any]=20_48							,   SCREAMING_SNAKE_CASE					:   Dict=4							,   SCREAMING_SNAKE_CASE					:   List[Any]=0.0							,   SCREAMING_SNAKE_CASE					:   Optional[int]=True							,   SCREAMING_SNAKE_CASE					:   List[Any]="relu"							,   SCREAMING_SNAKE_CASE					:   Tuple=2_56							,   SCREAMING_SNAKE_CASE					:   List[str]=0.1							,   SCREAMING_SNAKE_CASE					:   Tuple=0.0							,   SCREAMING_SNAKE_CASE					:   Any=0.0							,   SCREAMING_SNAKE_CASE					:   int=0.0_2							,   SCREAMING_SNAKE_CASE					:   Dict=2							,   SCREAMING_SNAKE_CASE					:   List[str]=True							,   SCREAMING_SNAKE_CASE					:   Any=1							,   SCREAMING_SNAKE_CASE					:   List[Any]=0							,   SCREAMING_SNAKE_CASE					:   Any=2							,   SCREAMING_SNAKE_CASE					:   str=10_24							,   **SCREAMING_SNAKE_CASE					:   int							,   ):


      '''simple docstring'''






      UpperCamelCase__			:   int       				=  vocab_size
      UpperCamelCase__			:   Optional[Any]       				=  d_model
      UpperCamelCase__			:   Optional[Any]       				=  decoder_ffn_dim
      UpperCamelCase__			:   str       				=  decoder_layers
      UpperCamelCase__			:   Any       				=  decoder_attention_heads
      UpperCamelCase__			:   List[str]       				=  dropout
      UpperCamelCase__			:   int       				=  attention_dropout
      UpperCamelCase__			:   Optional[int]       				=  activation_dropout
      UpperCamelCase__			:   Union[str, Any]       				=  activation_function
      UpperCamelCase__			:   Tuple       				=  init_std
      UpperCamelCase__			:   Optional[int]       				=  decoder_layerdrop
      UpperCamelCase__			:   Dict       				=  use_cache
      UpperCamelCase__			:   str       				=  decoder_layers
      UpperCamelCase__			:   Union[str, Any]       				=  scale_embedding  # scale factor will be sqrt(d_model) if True
      UpperCamelCase__			:   Optional[Any]       				=  max_target_positions

      super().__init__(
          pad_token_id=SCREAMING_SNAKE_CASE							,   bos_token_id=SCREAMING_SNAKE_CASE							,   eos_token_id=SCREAMING_SNAKE_CASE							,   decoder_start_token_id=SCREAMING_SNAKE_CASE							,   **SCREAMING_SNAKE_CASE							,   )