



'''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

__SCREAMING_SNAKE_CASE			:   Optional[Any]							   =logging.get_logger(__name__)

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

# fmt: off
__SCREAMING_SNAKE_CASE			:   List[Any]							   =[
    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, 1_0563, 1_0786,
    1_1420, 1_1709, 1_1907, 1_3163, 1_3697, 1_3700, 1_4808, 1_5306, 1_6410, 1_6791,
    1_7992, 1_9203, 1_9510, 2_0724, 2_2305, 2_2935, 2_7007, 3_0109, 3_0420, 3_3409,
    3_4949, 4_0283, 4_0493, 4_0549, 4_7282, 4_9146, 5_0257, 5_0359, 5_0360, 5_0361
]
__SCREAMING_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, 1_0428, 1_0929, 1_1938, 1_2033, 1_2331, 1_2562, 1_3793,
    1_4157, 1_4635, 1_5265, 1_5618, 1_6553, 1_6604, 1_8362, 1_8956, 2_0075, 2_1675,
    2_2520, 2_6130, 2_6161, 2_6435, 2_8279, 2_9464, 3_1650, 3_2302, 3_2470, 3_6865,
    4_2863, 4_7425, 4_9870, 5_0254, 5_0258, 5_0360, 5_0361, 5_0362
]


class 	SCREAMING_SNAKE_CASE__					( _lowercase       ):
	"""simple docstring"""


	A__     :     Optional[int]    =					'''whisper'''
	A__     :     Optional[int]    =					['''past_key_values''']
	A__     :     Tuple    =					{'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}


	def __init__(		self       , A=5_18_65       , A=80       , A=6       , A=4       , A=6       , A=4       , A=15_36       , A=15_36       , A=0.0       , A=0.0       , A=5_02_57       , A=True       , A=True       , A="gelu"       , A=2_56       , A=0.0       , A=0.0       , A=0.0       , A=0.02       , A=False       , A=15_00       , A=4_48       , A=5_02_56       , A=5_02_56       , A=5_02_56       , A=None       , A=[2_20, 5_02_56]       , A=False       , A=2_56       , A=False       , A=0.05       , A=10       , A=2       , A=0.0       , A=10       , A=0       , A=7       , **A       , )			->				Optional[Any]:
				A:   Tuple								= vocab_size
				A:   Union[str, Any]								= num_mel_bins
				A:   Any								= d_model
				A:   List[Any]								= encoder_layers
				A:   Tuple								= encoder_attention_heads
				A:   Any								= decoder_layers
				A:   Any								= decoder_attention_heads
				A:   str								= decoder_ffn_dim
				A:   str								= encoder_ffn_dim
				A:   str								= dropout
				A:   List[str]								= attention_dropout
				A:   Union[str, Any]								= activation_dropout
				A:   Optional[int]								= activation_function
				A:   Optional[Any]								= init_std
				A:   List[Any]								= encoder_layerdrop
				A:   Union[str, Any]								= decoder_layerdrop
				A:   Optional[int]								= use_cache
				A:   List[Any]								= encoder_layers
				A:   Optional[Any]								= scale_embedding  # scale factor will be sqrt(d_model) if True
				A:   List[str]								= max_source_positions
				A:   Any								= max_target_positions

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

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

				A:   List[str]								= median_filter_width

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







class 	SCREAMING_SNAKE_CASE__					( _lowercase       ):
	"""simple docstring"""


	@property
	def   a__			(		self      )			->				Mapping[str, Mapping[int, str]]:
				A:   Union[str, Any]								= OrderedDict(
				    [
				        ("""input_features""", {0: """batch""", 1: """feature_size""", 2: """encoder_sequence"""}),
				    ]      )
				if self.use_past:
							A:   Any								= {0: """batch"""}
				else:
							A:   List[Any]								= {0: """batch""", 1: """decoder_sequence"""}

				if self.use_past:
							self.fill_with_past_key_values_(_snake_case       , direction="""inputs"""      )

				return common_inputs


	def   a__			(		self       , A       , A = -1       , A = -1       , A = False       , A = None       , A = 2_20_50       , A = 5.0       , A = 2_20       , )			->				Mapping[str, Any]:
				A:   List[Any]								= OrderedDict()
				A:   Dict								= OnnxConfig.generate_dummy_inputs(
				    self       , preprocessor=preprocessor.feature_extractor       , batch_size=_snake_case       , framework=_snake_case       , sampling_rate=_snake_case       , time_duration=_snake_case       , frequency=_snake_case       , )
				A:   Tuple								= encoder_inputs["""input_features"""].shape[2]
				A:   List[Any]								= encoder_sequence_length // 2 if self.use_past else seq_length

				A:   List[Any]								= super().generate_dummy_inputs(
				    preprocessor.tokenizer       , _snake_case       , _snake_case       , _snake_case       , _snake_case      )

				A:   int								= encoder_inputs.pop("""input_features"""      )
				A:   Optional[Any]								= decoder_inputs.pop("""decoder_input_ids"""      )

				if "past_key_values" in decoder_inputs:
							A:   str								= decoder_inputs.pop("""past_key_values"""      )

				return dummy_inputs





	@property
	def   a__			(		self      )			->				float:
				return 1e-3







"""simple docstring"""





from ..utils import is_flax_available, is_torch_available


if is_torch_available():
		from .autoencoder_kl import AutoencoderKL
		from .controlnet import ControlNetModel
		from .dual_transformer_ad import DualTransformeraDModel
		from .modeling_utils import ModelMixin
		from .prior_transformer import PriorTransformer
		from .ta_film_transformer import TaFilmDecoder
		from .transformer_ad import TransformeraDModel
		from .unet_ad import UNetaDModel
		from .unet_ad import UNetaDModel
		from .unet_ad_condition import UNetaDConditionModel
		from .unet_ad_condition import UNetaDConditionModel
		from .vq_model import VQModel

if is_flax_available():
		from .controlnet_flax import FlaxControlNetModel
		from .unet_ad_condition_flax import FlaxUNetaDConditionModel
		from .vae_flax import FlaxAutoencoderKL




