


import copy
import re





class   SCREAMING_SNAKE_CASE_			:




       '''simple docstring'''



       _a   							=							"hp"
       _a   							=							{}
       _a   							=							None



       @classmethod
       def 				_lowerCAmelCase							(						cls				:				List[str]		,				__a				:				Dict		,				__a				:				List[str]							)					->Tuple:
          lowerCamelCase_						:   Optional[Any]		= prefix
          lowerCamelCase_						:   str		= defaults
          cls.build_naming_info()



       @staticmethod
       def 				_lowerCAmelCase							(						__a				:				Any		,				__a				:				Any							)					->Optional[int]:
          if len(__a							) == 0:
             return ""
          lowerCamelCase_						:   List[Any]		= None
          if any(char.isdigit() for char in word							):
             raise Exception(F'''Parameters should not contain numbers: \'{word}\' contains a number'''							)
          if word in info["short_word"]:
             return info["short_word"][word]
          for prefix_len in range(1		,				len(__a							) + 1							):
             lowerCamelCase_						:   Union[str, Any]		= word[:prefix_len]
             if prefix in info["reverse_short_word"]:
                continue
             else:
                lowerCamelCase_						:   Dict		= prefix
                break

          if short_word is None:
             # Paranoid fallback
             def int_to_alphabetic(__a				:				Union[str, Any]							):
                lowerCamelCase_						:   Any		= """"""
                while integer != 0:
                   lowerCamelCase_						:   Union[str, Any]		= chr(ord("""A"""							) + integer % 10							) + s
                   integer //= 10
                return s

             lowerCamelCase_						:   List[Any]		= 0
             while True:
                lowerCamelCase_						:   Optional[int]		= word + """#""" + int_to_alphabetic(__a							)
                if sword in info["reverse_short_word"]:
                   continue
                else:
                   lowerCamelCase_						:   Optional[Any]		= sword
                   break

          lowerCamelCase_						:   Optional[Any]		= short_word
          lowerCamelCase_						:   str		= word
          return short_word



       @staticmethod
       def 				_lowerCAmelCase							(						__a				:				Optional[int]		,				__a				:				Union[str, Any]							)					->Union[str, Any]:
          lowerCamelCase_						:   Dict		= param_name.split("""_"""							)

          lowerCamelCase_						:   Optional[Any]		= [TrialShortNamer.shortname_for_word(__a		,				__a							) for word in words]

          # We try to create a separatorless short name, but if there is a collision we have to fallback
          # to a separated short name
          lowerCamelCase_						:   int		= ["""""", """_"""]

          for separator in separators:
             lowerCamelCase_						:   Optional[Any]		= separator.join(__a							)
             if shortname not in info["reverse_short_param"]:
                lowerCamelCase_						:   List[Any]		= shortname
                lowerCamelCase_						:   Dict		= param_name
                return shortname

          return param_name



       @staticmethod
       def 				_lowerCAmelCase							(						__a				:				Optional[Any]		,				__a				:				Any							)					->Optional[Any]:
          lowerCamelCase_						:   Tuple		= TrialShortNamer.shortname_for_key(__a		,				__a							)
          lowerCamelCase_						:   Any		= short_name
          lowerCamelCase_						:   List[Any]		= param_name



       @classmethod
       def 				_lowerCAmelCase							(						cls				:				List[str]							)					->Dict:
          if cls.NAMING_INFO is not None:
             return

          lowerCamelCase_						:   Tuple		= {
              """short_word""": {},
              """reverse_short_word""": {},
              """short_param""": {},
              """reverse_short_param""": {},
          }

          lowerCamelCase_						:   Tuple		= list(cls.DEFAULTS.keys()							)

          for k in field_keys:
             cls.add_new_param_name(__a		,				__a							)

          lowerCamelCase_						:   Union[str, Any]		= info



       @classmethod
       def 				_lowerCAmelCase							(						cls				:				str		,				__a				:				Optional[Any]							)					->List[str]:
          cls.build_naming_info()
          assert cls.PREFIX is not None
          lowerCamelCase_						:   Tuple		= [copy.copy(cls.PREFIX							)]

          for k, v in params.items():
             if k not in cls.DEFAULTS:
                raise Exception(F'''You should provide a default value for the param name {k} with value {v}'''							)
             if v == cls.DEFAULTS[k]:
                # The default value is not added to the name
                continue

             lowerCamelCase_						:   Optional[Any]		= cls.NAMING_INFO["""short_param"""][k]

             if isinstance(__a		,				__a							):
                lowerCamelCase_						:   Any		= 1 if v else 0

             lowerCamelCase_						:   Union[str, Any]		= """""" if isinstance(__a		,				(int, float)							) else """-"""
             lowerCamelCase_						:   Optional[int]		= F'''{key}{sep}{v}'''
             name.append(__a							)

          return "_".join(__a							)




       @classmethod
       def 				_lowerCAmelCase							(						cls				:				Union[str, Any]		,				__a				:				Dict							)					->Any:
          lowerCamelCase_						:   Tuple		= repr[len(cls.PREFIX							) + 1 :]
          if repr == "":
             lowerCamelCase_						:   List[str]		= []
          else:
             lowerCamelCase_						:   Optional[int]		= repr.split("""_"""							)

          lowerCamelCase_						:   Optional[int]		= {}

          for value in values:
             if "-" in value:
                lowerCamelCase_,	lowerCamelCase_						:   int		= value.split("""-"""							)
             else:
                lowerCamelCase_						:   Any		= re.sub("""[0-9.]"""		,				""""""		,				__a							)
                lowerCamelCase_						:   str		= float(re.sub("""[^0-9.]"""		,				""""""		,				__a							)							)

             lowerCamelCase_						:   Union[str, Any]		= cls.NAMING_INFO["""reverse_short_param"""][p_k]

             lowerCamelCase_						:   List[str]		= p_v

          for k in cls.DEFAULTS:
             if k not in parameters:
                lowerCamelCase_						:   Union[str, Any]		= cls.DEFAULTS[k]

          return parameters









import functools
import operator

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


snake_case__				:	Union[str, Any]					       =					logging.get_logger(__name__)

snake_case__				:	Tuple					       =					{
    'microsoft/unispeech-sat-base-100h-libri-ft': (
        'https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json'
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}





class   SCREAMING_SNAKE_CASE_			(a__						):




       '''simple docstring'''



       _a   							=							"unispeech-sat"



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

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

          # ctc loss
          lowerCamelCase_						:   Optional[int]		= ctc_loss_reduction
          lowerCamelCase_						:   int		= ctc_zero_infinity

          # SequenceClassification-specific parameter. Feel free to ignore for other classes.
          lowerCamelCase_						:   Dict		= classifier_proj_size

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




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





