




from ...processing_utils import ProcessorMixin







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						"WhisperFeatureExtractor"
     _a							 =						"WhisperTokenizer"

     def __init__(  self		,     _a		,     _a				)						->							str:
           super().__init__(_a		,     _a				)
           _A							:     Dict			=						self.feature_extractor
           _A							:     List[Any]			=						False

     def 					a__	(  self		,     _a=None		,     _a=None		,     _a=True				)						->							List[str]:
           return self.tokenizer.get_decoder_prompt_ids(task=_a		,     language=_a		,     no_timestamps=_a				)

     def __call__(  self		,     *_a		,     **_a				)						->							List[str]:
           # For backward compatibility
           if self._in_target_context_manager:
                 return self.current_processor(*_a		,     **_a				)

           _A							:     Union[str, Any]			=						kwargs.pop("""audio"""		,     _a				)
           _A							:     Tuple			=						kwargs.pop("""sampling_rate"""		,     _a				)
           _A							:     int			=						kwargs.pop("""text"""		,     _a				)
           if len(_a				) > 0:
                 _A							:     Dict			=						args[0]
                 _A							:     int			=						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:
                 _A							:     Optional[int]			=						self.feature_extractor(_a		,     *_a		,     sampling_rate=_a		,     **_a				)
           if text is not None:
                 _A							:     int			=						self.tokenizer(_a		,     **_a				)

           if text is None:
                 return inputs

           elif audio is None:
                 return encodings
           else:
                 _A							:     List[Any]			=						encodings["""input_ids"""]
                 return inputs

     def 					a__	(  self		,     *_a		,     **_a				)						->							Any:
           return self.tokenizer.batch_decode(*_a		,     **_a				)

     def 					a__	(  self		,     *_a		,     **_a				)						->							int:
           return self.tokenizer.decode(*_a		,     **_a				)



     def 					a__	(  self		,     _a		,     _a="np"				)						->							Optional[int]:
           return self.tokenizer.get_prompt_ids(_a		,     return_tensors=_a				)







from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


_snake_case										=       logging.get_logger(__name__)

_snake_case										=       {
    "facebook/xmod-base": "https://huggingface.co/facebook/xmod-base/resolve/main/config.json",
    "facebook/xmod-large-prenorm": "https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json",
    "facebook/xmod-base-13-125k": "https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json",
    "facebook/xmod-base-30-125k": "https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json",
    "facebook/xmod-base-30-195k": "https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json",
    "facebook/xmod-base-60-125k": "https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json",
    "facebook/xmod-base-60-265k": "https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json",
    "facebook/xmod-base-75-125k": "https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json",
    "facebook/xmod-base-75-269k": "https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json",
}







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						"xmod"

     def __init__(  self		,     _a=3_0522		,     _a=768		,     _a=12		,     _a=12		,     _a=3072		,     _a="gelu"		,     _a=0.1		,     _a=0.1		,     _a=512		,     _a=2		,     _a=0.02		,     _a=1e-12		,     _a=1		,     _a=0		,     _a=2		,     _a="absolute"		,     _a=True		,     _a=None		,     _a=False		,     _a=2		,     _a=False		,     _a=True		,     _a=True		,     _a=("en_XX",)		,     _a=None		,     **_a		,     )						->							str:
           super().__init__(pad_token_id=_a		,     bos_token_id=_a		,     eos_token_id=_a		,     **_a				)

           _A							:     Tuple			=						vocab_size
           _A							:     Union[str, Any]			=						hidden_size
           _A							:     Dict			=						num_hidden_layers
           _A							:     Dict			=						num_attention_heads
           _A							:     List[Any]			=						hidden_act
           _A							:     Optional[Any]			=						intermediate_size
           _A							:     Any			=						hidden_dropout_prob
           _A							:     str			=						attention_probs_dropout_prob
           _A							:     Dict			=						max_position_embeddings
           _A							:     Any			=						type_vocab_size
           _A							:     List[Any]			=						initializer_range
           _A							:     int			=						layer_norm_eps
           _A							:     int			=						position_embedding_type
           _A							:     Any			=						use_cache
           _A							:     int			=						classifier_dropout
           _A							:     int			=						pre_norm
           _A							:     Optional[Any]			=						adapter_reduction_factor
           _A							:     List[Any]			=						adapter_layer_norm
           _A							:     Optional[int]			=						adapter_reuse_layer_norm
           _A							:     Any			=						ln_before_adapter
           _A							:     Union[str, Any]			=						list(_a				)
           _A							:     List[Any]			=						default_language







class 						lowercase							(   UpperCamelCase__		):

     @property
     def 					a__	(  self				)						->							Mapping[str, Mapping[int, str]]:
           if self.task == "multiple-choice":
                 _A							:     Dict			=						{0: """batch""", 1: """choice""", 2: """sequence"""}
           else:
                 _A							:     Dict			=						{0: """batch""", 1: """sequence"""}
           return OrderedDict(
               [
                   ("""input_ids""", dynamic_axis),
                   ("""attention_mask""", dynamic_axis),
               ]				)

