



'''simple docstring'''




import functools
import operator

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


lowerCamelCase							:List[str]       = logging.get_logger(__name__)

lowerCamelCase							:Union[str, Any]       = {
    '''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      _lowerCAmelCase							(      __UpperCAmelCase			):
	__SCREAMING_SNAKE_CASE       :		str		      = 'sew-d'


	def __init__(self	,				lowercase=32	,				lowercase=768	,				lowercase=12	,				lowercase=12	,				lowercase=3072	,				lowercase=2	,				lowercase=512	,				lowercase=256	,				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=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)	,				lowercase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)	,				lowercase=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)	,				lowercase=False	,				lowercase=128	,				lowercase=16	,				lowercase=True	,				lowercase=0.05	,				lowercase=10	,				lowercase=2	,				lowercase=0.0	,				lowercase=10	,				lowercase=0	,				lowercase="mean"	,				lowercase=False	,				lowercase=False	,				lowercase=256	,				lowercase=0	,				lowercase=1	,				lowercase=2	,				**lowercase	,				):
				super().__init__(**lowercase	,				pad_token_id=lowercase	,				bos_token_id=lowercase	,				eos_token_id=lowercase							)
				A_     :						Optional[Any]     =					hidden_size
				A_     :						Dict     =					feat_extract_norm
				A_     :						List[str]     =					feat_extract_activation
				A_     :						Optional[int]     =					list(lowercase							)
				A_     :						str     =					list(lowercase							)
				A_     :						Dict     =					list(lowercase							)
				A_     :						Any     =					conv_bias
				A_     :						Tuple     =					num_conv_pos_embeddings
				A_     :						Any     =					num_conv_pos_embedding_groups
				A_     :						Optional[int]     =					len(self.conv_dim							)
				A_     :						Union[str, Any]     =					num_hidden_layers
				A_     :						int     =					intermediate_size
				A_     :						Union[str, Any]     =					squeeze_factor
				A_     :						Optional[int]     =					max_position_embeddings
				A_     :						int     =					position_buckets
				A_     :						Optional[int]     =					share_att_key
				A_     :						List[Any]     =					relative_attention
				A_     :						List[str]     =					norm_rel_ebd
				A_     :						Tuple     =					list(lowercase							)
				A_     :						Tuple     =					hidden_act
				A_     :						Tuple     =					num_attention_heads
				A_     :						Any     =					hidden_dropout
				A_     :						Tuple     =					attention_dropout
				A_     :						Optional[Any]     =					activation_dropout
				A_     :						List[str]     =					feat_proj_dropout
				A_     :						Tuple     =					final_dropout
				A_     :						Tuple     =					layer_norm_eps
				A_     :						Optional[int]     =					feature_layer_norm_eps
				A_     :						str     =					initializer_range
				A_     :						List[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
				A_     :						Any     =					apply_spec_augment
				A_     :						int     =					mask_time_prob
				A_     :						List[str]     =					mask_time_length
				A_     :						List[str]     =					mask_time_min_masks
				A_     :						int     =					mask_feature_prob
				A_     :						Optional[Any]     =					mask_feature_length
				A_     :						List[Any]     =					mask_feature_min_masks

				# ctc loss
				A_     :						List[str]     =					ctc_loss_reduction
				A_     :						Optional[int]     =					ctc_zero_infinity

				# sequence classification
				A_     :						int     =					use_weighted_layer_sum
				A_     :						Optional[int]     =					classifier_proj_size


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




'''simple docstring'''




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCamelCase							:Any       = logging.get_logger(__name__)

lowerCamelCase							:List[Any]       = {
    '''camembert-base''': '''https://huggingface.co/camembert-base/resolve/main/config.json''',
    '''umberto-commoncrawl-cased-v1''': (
        '''https://huggingface.co/Musixmatch/umberto-commoncrawl-cased-v1/resolve/main/config.json'''
    ),
    '''umberto-wikipedia-uncased-v1''': (
        '''https://huggingface.co/Musixmatch/umberto-wikipedia-uncased-v1/resolve/main/config.json'''
    ),
}







class      _lowerCAmelCase							(      __UpperCAmelCase			):
	__SCREAMING_SNAKE_CASE       :		Optional[int]		      = 'camembert'


	def __init__(self	,				lowercase=30522	,				lowercase=768	,				lowercase=12	,				lowercase=12	,				lowercase=3072	,				lowercase="gelu"	,				lowercase=0.1	,				lowercase=0.1	,				lowercase=512	,				lowercase=2	,				lowercase=0.02	,				lowercase=1E-12	,				lowercase=1	,				lowercase=0	,				lowercase=2	,				lowercase="absolute"	,				lowercase=True	,				lowercase=None	,				**lowercase	,				):
				super().__init__(pad_token_id=lowercase	,				bos_token_id=lowercase	,				eos_token_id=lowercase	,				**lowercase							)

				A_     :						List[Any]     =					vocab_size
				A_     :						int     =					hidden_size
				A_     :						Dict     =					num_hidden_layers
				A_     :						Dict     =					num_attention_heads
				A_     :						Optional[Any]     =					hidden_act
				A_     :						str     =					intermediate_size
				A_     :						int     =					hidden_dropout_prob
				A_     :						List[Any]     =					attention_probs_dropout_prob
				A_     :						Optional[Any]     =					max_position_embeddings
				A_     :						Optional[int]     =					type_vocab_size
				A_     :						int     =					initializer_range
				A_     :						str     =					layer_norm_eps
				A_     :						int     =					position_embedding_type
				A_     :						Dict     =					use_cache
				A_     :						Any     =					classifier_dropout







class      _lowerCAmelCase							(      __UpperCAmelCase			):


	@property
	def    _a     (self							):
				if self.task == "multiple-choice":
							A_     :						Optional[Any]     =					{0: """batch""", 1: """choice""", 2: """sequence"""}
				else:
							A_     :						int     =					{0: """batch""", 1: """sequence"""}
				return OrderedDict(
				    [
				        ("""input_ids""", dynamic_axis),
				        ("""attention_mask""", dynamic_axis),
				    ]							)