






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 __lowerCamelCase (      _UpperCamelCase):





	"""simple docstring"""






	UpperCamelCase__								=      'whisper'
	UpperCamelCase__								=      ['past_key_values']
	UpperCamelCase__								=      {'num_attention_heads': 'encoder_attention_heads', 'hidden_size': 'd_model'}

	def __init__(							self       ,    UpperCAmelCase=5_1865       ,    UpperCAmelCase=80       ,    UpperCAmelCase=6       ,    UpperCAmelCase=4       ,    UpperCAmelCase=6       ,    UpperCAmelCase=4       ,    UpperCAmelCase=1536       ,    UpperCAmelCase=1536       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=5_0257       ,    UpperCAmelCase=True       ,    UpperCAmelCase=True       ,    UpperCAmelCase="gelu"       ,    UpperCAmelCase=256       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=0.02       ,    UpperCAmelCase=False       ,    UpperCAmelCase=1500       ,    UpperCAmelCase=448       ,    UpperCAmelCase=5_0256       ,    UpperCAmelCase=5_0256       ,    UpperCAmelCase=5_0256       ,    UpperCAmelCase=None       ,    UpperCAmelCase=[220, 5_0256]       ,    UpperCAmelCase=False       ,    UpperCAmelCase=256       ,    UpperCAmelCase=False       ,    UpperCAmelCase=0.05       ,    UpperCAmelCase=10       ,    UpperCAmelCase=2       ,    UpperCAmelCase=0.0       ,    UpperCAmelCase=10       ,    UpperCAmelCase=0       ,    UpperCAmelCase=7       ,    **UpperCAmelCase       ,    ):
							"""simple docstring"""







							_UpperCAmelCase									=			vocab_size
							_UpperCAmelCase									=			num_mel_bins
							_UpperCAmelCase									=			d_model
							_UpperCAmelCase									=			encoder_layers
							_UpperCAmelCase									=			encoder_attention_heads
							_UpperCAmelCase									=			decoder_layers
							_UpperCAmelCase									=			decoder_attention_heads
							_UpperCAmelCase									=			decoder_ffn_dim
							_UpperCAmelCase									=			encoder_ffn_dim
							_UpperCAmelCase									=			dropout
							_UpperCAmelCase									=			attention_dropout
							_UpperCAmelCase									=			activation_dropout
							_UpperCAmelCase									=			activation_function
							_UpperCAmelCase									=			init_std
							_UpperCAmelCase									=			encoder_layerdrop
							_UpperCAmelCase									=			decoder_layerdrop
							_UpperCAmelCase									=			use_cache
							_UpperCAmelCase									=			encoder_layers
							_UpperCAmelCase									=			scale_embedding  # scale factor will be sqrt(d_model) if True
							_UpperCAmelCase									=			max_source_positions
							_UpperCAmelCase									=			max_target_positions

							# Audio Classification-specific parameters. Feel free to ignore for other classes.
							_UpperCAmelCase									=			classifier_proj_size
							_UpperCAmelCase									=			use_weighted_layer_sum

							# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
							_UpperCAmelCase									=			apply_spec_augment
							_UpperCAmelCase									=			mask_time_prob
							_UpperCAmelCase									=			mask_time_length
							_UpperCAmelCase									=			mask_time_min_masks
							_UpperCAmelCase									=			mask_feature_prob
							_UpperCAmelCase									=			mask_feature_length
							_UpperCAmelCase									=			mask_feature_min_masks

							_UpperCAmelCase									=			median_filter_width

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





class __lowerCamelCase (      _UpperCamelCase):





	"""simple docstring"""






	@property
	def        UpperCamelCase    (							self    ):
							"""simple docstring"""







							_UpperCAmelCase									=			OrderedDict(
							    [
							        ('input_features', {0: 'batch', 1: 'feature_size', 2: 'encoder_sequence'}),
							    ]    )
							if self.use_past:
													_UpperCAmelCase									=			{0: 'batch'}
							else:
													_UpperCAmelCase									=			{0: 'batch', 1: 'decoder_sequence'}

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

							return common_inputs

	def        UpperCamelCase    (							self       ,    UpperCAmelCase       ,    UpperCAmelCase = -1       ,    UpperCAmelCase = -1       ,    UpperCAmelCase = False       ,    UpperCAmelCase = None       ,    UpperCAmelCase = 2_2050       ,    UpperCAmelCase = 5.0       ,    UpperCAmelCase = 220       ,    ):
							"""simple docstring"""







							_UpperCAmelCase									=			OrderedDict()
							_UpperCAmelCase									=			OnnxConfig.generate_dummy_inputs(
							    self       ,    preprocessor=preprocessor.feature_extractor       ,    batch_size=_UpperCAmelCase       ,    framework=_UpperCAmelCase       ,    sampling_rate=_UpperCAmelCase       ,    time_duration=_UpperCAmelCase       ,    frequency=_UpperCAmelCase       ,    )
							_UpperCAmelCase									=			encoder_inputs['input_features'].shape[2]
							_UpperCAmelCase									=			encoder_sequence_length // 2 if self.use_past else seq_length

							_UpperCAmelCase									=			super().generate_dummy_inputs(
							    preprocessor.tokenizer       ,    _UpperCAmelCase       ,    _UpperCAmelCase       ,    _UpperCAmelCase       ,    _UpperCAmelCase    )

							_UpperCAmelCase									=			encoder_inputs.pop('input_features'    )
							_UpperCAmelCase									=			decoder_inputs.pop('decoder_input_ids'    )

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

							return dummy_inputs

	@property
	def        UpperCamelCase    (							self    ):
							"""simple docstring"""







							return 1e-3





'''simple docstring'''

from typing import Any

class 	__magic_name__						:







							def __init__(							self					:       List[Any]	,_UpperCAmelCase					:       Any		):
									_a     :      List[Any]        =							data
									_a     :      Union[str, Any]        =							None







							def __repr__(							self					:       Any		):
									return F"""Node({self.data})"""

class 	__magic_name__						:







							def __init__(							self					:       int		):
									_a     :      Tuple        =							None







							def __iter__(							self					:       str		):
									_a     :      int        =							self.head
									while node:
											yield node.data
											_a     :      Union[str, Any]        =							node.next







							def __len__(							self					:       Optional[Any]		):
									return sum(1 for _ in self		)







							def __repr__(							self					:       str		):
									return "->".join([str(_UpperCAmelCase		) for item in self]		)







							def __getitem__(							self					:       Tuple	,_UpperCAmelCase					:       int		):
									if not 0 <= index < len(self		):
											raise ValueError('list index out of range.'		)
									for i, node in enumerate(self		):
											if i == index:
													return node
									return None







							def __setitem__(							self					:       Union[str, Any]	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       Any		):
									if not 0 <= index < len(self		):
											raise ValueError('list index out of range.'		)
									_a     :      Any        =							self.head
									for _ in range(_UpperCAmelCase		):
											_a     :      Optional[Any]        =							current.next
									_a     :      Optional[int]        =							data







							def 							__lowercase			(							self					:       Optional[int]	,_UpperCAmelCase					:       Any		):
									self.insert_nth(len(self		)	,_UpperCAmelCase		)







							def 							__lowercase			(							self					:       Union[str, Any]	,_UpperCAmelCase					:       Any		):
									self.insert_nth(0	,_UpperCAmelCase		)







							def 							__lowercase			(							self					:       str	,_UpperCAmelCase					:       int	,_UpperCAmelCase					:       Any		):
									if not 0 <= index <= len(self		):
											raise IndexError('list index out of range'		)
									_a     :      int        =							Node(_UpperCAmelCase		)
									if self.head is None:
											_a     :      str        =							new_node
									elif index == 0:
											_a     :      List[str]        =							self.head  # link new_node to head
											_a     :      Union[str, Any]        =							new_node
									else:
											_a     :      int        =							self.head
											for _ in range(index - 1		):
													_a     :      Union[str, Any]        =							temp.next
											_a     :      List[str]        =							temp.next
											_a     :      Optional[int]        =							new_node







							def 							__lowercase			(							self					:       Optional[int]		):  # print every node data
									print(self		)







							def 							__lowercase			(							self					:       str		):
									return self.delete_nth(0		)







							def 							__lowercase			(							self					:       str		):  # delete from tail
									return self.delete_nth(len(self		) - 1		)







							def 							__lowercase			(							self					:       List[str]	,_UpperCAmelCase					:       int = 0		):
									if not 0 <= index <= len(self		) - 1:  # test if index is valid
											raise IndexError('List index out of range.'		)
									_a     :      Optional[Any]        =							self.head  # default first node
									if index == 0:
											_a     :      int        =							self.head.next
									else:
											_a     :      int        =							self.head
											for _ in range(index - 1		):
													_a     :      str        =							temp.next
											_a     :      str        =							temp.next
											_a     :      int        =							temp.next.next
									return delete_node.data







							def 							__lowercase			(							self					:       List[Any]		):
									return self.head is None







							def 							__lowercase			(							self					:       Tuple		):
									_a     :      List[Any]        =							None
									_a     :      Tuple        =							self.head

									while current:
											# Store the current node's next node.
											_a     :      Dict        =							current.next
											# Make the current node's next point backwards
											_a     :      str        =							prev
											# Make the previous node be the current node
											_a     :      Tuple        =							current
											# Make the current node the next node (to progress iteration)
											_a     :      Optional[Any]        =							next_node
									# Return prev in order to put the head at the end
									_a     :      int        =							prev



def      __lowerCamelCase     (      )			->      None:
		_a     :      List[str]        =							LinkedList()
		assert linked_list.is_empty() is True
		assert str(lowerCAmelCase_  ) == ""

		try:
				linked_list.delete_head()
				raise AssertionError  # This should not happen.
		except IndexError:
				assert True  # This should happen.

		try:
				linked_list.delete_tail()
				raise AssertionError  # This should not happen.
		except IndexError:
				assert True  # This should happen.

		for i in range(10  ):
				assert len(lowerCAmelCase_  ) == i
				linked_list.insert_nth(lowerCAmelCase_						,			i + 1  )
		assert str(lowerCAmelCase_  ) == "->".join(str(lowerCAmelCase_  ) for i in range(1						,			11  )  )

		linked_list.insert_head(0  )
		linked_list.insert_tail(11  )
		assert str(lowerCAmelCase_  ) == "->".join(str(lowerCAmelCase_  ) for i in range(0						,			12  )  )

		assert linked_list.delete_head() == 0
		assert linked_list.delete_nth(9  ) == 10
		assert linked_list.delete_tail() == 11
		assert len(lowerCAmelCase_  ) == 9
		assert str(lowerCAmelCase_  ) == "->".join(str(lowerCAmelCase_  ) for i in range(1						,			10  )  )

		assert all(linked_list[i] == i + 1 for i in range(0						,			9  )  ) is True

		for i in range(0						,			9  ):
				_a     :      Union[str, Any]        =							-i
		assert all(linked_list[i] == -i for i in range(0						,			9  )  ) is True

		linked_list.reverse()
		assert str(lowerCAmelCase_  ) == "->".join(str(lowerCAmelCase_  ) for i in range(-8						,			1  )  )



def      __lowerCamelCase     (      )			->      None:
		_a     :      Dict        =							[
		    -9,
		    100,
		    Node(77345112  ),
		    'dlrow olleH',
		    7,
		    5555,
		    0,
		    -192.55_555,
		    'Hello, world!',
		    77.9,
		    Node(10  ),
		    None,
		    None,
		    12.20,
		]
		_a     :      List[Any]        =							LinkedList()

		for i in test_input:
				linked_list.insert_tail(lowerCAmelCase_  )

		# Check if it's empty or not
		assert linked_list.is_empty() is False
		assert (
		    str(lowerCAmelCase_  ) == "-9->100->Node(77345112)->dlrow olleH->7->5555->0->"
		    "-192.55555->Hello, world!->77.9->Node(10)->None->None->12.2"
		)

		# Delete the head
		_a     :      List[str]        =							linked_list.delete_head()
		assert result == -9
		assert (
		    str(lowerCAmelCase_  ) == "100->Node(77345112)->dlrow olleH->7->5555->0->-192.55555->"
		    "Hello, world!->77.9->Node(10)->None->None->12.2"
		)

		# Delete the tail
		_a     :      Dict        =							linked_list.delete_tail()
		assert result == 12.2
		assert (
		    str(lowerCAmelCase_  ) == "100->Node(77345112)->dlrow olleH->7->5555->0->-192.55555->"
		    "Hello, world!->77.9->Node(10)->None->None"
		)

		# Delete a node in specific location in linked list
		_a     :      Optional[Any]        =							linked_list.delete_nth(10  )
		assert result is None
		assert (
		    str(lowerCAmelCase_  ) == "100->Node(77345112)->dlrow olleH->7->5555->0->-192.55555->"
		    "Hello, world!->77.9->Node(10)->None"
		)

		# Add a Node instance to its head
		linked_list.insert_head(Node('Hello again, world!'  )  )
		assert (
		    str(lowerCAmelCase_  )
		    == "Node(Hello again, world!)->100->Node(77345112)->dlrow olleH->"
		    "7->5555->0->-192.55555->Hello, world!->77.9->Node(10)->None"
		)

		# Add None to its tail
		linked_list.insert_tail(lowerCAmelCase_  )
		assert (
		    str(lowerCAmelCase_  )
		    == "Node(Hello again, world!)->100->Node(77345112)->dlrow olleH->"
		    "7->5555->0->-192.55555->Hello, world!->77.9->Node(10)->None->None"
		)

		# Reverse the linked list
		linked_list.reverse()
		assert (
		    str(lowerCAmelCase_  )
		    == "None->None->Node(10)->77.9->Hello, world!->-192.55555->0->5555->"
		    "7->dlrow olleH->Node(77345112)->100->Node(Hello again, world!)"
		)



def      __lowerCamelCase     (      )			->      Union[str, Any]:
		from doctest import testmod

		testmod()

		_a     :      Optional[int]        =							LinkedList()
		linked_list.insert_head(input('Inserting 1st at head '  ).strip()  )
		linked_list.insert_head(input('Inserting 2nd at head '  ).strip()  )
		print('\nPrint list:'  )
		linked_list.print_list()
		linked_list.insert_tail(input('\nInserting 1st at tail '  ).strip()  )
		linked_list.insert_tail(input('Inserting 2nd at tail '  ).strip()  )
		print('\nPrint list:'  )
		linked_list.print_list()
		print('\nDelete head'  )
		linked_list.delete_head()
		print('Delete tail'  )
		linked_list.delete_tail()
		print('\nPrint list:'  )
		linked_list.print_list()
		print('\nReverse linked list'  )
		linked_list.reverse()
		print('\nPrint list:'  )
		linked_list.print_list()
		print('\nString representation of linked list:'  )
		print(lowerCAmelCase_  )
		print('\nReading/changing Node data using indexing:'  )
		print(f"""Element at Position 1: {linked_list[1]}"""  )
		_a     :      Optional[Any]        =							input('Enter New Value: '  ).strip()
		print('New list:'  )
		print(lowerCAmelCase_  )
		print(f"""length of linked_list is : {len(lowerCAmelCase_  )}"""  )


if __name__ == "__main__":
							main()




