





"""simple docstring"""





import functools
import operator

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


lowercase__				:int				   =       logging.get_logger(__name__)

lowercase__				:Optional[Any]				   =       {
    '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							(			lowercase__ ):

      '''simple docstring'''



      _A     :       Union[str, Any]         =       """unispeech-sat"""

      def __init__(							self       :      Union[str, Any]						,				__lowercase       :      str=32						,				__lowercase       :      Any=768						,				__lowercase       :      Tuple=12						,				__lowercase       :      List[str]=12						,				__lowercase       :      int=3_072						,				__lowercase       :      Optional[Any]="gelu"						,				__lowercase       :      Tuple=0.1						,				__lowercase       :      List[Any]=0.1						,				__lowercase       :      Optional[int]=0.1						,				__lowercase       :      Optional[Any]=0.0						,				__lowercase       :      Optional[Any]=0.0						,				__lowercase       :      List[str]=0.1						,				__lowercase       :      str=0.1						,				__lowercase       :      Optional[int]=0.0_2						,				__lowercase       :      Optional[int]=1e-5						,				__lowercase       :      Any="group"						,				__lowercase       :      Dict="gelu"						,				__lowercase       :      List[Any]=(512, 512, 512, 512, 512, 512, 512)						,				__lowercase       :      Dict=(5, 2, 2, 2, 2, 2, 2)						,				__lowercase       :      Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)						,				__lowercase       :      List[Any]=False						,				__lowercase       :      Union[str, Any]=128						,				__lowercase       :      Optional[int]=16						,				__lowercase       :      Union[str, Any]=False						,				__lowercase       :      Optional[int]=True						,				__lowercase       :      List[Any]=0.0_5						,				__lowercase       :      Any=10						,				__lowercase       :      Tuple=2						,				__lowercase       :      Optional[Any]=0.0						,				__lowercase       :      str=10						,				__lowercase       :      List[Any]=0						,				__lowercase       :      Dict=320						,				__lowercase       :      str=2						,				__lowercase       :      Optional[int]=0.1						,				__lowercase       :      int=100						,				__lowercase       :      Any=256						,				__lowercase       :      str=256						,				__lowercase       :      Tuple=0.1						,				__lowercase       :      Dict="mean"						,				__lowercase       :      Optional[Any]=False						,				__lowercase       :      Optional[Any]=False						,				__lowercase       :      Optional[Any]=256						,				__lowercase       :      Optional[int]=(512, 512, 512, 512, 1_500)						,				__lowercase       :      Optional[Any]=(5, 3, 3, 1, 1)						,				__lowercase       :      Optional[int]=(1, 2, 3, 1, 1)						,				__lowercase       :      Tuple=512						,				__lowercase       :      Tuple=0						,				__lowercase       :      str=1						,				__lowercase       :      Optional[Any]=2						,				__lowercase       :      List[str]=504						,				**__lowercase       :      Optional[int]						,				):


        '''simple docstring'''




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

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

        # ctc loss
        __UpperCAmelCase    :						Optional[Any]       =						ctc_loss_reduction
        __UpperCAmelCase    :						Optional[Any]       =						ctc_zero_infinity

        # SequenceClassification-specific parameter. Feel free to ignore for other classes.
        __UpperCAmelCase    :						Optional[Any]       =						classifier_proj_size

        # XVector-specific parameters. Feel free to ignore for other classes.
        __UpperCAmelCase    :						Any       =						list(__lowercase )
        __UpperCAmelCase    :						str       =						list(__lowercase )
        __UpperCAmelCase    :						Dict       =						list(__lowercase )
        __UpperCAmelCase    :						int       =						xvector_output_dim







      @property
      def       A_					(							self       :      List[str] ):


        '''simple docstring'''




        return functools.reduce(operator.mul						,				self.conv_stride						,				1 )










"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


lowercase__				:Tuple				   =       {
    'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'],
    'tokenization_xlm': ['XLMTokenizer'],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__				:Optional[Any]				   =       [
      'XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
      'XLMForMultipleChoice',
      'XLMForQuestionAnswering',
      'XLMForQuestionAnsweringSimple',
      'XLMForSequenceClassification',
      'XLMForTokenClassification',
      'XLMModel',
      'XLMPreTrainedModel',
      'XLMWithLMHeadModel',
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__				:List[Any]				   =       [
      'TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
      'TFXLMForMultipleChoice',
      'TFXLMForQuestionAnsweringSimple',
      'TFXLMForSequenceClassification',
      'TFXLMForTokenClassification',
      'TFXLMMainLayer',
      'TFXLMModel',
      'TFXLMPreTrainedModel',
      'TFXLMWithLMHeadModel',
  ]


if TYPE_CHECKING:
  from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
  from .tokenization_xlm import XLMTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_xlm import (
        XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        XLMForMultipleChoice,
        XLMForQuestionAnswering,
        XLMForQuestionAnsweringSimple,
        XLMForSequenceClassification,
        XLMForTokenClassification,
        XLMModel,
        XLMPreTrainedModel,
        XLMWithLMHeadModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_xlm import (
        TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFXLMForMultipleChoice,
        TFXLMForQuestionAnsweringSimple,
        TFXLMForSequenceClassification,
        TFXLMForTokenClassification,
        TFXLMMainLayer,
        TFXLMModel,
        TFXLMPreTrainedModel,
        TFXLMWithLMHeadModel,
    )

else:
  import sys

  lowercase__				:List[Any]				   =       _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)