



"""simple docstring"""


import functools
import operator

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


snake_case_				     =       logging.get_logger(__name__)

snake_case_				     =       {
    """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       A_			(     SCREAMING_SNAKE_CASE_				):



						"""simple docstring"""
						__UpperCamelCase						=							"""sew-d"""






						def __init__(					self :int   ,  lowercase_ :Tuple=32   ,  lowercase_ :Any=7_68   ,  lowercase_ :Dict=12   ,  lowercase_ :Optional[Any]=12   ,  lowercase_ :Optional[int]=30_72   ,  lowercase_ :Any=2   ,  lowercase_ :int=5_12   ,  lowercase_ :Optional[Any]=2_56   ,  lowercase_ :Tuple=True   ,  lowercase_ :Union[str, Any]=True   ,  lowercase_ :List[Any]=("p2c", "c2p")   ,  lowercase_ :int="layer_norm"   ,  lowercase_ :Any="gelu_python"   ,  lowercase_ :Union[str, Any]=0.1   ,  lowercase_ :Any=0.1   ,  lowercase_ :int=0.1   ,  lowercase_ :List[str]=0.0   ,  lowercase_ :Dict=0.1   ,  lowercase_ :int=0.02   ,  lowercase_ :List[str]=1E-7   ,  lowercase_ :Dict=1E-5   ,  lowercase_ :List[str]="group"   ,  lowercase_ :Any="gelu"   ,  lowercase_ :List[str]=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)   ,  lowercase_ :List[Any]=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)   ,  lowercase_ :Optional[int]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)   ,  lowercase_ :str=False   ,  lowercase_ :Tuple=1_28   ,  lowercase_ :Union[str, Any]=16   ,  lowercase_ :Any=True   ,  lowercase_ :int=0.05   ,  lowercase_ :Union[str, Any]=10   ,  lowercase_ :List[str]=2   ,  lowercase_ :Any=0.0   ,  lowercase_ :Tuple=10   ,  lowercase_ :List[str]=0   ,  lowercase_ :str="mean"   ,  lowercase_ :Optional[int]=False   ,  lowercase_ :str=False   ,  lowercase_ :int=2_56   ,  lowercase_ :Optional[int]=0   ,  lowercase_ :List[str]=1   ,  lowercase_ :List[Any]=2   ,  **lowercase_ :Dict   ,  )				->			Optional[Any]:
												super().__init__(**lowercase_   ,  pad_token_id=lowercase_   ,  bos_token_id=lowercase_   ,  eos_token_id=lowercase_					)
												UpperCAmelCase             = hidden_size
												UpperCAmelCase             = feat_extract_norm
												UpperCAmelCase             = feat_extract_activation
												UpperCAmelCase             = list(lowercase_					)
												UpperCAmelCase             = list(lowercase_					)
												UpperCAmelCase             = list(lowercase_					)
												UpperCAmelCase             = conv_bias
												UpperCAmelCase             = num_conv_pos_embeddings
												UpperCAmelCase             = num_conv_pos_embedding_groups
												UpperCAmelCase             = len(self.conv_dim					)
												UpperCAmelCase             = num_hidden_layers
												UpperCAmelCase             = intermediate_size
												UpperCAmelCase             = squeeze_factor
												UpperCAmelCase             = max_position_embeddings
												UpperCAmelCase             = position_buckets
												UpperCAmelCase             = share_att_key
												UpperCAmelCase             = relative_attention
												UpperCAmelCase             = norm_rel_ebd
												UpperCAmelCase             = list(lowercase_					)
												UpperCAmelCase             = hidden_act
												UpperCAmelCase             = num_attention_heads
												UpperCAmelCase             = hidden_dropout
												UpperCAmelCase             = attention_dropout
												UpperCAmelCase             = activation_dropout
												UpperCAmelCase             = feat_proj_dropout
												UpperCAmelCase             = final_dropout
												UpperCAmelCase             = layer_norm_eps
												UpperCAmelCase             = feature_layer_norm_eps
												UpperCAmelCase             = initializer_range
												UpperCAmelCase             = 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
												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

												# ctc loss
												UpperCAmelCase             = ctc_loss_reduction
												UpperCAmelCase             = ctc_zero_infinity

												# sequence classification
												UpperCAmelCase             = use_weighted_layer_sum
												UpperCAmelCase             = classifier_proj_size






						@property
						def 	UpperCAmelCase__     (					self :str					)				->			Dict:
												return functools.reduce(operator.mul   ,  self.conv_stride   ,  1					)






import requests





def 				UpperCAmelCase						(    lowercase							,			lowercase							):







				"""simple docstring"""



				__lowercase 			=							{'''Content-Type''': '''application/json'''}
				__lowercase 			=							requests.post(lowercase							,			json={'''text''': message_body}							,			headers=lowercase							)
				if response.status_code != 200:
								__lowercase 			=							(
								    '''Request to slack returned an error '''
								    F"{response.status_code}, the response is:\n{response.text}"
								)
								raise ValueError(lowercase							)


if __name__ == "__main__":
		# Set the slack url to the one provided by Slack when you create the webhook at
		# https://my.slack.com/services/new/incoming-webhook/
		send_slack_message("""<YOUR MESSAGE BODY>""", """<SLACK CHANNEL URL>""")