






import functools
import operator

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


SCREAMING_SNAKE_CASE__		:							Dict 				=				logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__		:							int 				=				{
    """microsoft/unispeech-large-1500h-cv""": (
        """https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json"""
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}







class 				UpperCAmelCase_  (		__lowerCamelCase		):
     __lowerCamelCase      				=  'unispeech'




     def __init__(				self	,						_lowerCAmelCase=32	,						_lowerCAmelCase=768	,						_lowerCAmelCase=12	,						_lowerCAmelCase=12	,						_lowerCAmelCase=3072	,						_lowerCAmelCase="gelu"	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=0.0	,						_lowerCAmelCase=0.0	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=0.0_2	,						_lowerCAmelCase=1e-5	,						_lowerCAmelCase="group"	,						_lowerCAmelCase="gelu"	,						_lowerCAmelCase=(512, 512, 512, 512, 512, 512, 512)	,						_lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)	,						_lowerCAmelCase=(10, 3, 3, 3, 3, 2, 2)	,						_lowerCAmelCase=False	,						_lowerCAmelCase=128	,						_lowerCAmelCase=16	,						_lowerCAmelCase=False	,						_lowerCAmelCase=True	,						_lowerCAmelCase=0.0_5	,						_lowerCAmelCase=10	,						_lowerCAmelCase=2	,						_lowerCAmelCase=0.0	,						_lowerCAmelCase=10	,						_lowerCAmelCase=0	,						_lowerCAmelCase=320	,						_lowerCAmelCase=2	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase=100	,						_lowerCAmelCase=256	,						_lowerCAmelCase=256	,						_lowerCAmelCase=0.1	,						_lowerCAmelCase="mean"	,						_lowerCAmelCase=False	,						_lowerCAmelCase=False	,						_lowerCAmelCase=256	,						_lowerCAmelCase=80	,						_lowerCAmelCase=0	,						_lowerCAmelCase=1	,						_lowerCAmelCase=2	,						_lowerCAmelCase=0.5	,						**_lowerCAmelCase	,						):
          super().__init__(**_lowerCAmelCase	,						pad_token_id=_lowerCAmelCase	,						bos_token_id=_lowerCAmelCase	,						eos_token_id=_lowerCAmelCase		)
          UpperCAmelCase__      :  Optional[Any]				      =			hidden_size
          UpperCAmelCase__      :  Optional[Any]				      =			feat_extract_norm
          UpperCAmelCase__      :  Any				      =			feat_extract_activation
          UpperCAmelCase__      :  List[Any]				      =			list(_lowerCAmelCase		)
          UpperCAmelCase__      :  Union[str, Any]				      =			list(_lowerCAmelCase		)
          UpperCAmelCase__      :  Tuple				      =			list(_lowerCAmelCase		)
          UpperCAmelCase__      :  Union[str, Any]				      =			conv_bias
          UpperCAmelCase__      :  Optional[int]				      =			num_conv_pos_embeddings
          UpperCAmelCase__      :  int				      =			num_conv_pos_embedding_groups
          UpperCAmelCase__      :  Tuple				      =			len(self.conv_dim		)
          UpperCAmelCase__      :  Union[str, Any]				      =			num_hidden_layers
          UpperCAmelCase__      :  List[str]				      =			intermediate_size
          UpperCAmelCase__      :  str				      =			hidden_act
          UpperCAmelCase__      :  Union[str, Any]				      =			num_attention_heads
          UpperCAmelCase__      :  Optional[Any]				      =			hidden_dropout
          UpperCAmelCase__      :  List[str]				      =			attention_dropout
          UpperCAmelCase__      :  Dict				      =			activation_dropout
          UpperCAmelCase__      :  List[str]				      =			feat_proj_dropout
          UpperCAmelCase__      :  Any				      =			final_dropout
          UpperCAmelCase__      :  Optional[int]				      =			layerdrop
          UpperCAmelCase__      :  str				      =			layer_norm_eps
          UpperCAmelCase__      :  Dict				      =			initializer_range
          UpperCAmelCase__      :  int				      =			num_ctc_classes
          UpperCAmelCase__      :  Any				      =			vocab_size
          UpperCAmelCase__      :  List[str]				      =			do_stable_layer_norm
          UpperCAmelCase__      :  Any				      =			use_weighted_layer_sum
          UpperCAmelCase__      :  Any				      =			classifier_proj_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)`, 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
          UpperCAmelCase__      :  Any				      =			apply_spec_augment
          UpperCAmelCase__      :  List[Any]				      =			mask_time_prob
          UpperCAmelCase__      :  List[Any]				      =			mask_time_length
          UpperCAmelCase__      :  Tuple				      =			mask_time_min_masks
          UpperCAmelCase__      :  Optional[int]				      =			mask_feature_prob
          UpperCAmelCase__      :  List[str]				      =			mask_feature_length
          UpperCAmelCase__      :  Optional[Any]				      =			mask_feature_min_masks

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

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

          # pretraining loss
          UpperCAmelCase__      :  Union[str, Any]				      =			replace_prob




     @property
     def   __UpperCAmelCase  (				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


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

UpperCamelCase__  :						str					=      {
    '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 					_lowercase						(   lowerCAmelCase ):
      '''simple docstring'''


      UpperCAmelCase_   :   Dict   				= '''camembert'''




      def __init__(					self       ,lowerCamelCase_=30522       ,lowerCamelCase_=768       ,lowerCamelCase_=12       ,lowerCamelCase_=12       ,lowerCamelCase_=3072       ,lowerCamelCase_="gelu"       ,lowerCamelCase_=0.1       ,lowerCamelCase_=0.1       ,lowerCamelCase_=512       ,lowerCamelCase_=2       ,lowerCamelCase_=0.02       ,lowerCamelCase_=1e-12       ,lowerCamelCase_=1       ,lowerCamelCase_=0       ,lowerCamelCase_=2       ,lowerCamelCase_="absolute"       ,lowerCamelCase_=True       ,lowerCamelCase_=None       ,**lowerCamelCase_       ,)      ->      str:



         '''simple docstring'''



         super().__init__(pad_token_id=lowerCamelCase_       ,bos_token_id=lowerCamelCase_       ,eos_token_id=lowerCamelCase_       ,**lowerCamelCase_				)

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




class 					_lowercase						(   lowerCAmelCase ):
      '''simple docstring'''


      @property
      def 		lowerCAmelCase__       (					self				)      ->      Mapping[str, Mapping[int, str]]:



         '''simple docstring'''



         if self.task == "multiple-choice":
            UpperCAmelCase__				:					Tuple 					=	{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
         else:
            UpperCAmelCase__				:					Union[str, Any] 					=	{0: '''batch''', 1: '''sequence'''}
         return OrderedDict(
             [
                 ('''input_ids''', dynamic_axis),
                 ('''attention_mask''', dynamic_axis),
             ]				)




