


import functools
import operator

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


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

snake_case				:    Optional[int]       				=     {
    '''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 		_snake_case  (      _snake_case							):
 SCREAMING_SNAKE_CASE__      =       'unispeech-sat'




 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.02					,  _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.05					,  _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=(512, 512, 512, 512, 1500)					,  _lowerCamelCase=(5, 3, 3, 1, 1)					,  _lowerCamelCase=(1, 2, 3, 1, 1)					,  _lowerCamelCase=512					,  _lowerCamelCase=0					,  _lowerCamelCase=1					,  _lowerCamelCase=2					,  _lowerCamelCase=504					,  **_lowerCamelCase					,  ):
       super().__init__(**_lowerCamelCase					,  pad_token_id=_lowerCamelCase					,  bos_token_id=_lowerCamelCase					,  eos_token_id=_lowerCamelCase    )
       a						:List[Any] 							=       hidden_size
       a						:Dict 							=       feat_extract_norm
       a						:List[Any] 							=       feat_extract_activation
       a						:List[Any] 							=       list(_lowerCamelCase    )
       a						:Optional[int] 							=       list(_lowerCamelCase    )
       a						:List[str] 							=       list(_lowerCamelCase    )
       a						:Optional[int] 							=       conv_bias
       a						:Any 							=       num_conv_pos_embeddings
       a						:Any 							=       num_conv_pos_embedding_groups
       a						:int 							=       len(self.conv_dim    )
       a						:str 							=       num_hidden_layers
       a						:Dict 							=       intermediate_size
       a						:Optional[Any] 							=       hidden_act
       a						:List[str] 							=       num_attention_heads
       a						:Dict 							=       hidden_dropout
       a						:Union[str, Any] 							=       attention_dropout
       a						:List[Any] 							=       activation_dropout
       a						:str 							=       feat_proj_dropout
       a						:Union[str, Any] 							=       final_dropout
       a						:List[str] 							=       layerdrop
       a						:Dict 							=       layer_norm_eps
       a						:Any 							=       initializer_range
       a						:Optional[int] 							=       vocab_size
       a						:int 							=       num_clusters
       a						:List[str] 							=       do_stable_layer_norm
       a						:List[str] 							=       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
       a						:List[Any] 							=       apply_spec_augment
       a						:Tuple 							=       mask_time_prob
       a						:List[Any] 							=       mask_time_length
       a						:Dict 							=       mask_time_min_masks
       a						:Optional[int] 							=       mask_feature_prob
       a						:List[Any] 							=       mask_feature_length
       a						:Any 							=       mask_feature_min_masks

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

       # ctc loss
       a						:Any 							=       ctc_loss_reduction
       a						:str 							=       ctc_zero_infinity

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

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




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









import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

snake_case				:    Union[str, Any]       				=     '''python tqdm regex requests packaging filelock numpy tokenizers'''.split()
if sys.version_info < (3, 7):
     pkgs_to_check_at_runtime.append('''dataclasses''')
if sys.version_info < (3, 8):
     pkgs_to_check_at_runtime.append('''importlib_metadata''')

for pkg in pkgs_to_check_at_runtime:
     if pkg in deps:
          if pkg == "tokenizers":
               # must be loaded here, or else tqdm check may fail
               from .utils import is_tokenizers_available

               if not is_tokenizers_available():
                    continue  # not required, check version only if installed

          require_version_core(deps[pkg])
     else:
          raise ValueError(F"""can't find {pkg} in {deps.keys()}, check dependency_versions_table.py""")
def 				__lowerCamelCase						( UpperCAmelCase_						:		Any ,  UpperCAmelCase_						:		Optional[int]=None						):




      """simple docstring"""





      require_version(deps[pkg] ,  UpperCAmelCase_						)





