


import functools
import operator

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


_UpperCAmelCase			:  int     =logging.get_logger(__name__)

_UpperCAmelCase			:  Tuple     ={
    """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json""",
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}







class 				snake_case__(							UpperCAmelCase__							):







						'''simple docstring'''




						SCREAMING_SNAKE_CASE__      :  Tuple					=							"""sew-d"""




						def __init__(				self   ,						__lowercase=3_2   ,						__lowercase=7_6_8   ,						__lowercase=1_2   ,						__lowercase=1_2   ,						__lowercase=3_0_7_2   ,						__lowercase=2   ,						__lowercase=5_1_2   ,						__lowercase=2_5_6   ,						__lowercase=True   ,						__lowercase=True   ,						__lowercase=("p2c", "c2p")   ,						__lowercase="layer_norm"   ,						__lowercase="gelu_python"   ,						__lowercase=0.1   ,						__lowercase=0.1   ,						__lowercase=0.1   ,						__lowercase=0.0   ,						__lowercase=0.1   ,						__lowercase=0.02   ,						__lowercase=1e-7   ,						__lowercase=1e-5   ,						__lowercase="group"   ,						__lowercase="gelu"   ,						__lowercase=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)   ,						__lowercase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)   ,						__lowercase=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)   ,						__lowercase=False   ,						__lowercase=1_2_8   ,						__lowercase=1_6   ,						__lowercase=True   ,						__lowercase=0.05   ,						__lowercase=1_0   ,						__lowercase=2   ,						__lowercase=0.0   ,						__lowercase=1_0   ,						__lowercase=0   ,						__lowercase="mean"   ,						__lowercase=False   ,						__lowercase=False   ,						__lowercase=2_5_6   ,						__lowercase=0   ,						__lowercase=1   ,						__lowercase=2   ,						**__lowercase   ,						)					->    int:
										super().__init__(**__lowercase   ,						pad_token_id=__lowercase   ,						bos_token_id=__lowercase   ,						eos_token_id=__lowercase							)
										lowerCAmelCase_ :      str    				=				hidden_size
										lowerCAmelCase_ :      Optional[Any]    				=				feat_extract_norm
										lowerCAmelCase_ :      Dict    				=				feat_extract_activation
										lowerCAmelCase_ :      str    				=				list(__lowercase							)
										lowerCAmelCase_ :      List[str]    				=				list(__lowercase							)
										lowerCAmelCase_ :      str    				=				list(__lowercase							)
										lowerCAmelCase_ :      Dict    				=				conv_bias
										lowerCAmelCase_ :      List[Any]    				=				num_conv_pos_embeddings
										lowerCAmelCase_ :      List[Any]    				=				num_conv_pos_embedding_groups
										lowerCAmelCase_ :      Optional[Any]    				=				len(self.conv_dim							)
										lowerCAmelCase_ :      List[Any]    				=				num_hidden_layers
										lowerCAmelCase_ :      str    				=				intermediate_size
										lowerCAmelCase_ :      Tuple    				=				squeeze_factor
										lowerCAmelCase_ :      str    				=				max_position_embeddings
										lowerCAmelCase_ :      Optional[int]    				=				position_buckets
										lowerCAmelCase_ :      Any    				=				share_att_key
										lowerCAmelCase_ :      Optional[Any]    				=				relative_attention
										lowerCAmelCase_ :      List[str]    				=				norm_rel_ebd
										lowerCAmelCase_ :      Tuple    				=				list(__lowercase							)
										lowerCAmelCase_ :      str    				=				hidden_act
										lowerCAmelCase_ :      Any    				=				num_attention_heads
										lowerCAmelCase_ :      Dict    				=				hidden_dropout
										lowerCAmelCase_ :      Dict    				=				attention_dropout
										lowerCAmelCase_ :      List[str]    				=				activation_dropout
										lowerCAmelCase_ :      Any    				=				feat_proj_dropout
										lowerCAmelCase_ :      Dict    				=				final_dropout
										lowerCAmelCase_ :      Any    				=				layer_norm_eps
										lowerCAmelCase_ :      Optional[int]    				=				feature_layer_norm_eps
										lowerCAmelCase_ :      Optional[int]    				=				initializer_range
										lowerCAmelCase_ :      Optional[Any]    				=				vocab_size

										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)`,'''
														    f"""but is `len(config.conv_dim) = {len(self.conv_dim							)}`, `len(config.conv_stride)"""
														    f"""= {len(self.conv_stride							)}`, `len(config.conv_kernel) = {len(self.conv_kernel							)}`."""							)

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

										# ctc loss
										lowerCAmelCase_ :      int    				=				ctc_loss_reduction
										lowerCAmelCase_ :      Optional[Any]    				=				ctc_zero_infinity

										# sequence classification
										lowerCAmelCase_ :      Optional[int]    				=				use_weighted_layer_sum
										lowerCAmelCase_ :      Optional[Any]    				=				classifier_proj_size




						@property
						def 						lowercase_ (				self							)					->    List[Any]:
										return functools.reduce(operator.mul   ,						self.conv_stride   ,						1							)



from __future__ import annotations



def 			lowerCAmelCase (		lowerCAmelCase_ ,   lowerCAmelCase_ ,   lowerCAmelCase_ ,   )-> tuple:
				if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1:
								raise ValueError('''You cannot supply more or less than 2 values''' )
				elif electron_conc < 0:
								raise ValueError('''Electron concentration cannot be negative in a semiconductor''' )
				elif hole_conc < 0:
								raise ValueError('''Hole concentration cannot be negative in a semiconductor''' )
				elif intrinsic_conc < 0:
								raise ValueError(
								    '''Intrinsic concentration cannot be negative in a semiconductor''' )
				elif electron_conc == 0:
								return (
								    "electron_conc",
								    intrinsic_conc**2 / hole_conc,
								)
				elif hole_conc == 0:
								return (
								    "hole_conc",
								    intrinsic_conc**2 / electron_conc,
								)
				elif intrinsic_conc == 0:
								return (
								    "intrinsic_conc",
								    (electron_conc * hole_conc) ** 0.5,
								)
				else:
								return (-1, -1)


if __name__ == "__main__":
						import doctest

						doctest.testmod()