

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

a__												=						logging.get_logger(__name__)

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

# fmt: off
a__												=						[
    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
]
a__												=						[
    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 							UpperCAmelCase_						(     _UpperCamelCase  ):
							"""simple docstring"""







							UpperCAmelCase__			:		Any             =       """whisper"""
							UpperCAmelCase__			:		Union[str, Any]             =       ["""past_key_values"""]
							UpperCAmelCase__			:		Union[str, Any]             =       {"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}


							def __init__(     self			,				_a=5_1_8_6_5			,				_a=8_0			,				_a=6			,				_a=4			,				_a=6			,				_a=4			,				_a=1_5_3_6			,				_a=1_5_3_6			,				_a=0.0			,				_a=0.0			,				_a=5_0_2_5_7			,				_a=True			,				_a=True			,				_a="gelu"			,				_a=2_5_6			,				_a=0.0			,				_a=0.0			,				_a=0.0			,				_a=0.02			,				_a=False			,				_a=1_5_0_0			,				_a=4_4_8			,				_a=5_0_2_5_6			,				_a=5_0_2_5_6			,				_a=5_0_2_5_6			,				_a=None			,				_a=[2_2_0, 5_0_2_5_6]			,				_a=False			,				_a=2_5_6			,				_a=False			,				_a=0.05			,				_a=1_0			,				_a=2			,				_a=0.0			,				_a=1_0			,				_a=0			,				_a=7			,				**_a			,				)       ->       Dict:
												_a      :       Optional[Any]   =						vocab_size
												_a      :       int   =						num_mel_bins
												_a      :       Dict   =						d_model
												_a      :       List[Any]   =						encoder_layers
												_a      :       List[Any]   =						encoder_attention_heads
												_a      :       Optional[int]   =						decoder_layers
												_a      :       int   =						decoder_attention_heads
												_a      :       Optional[Any]   =						decoder_ffn_dim
												_a      :       List[Any]   =						encoder_ffn_dim
												_a      :       int   =						dropout
												_a      :       Optional[int]   =						attention_dropout
												_a      :       Tuple   =						activation_dropout
												_a      :       Optional[Any]   =						activation_function
												_a      :       List[Any]   =						init_std
												_a      :       List[Any]   =						encoder_layerdrop
												_a      :       Dict   =						decoder_layerdrop
												_a      :       List[Any]   =						use_cache
												_a      :       Union[str, Any]   =						encoder_layers
												_a      :       Union[str, Any]   =						scale_embedding  # scale factor will be sqrt(d_model) if True
												_a      :       Tuple   =						max_source_positions
												_a      :       Optional[Any]   =						max_target_positions

												# Audio Classification-specific parameters. Feel free to ignore for other classes.
												_a      :       Optional[Any]   =						classifier_proj_size
												_a      :       int   =						use_weighted_layer_sum

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

												_a      :       List[str]   =						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 							UpperCAmelCase_						(     _UpperCamelCase  ):
							"""simple docstring"""







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

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

												return common_inputs


							def 							__lowercase							(     self			,				_a			,				_a = -1			,				_a = -1			,				_a = False			,				_a = None			,				_a = 2_2_0_5_0			,				_a = 5.0			,				_a = 2_2_0			,				)       ->       Mapping[str, Any]:
												_a      :       int   =						OrderedDict()
												_a      :       List[str]   =						OnnxConfig.generate_dummy_inputs(
												    self			,				preprocessor=preprocessor.feature_extractor			,				batch_size=_a			,				framework=_a			,				sampling_rate=_a			,				time_duration=_a			,				frequency=_a			,				)
												_a      :       Optional[int]   =						encoder_inputs["input_features"].shape[2]
												_a      :       str   =						encoder_sequence_length // 2 if self.use_past else seq_length

												_a      :       Optional[int]   =						super().generate_dummy_inputs(
												    preprocessor.tokenizer			,				_a			,				_a			,				_a			,				_a			)

												_a      :       Any   =						encoder_inputs.pop('''input_features'''			)
												_a      :       Dict   =						decoder_inputs.pop('''decoder_input_ids'''			)

												if "past_key_values" in decoder_inputs:
																	_a      :       Tuple   =						decoder_inputs.pop('''past_key_values'''			)

												return dummy_inputs




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










import os
import string
import sys


SCREAMING_SNAKE_CASE__							:      int         =    1 << 8

SCREAMING_SNAKE_CASE__							:      List[str]         =    {
    """tab""": ord("""\t"""),
    """newline""": ord("""\r"""),
    """esc""": 2_7,
    """up""": 6_5 + ARROW_KEY_FLAG,
    """down""": 6_6 + ARROW_KEY_FLAG,
    """right""": 6_7 + ARROW_KEY_FLAG,
    """left""": 6_8 + ARROW_KEY_FLAG,
    """mod_int""": 9_1,
    """undefined""": sys.maxsize,
    """interrupt""": 3,
    """insert""": 5_0,
    """delete""": 5_1,
    """pg_up""": 5_3,
    """pg_down""": 5_4,
}

SCREAMING_SNAKE_CASE__							:      Any         =    KEYMAP["""up"""]
SCREAMING_SNAKE_CASE__							:      Tuple         =    KEYMAP["""left"""]

if sys.platform == "win32":
  SCREAMING_SNAKE_CASE__							:      Optional[Any]         =    []
  SCREAMING_SNAKE_CASE__							:      Dict         =    {
      B"""\xe0H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
      B"""\x00H""": KEYMAP["""up"""] - ARROW_KEY_FLAG,
      B"""\xe0P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
      B"""\x00P""": KEYMAP["""down"""] - ARROW_KEY_FLAG,
      B"""\xe0M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
      B"""\x00M""": KEYMAP["""right"""] - ARROW_KEY_FLAG,
      B"""\xe0K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
      B"""\x00K""": KEYMAP["""left"""] - ARROW_KEY_FLAG,
  }

for i in range(1_0):
  SCREAMING_SNAKE_CASE__							:      Dict         =    ord(str(i))






def    _A	(   ):
   if os.name == "nt":
      import msvcrt

      a__						:    int   		=	"mbcs"
      # Flush the keyboard buffer
      while msvcrt.kbhit():
         msvcrt.getch()
      if len(lowerCamelCase ) == 0:
         # Read the keystroke
         a__						:    int   		=	msvcrt.getch()

         # If it is a prefix char, get second part
         if ch in (b"\x00", b"\xe0"):
            a__						:    Union[str, Any]   		=	ch + msvcrt.getch()
            # Translate actual Win chars to bullet char types
            try:
               a__						:    Optional[int]   		=	chr(WIN_KEYMAP[cha] )
               WIN_CH_BUFFER.append(chr(KEYMAP["mod_int"] ) )
               WIN_CH_BUFFER.append(lowerCamelCase )
               if ord(lowerCamelCase ) in (
                   KEYMAP["insert"] - 1 << 9,
                   KEYMAP["delete"] - 1 << 9,
                   KEYMAP["pg_up"] - 1 << 9,
                   KEYMAP["pg_down"] - 1 << 9,
               ):
                  WIN_CH_BUFFER.append(chr(126 ) )
               a__						:    int   		=	chr(KEYMAP["esc"] )
            except KeyError:
               a__						:    Dict   		=	cha[1]
         else:
            a__						:    Union[str, Any]   		=	ch.decode(lowerCamelCase )
      else:
         a__						:    Optional[int]   		=	WIN_CH_BUFFER.pop(0 )
   elif os.name == "posix":
      import termios
      import tty

      a__						:    Tuple   		=	sys.stdin.fileno()
      a__						:    int   		=	termios.tcgetattr(lowerCamelCase )
      try:
         tty.setraw(lowerCamelCase )
         a__						:    Tuple   		=	sys.stdin.read(1 )
      finally:
         termios.tcsetattr(lowerCamelCase				,			termios.TCSADRAIN				,			lowerCamelCase )
   return ch






def    _A	(   ):
   a__						:    str   		=	get_raw_chars()
   if ord(lowerCamelCase ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
      return char

   elif ord(lowerCamelCase ) == KEYMAP["esc"]:
      a__						:    Tuple   		=	get_raw_chars()
      if ord(lowerCamelCase ) == KEYMAP["mod_int"]:
         a__						:    List[Any]   		=	get_raw_chars()
         if ord(lowerCamelCase ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(lowerCamelCase ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
            return chr(ord(lowerCamelCase ) + ARROW_KEY_FLAG )
         else:
            return KEYMAP["undefined"]
      else:
         return get_raw_chars()

   else:
      if char in string.printable:
         return char
      else:
         return KEYMAP["undefined"]

