
from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset




class 				lowerCamelCase__							(       __lowercase):




	'''simple docstring'''




	def      _lowerCamelCase       (      self	:Tuple		)	->				Dict:
								return [
								    {"col_1": 3, "col_2": "a"},
								    {"col_1": 2, "col_2": "b"},
								    {"col_1": 1, "col_2": "c"},
								    {"col_1": 0, "col_2": "d"},
								]







	def      _lowerCamelCase       (      self	:Dict		)	->				Optional[Any]:
								__UpperCamelCase			:     List[str]         =      {"col_1": [3, 2, 1, 0], "col_2": ["a", "b", "c", "d"]}
								return Dataset.from_dict(a		)







	def      _lowerCamelCase       (      self	:Tuple		)	->				int:
								__UpperCamelCase			:     List[str]         =      self._create_example_records()
								__UpperCamelCase			:     Optional[int]         =      Dataset.from_list(a		)
								self.assertListEqual(dset.column_names  ,     ["col_1", "col_2"]		)
								for i, r in enumerate(a		):
															self.assertDictEqual(a  ,     example_records[i]		)







	def      _lowerCamelCase       (      self	:List[str]		)	->				Optional[int]:
								__UpperCamelCase			:     Optional[int]         =      self._create_example_records()
								__UpperCamelCase			:     Dict         =      Dataset.from_list(a		)
								__UpperCamelCase			:     Optional[int]         =      Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}		)
								self.assertEqual(dset.info  ,     dset_from_dict.info		)







	def      _lowerCamelCase       (      self	:str		)	->				Optional[int]:  # checks what happens with missing columns
								__UpperCamelCase			:     List[Any]         =      [{"col_1": 1}, {"col_2": "x"}]
								__UpperCamelCase			:     int         =      Dataset.from_list(a		)
								self.assertDictEqual(dset[0]  ,     {"col_1": 1}		)
								self.assertDictEqual(dset[1]  ,     {"col_1": None}		)  # NB: first record is used for columns







	def      _lowerCamelCase       (      self	:Tuple		)	->				Tuple:  # checks if the type can be inferred from the second record
								__UpperCamelCase			:     int         =      [{"col_1": []}, {"col_1": [1, 2]}]
								__UpperCamelCase			:     Any         =      Dataset.from_list(a		)
								self.assertEqual(dset.info.features["col_1"]  ,     Sequence(Value("int64"		)		)		)







	def      _lowerCamelCase       (      self	:str		)	->				Optional[Any]:
								__UpperCamelCase			:     Optional[Any]         =      Dataset.from_list([]		)
								self.assertEqual(len(a		)  ,     0		)
								self.assertListEqual(dset.column_names  ,     []		)

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowercase						:      Dict									= logging.get_logger(__name__)

lowercase						:      Optional[Any]									= {
    'facebook/s2t-wav2vec2-large-en-de': (
        'https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json'
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}




class 				lowerCamelCase__							(       __lowercase):




	'''simple docstring'''




	_A			=  'speech_to_text_2'
	_A			=  ['past_key_values']
	_A			=  {'num_attention_heads': 'decoder_attention_heads', 'hidden_size': 'd_model'}







	def __init__(      self	:Dict  ,     a	:Tuple=1_0_0_0_0  ,     a	:Optional[int]=6  ,     a	:List[str]=2_0_4_8  ,     a	:Tuple=4  ,     a	:List[Any]=0.0  ,     a	:str=True  ,     a	:Any="relu"  ,     a	:Any=2_5_6  ,     a	:Optional[int]=0.1  ,     a	:Any=0.0  ,     a	:int=0.0  ,     a	:int=0.02  ,     a	:List[Any]=2  ,     a	:Tuple=True  ,     a	:str=1  ,     a	:Optional[int]=0  ,     a	:List[Any]=2  ,     a	:Any=1_0_2_4  ,     **a	:str  ,     )	->				int:
								__UpperCamelCase			:     List[str]         =      vocab_size
								__UpperCamelCase			:     int         =      d_model
								__UpperCamelCase			:     Optional[int]         =      decoder_ffn_dim
								__UpperCamelCase			:     Any         =      decoder_layers
								__UpperCamelCase			:     Any         =      decoder_attention_heads
								__UpperCamelCase			:     Tuple         =      dropout
								__UpperCamelCase			:     Any         =      attention_dropout
								__UpperCamelCase			:     Any         =      activation_dropout
								__UpperCamelCase			:     Dict         =      activation_function
								__UpperCamelCase			:     int         =      init_std
								__UpperCamelCase			:     List[str]         =      decoder_layerdrop
								__UpperCamelCase			:     Optional[Any]         =      use_cache
								__UpperCamelCase			:     int         =      decoder_layers
								__UpperCamelCase			:     Union[str, Any]         =      scale_embedding  # scale factor will be sqrt(d_model) if True
								__UpperCamelCase			:     Dict         =      max_target_positions

								super().__init__(
								    pad_token_id=a  ,     bos_token_id=a  ,     eos_token_id=a  ,     decoder_start_token_id=a  ,     **a  ,     )