



'''simple docstring'''
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

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


if TYPE_CHECKING:
					from ...feature_extraction_utils import FeatureExtractionMixin
					from ...tokenization_utils_base import PreTrainedTokenizerBase
					from ...utils import TensorType

snake_case_			:     Dict  	=  logging.get_logger(__name__)

snake_case_			:     List[Any]  	=  {
    'openai/whisper-base': 'https://huggingface.co/openai/whisper-base/resolve/main/config.json',
}

# fmt: off
snake_case_			:     Optional[int]  	=  [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 357, 366, 438, 532, 685,
    705, 796, 930, 1058, 1220, 1267, 1279, 1303, 1343, 1377,
    1391, 1635, 1782, 1875, 2162, 2361, 2488, 3467, 4008, 4211,
    4600, 4808, 5299, 5855, 6329, 7203, 9609, 9959, 10563, 10786,
    11420, 11709, 11907, 13163, 13697, 13700, 14808, 15306, 16410, 16791,
    17992, 19203, 19510, 20724, 22305, 22935, 27007, 30109, 30420, 33409,
    34949, 40283, 40493, 40549, 47282, 49146, 50257, 50359, 50360, 50361
]
snake_case_			:     Optional[Any]  	=  [
    1, 2, 7, 8, 9, 10, 14, 25,
    26, 27, 28, 29, 31, 58, 59, 60, 61, 62,
    63, 90, 91, 92, 93, 359, 503, 522, 542, 873,
    893, 902, 918, 922, 931, 1350, 1853, 1982, 2460, 2627,
    3246, 3253, 3268, 3536, 3846, 3961, 4183, 4667, 6585, 6647,
    7273, 9061, 9383, 10428, 10929, 11938, 12033, 12331, 12562, 13793,
    14157, 14635, 15265, 15618, 16553, 16604, 18362, 18956, 20075, 21675,
    22520, 26130, 26161, 26435, 28279, 29464, 31650, 32302, 32470, 36865,
    42863, 47425, 49870, 50254, 50258, 50360, 50361, 50362
]






class 							lowercase__     (							lowercase       ):
	lowercase__      =      """whisper"""
	lowercase__      =      ["""past_key_values"""]
	lowercase__      =      {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}





	def __init__(			self :    Tuple			,lowerCamelCase__ :    str=51865			,lowerCamelCase__ :    Union[str, Any]=80			,lowerCamelCase__ :    Any=6			,lowerCamelCase__ :    Tuple=4			,lowerCamelCase__ :    List[Any]=6			,lowerCamelCase__ :    List[Any]=4			,lowerCamelCase__ :    Tuple=1536			,lowerCamelCase__ :    Any=1536			,lowerCamelCase__ :    Optional[int]=0.0			,lowerCamelCase__ :    List[str]=0.0			,lowerCamelCase__ :    str=50257			,lowerCamelCase__ :    Union[str, Any]=True			,lowerCamelCase__ :    int=True			,lowerCamelCase__ :    Any="gelu"			,lowerCamelCase__ :    Union[str, Any]=256			,lowerCamelCase__ :    Any=0.0			,lowerCamelCase__ :    Optional[int]=0.0			,lowerCamelCase__ :    Any=0.0			,lowerCamelCase__ :    Dict=0.0_2			,lowerCamelCase__ :    List[str]=False			,lowerCamelCase__ :    Tuple=1500			,lowerCamelCase__ :    Tuple=448			,lowerCamelCase__ :    str=50256			,lowerCamelCase__ :    Union[str, Any]=50256			,lowerCamelCase__ :    List[str]=50256			,lowerCamelCase__ :    Dict=None			,lowerCamelCase__ :    Any=[220, 50256]			,lowerCamelCase__ :    Union[str, Any]=False			,lowerCamelCase__ :    Optional[int]=256			,lowerCamelCase__ :    Tuple=False			,lowerCamelCase__ :    Dict=0.0_5			,lowerCamelCase__ :    int=10			,lowerCamelCase__ :    Any=2			,lowerCamelCase__ :    Dict=0.0			,lowerCamelCase__ :    Tuple=10			,lowerCamelCase__ :    int=0			,lowerCamelCase__ :    Any=7			,**lowerCamelCase__ :    Any			,):







							'''simple docstring'''
							_UpperCamelCase :		int			    =       vocab_size
							_UpperCamelCase :		Union[str, Any]			    =       num_mel_bins
							_UpperCamelCase :		Optional[int]			    =       d_model
							_UpperCamelCase :		Dict			    =       encoder_layers
							_UpperCamelCase :		Optional[int]			    =       encoder_attention_heads
							_UpperCamelCase :		Dict			    =       decoder_layers
							_UpperCamelCase :		Optional[int]			    =       decoder_attention_heads
							_UpperCamelCase :		Dict			    =       decoder_ffn_dim
							_UpperCamelCase :		Union[str, Any]			    =       encoder_ffn_dim
							_UpperCamelCase :		Union[str, Any]			    =       dropout
							_UpperCamelCase :		List[str]			    =       attention_dropout
							_UpperCamelCase :		int			    =       activation_dropout
							_UpperCamelCase :		List[Any]			    =       activation_function
							_UpperCamelCase :		Optional[int]			    =       init_std
							_UpperCamelCase :		Optional[Any]			    =       encoder_layerdrop
							_UpperCamelCase :		List[str]			    =       decoder_layerdrop
							_UpperCamelCase :		Any			    =       use_cache
							_UpperCamelCase :		Union[str, Any]			    =       encoder_layers
							_UpperCamelCase :		Tuple			    =       scale_embedding  # scale factor will be sqrt(d_model) if True
							_UpperCamelCase :		int			    =       max_source_positions
							_UpperCamelCase :		Dict			    =       max_target_positions

							# Audio Classification-specific parameters. Feel free to ignore for other classes.
							_UpperCamelCase :		Union[str, Any]			    =       classifier_proj_size
							_UpperCamelCase :		List[Any]			    =       use_weighted_layer_sum

							# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
							_UpperCamelCase :		Tuple			    =       apply_spec_augment
							_UpperCamelCase :		Optional[Any]			    =       mask_time_prob
							_UpperCamelCase :		str			    =       mask_time_length
							_UpperCamelCase :		List[str]			    =       mask_time_min_masks
							_UpperCamelCase :		Dict			    =       mask_feature_prob
							_UpperCamelCase :		Optional[Any]			    =       mask_feature_length
							_UpperCamelCase :		List[Any]			    =       mask_feature_min_masks

							_UpperCamelCase :		Dict			    =       median_filter_width

							super().__init__(
							    pad_token_id=lowerCamelCase__			,bos_token_id=lowerCamelCase__			,eos_token_id=lowerCamelCase__			,is_encoder_decoder=lowerCamelCase__			,decoder_start_token_id=lowerCamelCase__			,suppress_tokens=lowerCamelCase__			,begin_suppress_tokens=lowerCamelCase__			,**lowerCamelCase__			,)






class 							lowercase__     (							lowercase       ):





	@property
	def      UpperCamelCase_  (			self :    str			):







							'''simple docstring'''
							_UpperCamelCase :		List[Any]			    =       OrderedDict(
							    [
							        ('input_features', {0: 'batch', 1: 'feature_size', 2: 'encoder_sequence'}),
							    ]			)
							if self.use_past:
													_UpperCamelCase :		Optional[Any]			    =       {0: 'batch'}
							else:
													_UpperCamelCase :		Optional[int]			    =       {0: 'batch', 1: 'decoder_sequence'}

							if self.use_past:
													self.fill_with_past_key_values_(lowerCamelCase__			,direction='inputs'			)

							return common_inputs





	def      UpperCamelCase_  (			self :    Union[str, Any]			,lowerCamelCase__ :    Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]			,lowerCamelCase__ :    int = -1			,lowerCamelCase__ :    int = -1			,lowerCamelCase__ :    bool = False			,lowerCamelCase__ :    Optional["TensorType"] = None			,lowerCamelCase__ :    int = 22050			,lowerCamelCase__ :    float = 5.0			,lowerCamelCase__ :    int = 220			,):







							'''simple docstring'''
							_UpperCamelCase :		List[Any]			    =       OrderedDict()
							_UpperCamelCase :		List[Any]			    =       OnnxConfig.generate_dummy_inputs(
							    self			,preprocessor=preprocessor.feature_extractor			,batch_size=lowerCamelCase__			,framework=lowerCamelCase__			,sampling_rate=lowerCamelCase__			,time_duration=lowerCamelCase__			,frequency=lowerCamelCase__			,)
							_UpperCamelCase :		List[str]			    =       encoder_inputs['input_features'].shape[2]
							_UpperCamelCase :		Any			    =       encoder_sequence_length // 2 if self.use_past else seq_length

							_UpperCamelCase :		List[str]			    =       super().generate_dummy_inputs(
							    preprocessor.tokenizer			,lowerCamelCase__			,lowerCamelCase__			,lowerCamelCase__			,lowerCamelCase__			)

							_UpperCamelCase :		Dict			    =       encoder_inputs.pop('input_features'			)
							_UpperCamelCase :		Tuple			    =       decoder_inputs.pop('decoder_input_ids'			)

							if "past_key_values" in decoder_inputs:
													_UpperCamelCase :		Union[str, Any]			    =       decoder_inputs.pop('past_key_values'			)

							return dummy_inputs





	@property
	def      UpperCamelCase_  (			self :    List[str]			):







							'''simple docstring'''
							return 1E-3







'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


snake_case_			:     Optional[Any]  	=  {
    'configuration_clip': [
        'CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'CLIPConfig',
        'CLIPOnnxConfig',
        'CLIPTextConfig',
        'CLIPVisionConfig',
    ],
    'processing_clip': ['CLIPProcessor'],
    'tokenization_clip': ['CLIPTokenizer'],
}

try:
					if not is_tokenizers_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  ['CLIPTokenizerFast']

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  ['CLIPFeatureExtractor']
					snake_case_			:     Dict  	=  ['CLIPImageProcessor']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Tuple  	=  [
					    'CLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'CLIPModel',
					    'CLIPPreTrainedModel',
					    'CLIPTextModel',
					    'CLIPTextModelWithProjection',
					    'CLIPVisionModel',
					    'CLIPVisionModelWithProjection',
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     List[Any]  	=  [
					    'TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'TFCLIPModel',
					    'TFCLIPPreTrainedModel',
					    'TFCLIPTextModel',
					    'TFCLIPVisionModel',
					]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					snake_case_			:     Optional[int]  	=  [
					    'FlaxCLIPModel',
					    'FlaxCLIPPreTrainedModel',
					    'FlaxCLIPTextModel',
					    'FlaxCLIPTextPreTrainedModel',
					    'FlaxCLIPVisionModel',
					    'FlaxCLIPVisionPreTrainedModel',
					]


if TYPE_CHECKING:
					from .configuration_clip import (
					    CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    CLIPConfig,
					    CLIPOnnxConfig,
					    CLIPTextConfig,
					    CLIPVisionConfig,
					)
					from .processing_clip import CLIPProcessor
					from .tokenization_clip import CLIPTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_clip_fast import CLIPTokenizerFast

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .feature_extraction_clip import CLIPFeatureExtractor
										from .image_processing_clip import CLIPImageProcessor

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_clip import (
										    CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
										    CLIPModel,
										    CLIPPreTrainedModel,
										    CLIPTextModel,
										    CLIPTextModelWithProjection,
										    CLIPVisionModel,
										    CLIPVisionModelWithProjection,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_clip import (
										    TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFCLIPModel,
										    TFCLIPPreTrainedModel,
										    TFCLIPTextModel,
										    TFCLIPVisionModel,
										)

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_flax_clip import (
										    FlaxCLIPModel,
										    FlaxCLIPPreTrainedModel,
										    FlaxCLIPTextModel,
										    FlaxCLIPTextPreTrainedModel,
										    FlaxCLIPVisionModel,
										    FlaxCLIPVisionPreTrainedModel,
										)


else:
					import sys

					snake_case_			:     str  	=  _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


