


"""simple docstring"""



import functools
import operator

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


UpperCAmelCase      		=			logging.get_logger(__name__)

UpperCAmelCase      		=			{
    '''microsoft/wavlm-base''': '''https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json''',
    # See all WavLM models at https://huggingface.co/models?filter=wavlm
}
class 					__magic_name__		(			__UpperCAmelCase     ):
       __A			:      Union[str, Any]        =   "wavlm"






       def __init__(   self  :    List[str]  ,     snake_case__  :    List[str]=3_2  ,     snake_case__  :    str=7_6_8  ,     snake_case__  :    Dict=1_2  ,     snake_case__  :    List[str]=1_2  ,     snake_case__  :    Optional[int]=3_0_7_2  ,     snake_case__  :    str="gelu"  ,     snake_case__  :    List[str]=0.1  ,     snake_case__  :    Tuple=0.1  ,     snake_case__  :    int=0.1  ,     snake_case__  :    Any=0.0  ,     snake_case__  :    List[Any]=0.1  ,     snake_case__  :    Any=0.1  ,     snake_case__  :    List[str]=0.02  ,     snake_case__  :    Optional[int]=1e-5  ,     snake_case__  :    Union[str, Any]="group"  ,     snake_case__  :    int="gelu"  ,     snake_case__  :    List[str]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)  ,     snake_case__  :    Optional[Any]=(5, 2, 2, 2, 2, 2, 2)  ,     snake_case__  :    Tuple=(1_0, 3, 3, 3, 3, 2, 2)  ,     snake_case__  :    Optional[int]=False  ,     snake_case__  :    List[Any]=1_2_8  ,     snake_case__  :    List[str]=1_6  ,     snake_case__  :    Optional[Any]=3_2_0  ,     snake_case__  :    str=8_0_0  ,     snake_case__  :    Optional[int]=False  ,     snake_case__  :    Optional[int]=True  ,     snake_case__  :    Optional[Any]=0.05  ,     snake_case__  :    List[str]=1_0  ,     snake_case__  :    Any=2  ,     snake_case__  :    Any=0.0  ,     snake_case__  :    Dict=1_0  ,     snake_case__  :    List[Any]=3_2_0  ,     snake_case__  :    Tuple=2  ,     snake_case__  :    Tuple=0.1  ,     snake_case__  :    str=1_0_0  ,     snake_case__  :    Optional[Any]=2_5_6  ,     snake_case__  :    Optional[int]=2_5_6  ,     snake_case__  :    List[Any]=0.1  ,     snake_case__  :    Union[str, Any]="mean"  ,     snake_case__  :    List[str]=False  ,     snake_case__  :    int=False  ,     snake_case__  :    Optional[int]=2_5_6  ,     snake_case__  :    List[str]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)  ,     snake_case__  :    str=(5, 3, 3, 1, 1)  ,     snake_case__  :    Optional[int]=(1, 2, 3, 1, 1)  ,     snake_case__  :    Optional[Any]=5_1_2  ,     snake_case__  :    Dict=8_0  ,     snake_case__  :    Any=0  ,     snake_case__  :    Dict=1  ,     snake_case__  :    List[Any]=2  ,     snake_case__  :    Union[str, Any]=False  ,     snake_case__  :    Union[str, Any]=3  ,     snake_case__  :    Optional[int]=2  ,     snake_case__  :    Dict=3  ,     snake_case__  :    Optional[Any]=None  ,     **snake_case__  :    int  ,     ):

              '''simple docstring'''






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

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

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

              # adapter
              lowercase		:Dict       							=				add_adapter
              lowercase		:Optional[Any]       							=				adapter_kernel_size
              lowercase		:List[str]       							=				adapter_stride
              lowercase		:Tuple       							=				num_adapter_layers
              lowercase		:Tuple       							=				output_hidden_size or hidden_size

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

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







       @property
       def  __snake_case						(   self  :    Dict				):

              '''simple docstring'''






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





"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


UpperCAmelCase      		=			{
    '''configuration_xlm_roberta''': [
        '''XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''XLMRobertaConfig''',
        '''XLMRobertaOnnxConfig''',
    ],
}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=			['''XLMRobertaTokenizer''']

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=			['''XLMRobertaTokenizerFast''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=			[
     '''XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''XLMRobertaForCausalLM''',
     '''XLMRobertaForMaskedLM''',
     '''XLMRobertaForMultipleChoice''',
     '''XLMRobertaForQuestionAnswering''',
     '''XLMRobertaForSequenceClassification''',
     '''XLMRobertaForTokenClassification''',
     '''XLMRobertaModel''',
     '''XLMRobertaPreTrainedModel''',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=			[
     '''TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''TFXLMRobertaForCausalLM''',
     '''TFXLMRobertaForMaskedLM''',
     '''TFXLMRobertaForMultipleChoice''',
     '''TFXLMRobertaForQuestionAnswering''',
     '''TFXLMRobertaForSequenceClassification''',
     '''TFXLMRobertaForTokenClassification''',
     '''TFXLMRobertaModel''',
     '''TFXLMRobertaPreTrainedModel''',
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 UpperCAmelCase      		=			[
     '''FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''FlaxXLMRobertaForMaskedLM''',
     '''FlaxXLMRobertaForCausalLM''',
     '''FlaxXLMRobertaForMultipleChoice''',
     '''FlaxXLMRobertaForQuestionAnswering''',
     '''FlaxXLMRobertaForSequenceClassification''',
     '''FlaxXLMRobertaForTokenClassification''',
     '''FlaxXLMRobertaModel''',
     '''FlaxXLMRobertaPreTrainedModel''',
 ]

if TYPE_CHECKING:
 from .configuration_xlm_roberta import (
     XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
     XLMRobertaConfig,
     XLMRobertaOnnxConfig,
 )

 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_xlm_roberta import XLMRobertaTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_xlm_roberta_fast import XLMRobertaTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_xlm_roberta import (
      XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
      XLMRobertaForCausalLM,
      XLMRobertaForMaskedLM,
      XLMRobertaForMultipleChoice,
      XLMRobertaForQuestionAnswering,
      XLMRobertaForSequenceClassification,
      XLMRobertaForTokenClassification,
      XLMRobertaModel,
      XLMRobertaPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_xlm_roberta import (
      TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFXLMRobertaForCausalLM,
      TFXLMRobertaForMaskedLM,
      TFXLMRobertaForMultipleChoice,
      TFXLMRobertaForQuestionAnswering,
      TFXLMRobertaForSequenceClassification,
      TFXLMRobertaForTokenClassification,
      TFXLMRobertaModel,
      TFXLMRobertaPreTrainedModel,
  )

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_xlm_roberta import (
      FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
      FlaxXLMRobertaForCausalLM,
      FlaxXLMRobertaForMaskedLM,
      FlaxXLMRobertaForMultipleChoice,
      FlaxXLMRobertaForQuestionAnswering,
      FlaxXLMRobertaForSequenceClassification,
      FlaxXLMRobertaForTokenClassification,
      FlaxXLMRobertaModel,
      FlaxXLMRobertaPreTrainedModel,
  )

else:
 import sys

 UpperCAmelCase      		=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

