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__		:					Any						=					logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__		:					Tuple						=					{
    "openai/whisper-base": "https://huggingface.co/openai/whisper-base/resolve/main/config.json",
}

# fmt: off
SCREAMING_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, 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__		:					int						=					[
    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       snake_case					(      UpperCamelCase_						):
  lowercase_			=     'whisper'
  lowercase_			=     ['past_key_values']
  lowercase_			=     {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}




  def __init__(      self     :	int     , a_     :	int=5_1865     , a_     :	Optional[int]=80     , a_     :	Tuple=6     , a_     :	Optional[Any]=4     , a_     :	int=6     , a_     :	int=4     , a_     :	Tuple=1536     , a_     :	Tuple=1536     , a_     :	str=0.0     , a_     :	int=0.0     , a_     :	List[Any]=5_0257     , a_     :	Any=True     , a_     :	str=True     , a_     :	Union[str, Any]="gelu"     , a_     :	Tuple=256     , a_     :	Any=0.0     , a_     :	str=0.0     , a_     :	int=0.0     , a_     :	List[str]=0.02     , a_     :	str=False     , a_     :	List[str]=1500     , a_     :	Tuple=448     , a_     :	str=5_0256     , a_     :	str=5_0256     , a_     :	Dict=5_0256     , a_     :	Optional[int]=None     , a_     :	List[Any]=[220, 5_0256]     , a_     :	List[Any]=False     , a_     :	Tuple=256     , a_     :	Tuple=False     , a_     :	str=0.05     , a_     :	int=10     , a_     :	Union[str, Any]=2     , a_     :	Optional[int]=0.0     , a_     :	Optional[Any]=10     , a_     :	int=0     , a_     :	Any=7     , **a_     :	List[Any]     , )->       Optional[int]:




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

       # Audio Classification-specific parameters. Feel free to ignore for other classes.
       __A				:				Any			=		classifier_proj_size
       __A				:				str			=		use_weighted_layer_sum

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

       __A				:				List[Any]			=		median_filter_width

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




class       snake_case					(      UpperCamelCase_						):




  @property
  def 	__lowercase(      self     :	List[str]				)->       Mapping[str, Mapping[int, str]]:




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

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

       return common_inputs




  def 	__lowercase(      self     :	int     , a_     :	Union["PreTrainedTokenizerBase", "FeatureExtractionMixin"]     , a_     :	int = -1     , a_     :	int = -1     , a_     :	bool = False     , a_     :	Optional["TensorType"] = None     , a_     :	int = 2_2050     , a_     :	float = 5.0     , a_     :	int = 220     , )->       Mapping[str, Any]:




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

       __A				:				Union[str, Any]			=		super().generate_dummy_inputs(
           preprocessor.tokenizer     , a_     , a_     , a_     , a_				)

       __A				:				Optional[Any]			=		encoder_inputs.pop('input_features'				)
       __A				:				Tuple			=		decoder_inputs.pop('decoder_input_ids'				)

       if "past_key_values" in decoder_inputs:
            __A				:				Any			=		decoder_inputs.pop('past_key_values'				)

       return dummy_inputs




  @property
  def 	__lowercase(      self     :	int				)->       float:




       """simple docstring"""
       return 1e-3




import math







def     _a				(      lowercase__  :			int ):







     '''simple docstring'''


     assert isinstance(lowercase__     ,  lowercase__ ) and (
         number >= 0
     ), "'number' must been an int and positive"

     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or not number % 2:
          # Negatives, 0, 1 and all even numbers are not primes
          return False

     SCREAMING_SNAKE_CASE__				:				Tuple			=		range(3     ,  int(math.sqrt(lowercase__ ) + 1 )     ,  2 )
     return not any(not number % i for i in odd_numbers )







def     _a				(      lowercase__  :			List[str]     ,  lowercase__  :			Any=1     ,  **lowercase__  :			Any ):







     '''simple docstring'''


     SCREAMING_SNAKE_CASE__				:				int			=		factor * value
     SCREAMING_SNAKE_CASE__				:				Dict			=		value

     while not is_prime(lowercase__ ):
          value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

     if value == first_value_val:
          return next_prime(value + 1     ,  **lowercase__ )
     return value



