


'''simple docstring'''


import functools
import operator

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


UpperCAmelCase_		:   Optional[int]							   =		logging.get_logger(__name__)

UpperCAmelCase_		:   Dict							   =		{
    'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}





class     lowercase__  (						_snake_case					):





							'''simple docstring'''


							A_							:      Tuple      	=  """wav2vec2"""






							def __init__(    self    ,					__snake_case=32    ,					__snake_case=768    ,					__snake_case=12    ,					__snake_case=12    ,					__snake_case=3072    ,					__snake_case="gelu"    ,					__snake_case=0.1    ,					__snake_case=0.1    ,					__snake_case=0.1    ,					__snake_case=0.0    ,					__snake_case=0.0    ,					__snake_case=0.1    ,					__snake_case=0.1    ,					__snake_case=0.02    ,					__snake_case=1e-5    ,					__snake_case="group"    ,					__snake_case="gelu"    ,					__snake_case=(512, 512, 512, 512, 512, 512, 512)    ,					__snake_case=(5, 2, 2, 2, 2, 2, 2)    ,					__snake_case=(10, 3, 3, 3, 3, 2, 2)    ,					__snake_case=False    ,					__snake_case=128    ,					__snake_case=16    ,					__snake_case=False    ,					__snake_case=True    ,					__snake_case=0.05    ,					__snake_case=10    ,					__snake_case=2    ,					__snake_case=0.0    ,					__snake_case=10    ,					__snake_case=0    ,					__snake_case=320    ,					__snake_case=2    ,					__snake_case=0.1    ,					__snake_case=100    ,					__snake_case=256    ,					__snake_case=256    ,					__snake_case=0.1    ,					__snake_case="sum"    ,					__snake_case=False    ,					__snake_case=False    ,					__snake_case=256    ,					__snake_case=(512, 512, 512, 512, 1500)    ,					__snake_case=(5, 3, 3, 1, 1)    ,					__snake_case=(1, 2, 3, 1, 1)    ,					__snake_case=512    ,					__snake_case=0    ,					__snake_case=1    ,					__snake_case=2    ,					__snake_case=False    ,					__snake_case=3    ,					__snake_case=2    ,					__snake_case=3    ,					__snake_case=None    ,					__snake_case=None    ,					**__snake_case    ,					):
											super().__init__(**__snake_case    ,					pad_token_id=__snake_case    ,					bos_token_id=__snake_case    ,					eos_token_id=__snake_case  )
											_SCREAMING_SNAKE_CASE :       Dict     		=      hidden_size
											_SCREAMING_SNAKE_CASE :       Dict     		=      feat_extract_norm
											_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      feat_extract_activation
											_SCREAMING_SNAKE_CASE :       List[str]     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       int     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       Dict     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       Any     		=      conv_bias
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      num_conv_pos_embeddings
											_SCREAMING_SNAKE_CASE :       str     		=      num_conv_pos_embedding_groups
											_SCREAMING_SNAKE_CASE :       Dict     		=      len(self.conv_dim  )
											_SCREAMING_SNAKE_CASE :       List[str]     		=      num_hidden_layers
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      intermediate_size
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      hidden_act
											_SCREAMING_SNAKE_CASE :       Tuple     		=      num_attention_heads
											_SCREAMING_SNAKE_CASE :       Tuple     		=      hidden_dropout
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      attention_dropout
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      activation_dropout
											_SCREAMING_SNAKE_CASE :       Dict     		=      feat_proj_dropout
											_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      final_dropout
											_SCREAMING_SNAKE_CASE :       List[str]     		=      layerdrop
											_SCREAMING_SNAKE_CASE :       str     		=      layer_norm_eps
											_SCREAMING_SNAKE_CASE :       Any     		=      initializer_range
											_SCREAMING_SNAKE_CASE :       Optional[Any]     		=      vocab_size
											_SCREAMING_SNAKE_CASE :       Any     		=      do_stable_layer_norm
											_SCREAMING_SNAKE_CASE :       Tuple     		=      use_weighted_layer_sum

											if (
											    (len(self.conv_stride  ) != self.num_feat_extract_layers)
											    or (len(self.conv_kernel  ) != self.num_feat_extract_layers)
											    or (len(self.conv_dim  ) != self.num_feat_extract_layers)
											):
															raise ValueError(
															    """Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =="""
															    """ `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ="""
															    f""" {len(self.conv_dim  )}`, `len(config.conv_stride) = {len(self.conv_stride  )}`,"""
															    f""" `len(config.conv_kernel) = {len(self.conv_kernel  )}`."""  )

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

											# parameters for pretraining with codevector quantized representations
											_SCREAMING_SNAKE_CASE :       Dict     		=      num_codevectors_per_group
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      num_codevector_groups
											_SCREAMING_SNAKE_CASE :       str     		=      contrastive_logits_temperature
											_SCREAMING_SNAKE_CASE :       int     		=      feat_quantizer_dropout
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      num_negatives
											_SCREAMING_SNAKE_CASE :       str     		=      codevector_dim
											_SCREAMING_SNAKE_CASE :       int     		=      proj_codevector_dim
											_SCREAMING_SNAKE_CASE :       List[str]     		=      diversity_loss_weight

											# ctc loss
											_SCREAMING_SNAKE_CASE :       Dict     		=      ctc_loss_reduction
											_SCREAMING_SNAKE_CASE :       Dict     		=      ctc_zero_infinity

											# adapter
											_SCREAMING_SNAKE_CASE :       Any     		=      add_adapter
											_SCREAMING_SNAKE_CASE :       Union[str, Any]     		=      adapter_kernel_size
											_SCREAMING_SNAKE_CASE :       Tuple     		=      adapter_stride
											_SCREAMING_SNAKE_CASE :       str     		=      num_adapter_layers
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      output_hidden_size or hidden_size
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      adapter_attn_dim

											# SequenceClassification-specific parameter. Feel free to ignore for other classes.
											_SCREAMING_SNAKE_CASE :       List[Any]     		=      classifier_proj_size

											# XVector-specific parameters. Feel free to ignore for other classes.
											_SCREAMING_SNAKE_CASE :       str     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       List[str]     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       Optional[int]     		=      list(__snake_case  )
											_SCREAMING_SNAKE_CASE :       List[str]     		=      xvector_output_dim






							@property
							def UpperCAmelCase_	(    self  ):
											return functools.reduce(operator.mul    ,					self.conv_stride    ,					1  )








'''simple docstring'''


def 			snake_case_   (  SCREAMING_SNAKE_CASE__     ):







				"""simple docstring"""





				_SCREAMING_SNAKE_CASE :       int     		=      0
				while len(SCREAMING_SNAKE_CASE__     ) > 1:
								_SCREAMING_SNAKE_CASE :       Any     		=      0
								# Consider two files with minimum cost to be merged
								for _ in range(2     ):
												_SCREAMING_SNAKE_CASE :       Optional[int]     		=      files.index(min(SCREAMING_SNAKE_CASE__     )     )
												temp += files[min_index]
												files.pop(SCREAMING_SNAKE_CASE__     )
								files.append(SCREAMING_SNAKE_CASE__     )
								optimal_merge_cost += temp
				return optimal_merge_cost


if __name__ == "__main__":
				import doctest

				doctest.testmod()




