




'''simple docstring'''


import functools
import operator

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


lowerCAmelCase_      :  Optional[Any]				     =  logging.get_logger(__name__)

lowerCAmelCase_      :  List[Any]				     =  {
    '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      SCREAMING_SNAKE_CASE    (						snake_case_				):
      __magic_name__  :       Union[str, Any]   							=					'''wavlm'''






      def __init__( self   :  str						,						lowercase__   :  Tuple=32						,						lowercase__   :  int=768						,						lowercase__   :  Optional[Any]=12						,						lowercase__   :  Union[str, Any]=12						,						lowercase__   :  List[str]=3072						,						lowercase__   :  str="gelu"						,						lowercase__   :  Union[str, Any]=0.1						,						lowercase__   :  Optional[Any]=0.1						,						lowercase__   :  Optional[Any]=0.1						,						lowercase__   :  Any=0.0						,						lowercase__   :  int=0.1						,						lowercase__   :  Any=0.1						,						lowercase__   :  Optional[int]=0.02						,						lowercase__   :  List[Any]=1e-5						,						lowercase__   :  Optional[int]="group"						,						lowercase__   :  int="gelu"						,						lowercase__   :  int=(512, 512, 512, 512, 512, 512, 512)						,						lowercase__   :  List[str]=(5, 2, 2, 2, 2, 2, 2)						,						lowercase__   :  List[str]=(10, 3, 3, 3, 3, 2, 2)						,						lowercase__   :  int=False						,						lowercase__   :  List[str]=128						,						lowercase__   :  Tuple=16						,						lowercase__   :  Dict=320						,						lowercase__   :  str=800						,						lowercase__   :  Any=False						,						lowercase__   :  Dict=True						,						lowercase__   :  Any=0.05						,						lowercase__   :  Optional[Any]=10						,						lowercase__   :  List[str]=2						,						lowercase__   :  int=0.0						,						lowercase__   :  Dict=10						,						lowercase__   :  str=320						,						lowercase__   :  str=2						,						lowercase__   :  Any=0.1						,						lowercase__   :  List[str]=100						,						lowercase__   :  str=256						,						lowercase__   :  Union[str, Any]=256						,						lowercase__   :  List[str]=0.1						,						lowercase__   :  Union[str, Any]="mean"						,						lowercase__   :  Any=False						,						lowercase__   :  Any=False						,						lowercase__   :  List[Any]=256						,						lowercase__   :  Optional[int]=(512, 512, 512, 512, 1500)						,						lowercase__   :  Tuple=(5, 3, 3, 1, 1)						,						lowercase__   :  List[str]=(1, 2, 3, 1, 1)						,						lowercase__   :  int=512						,						lowercase__   :  Dict=80						,						lowercase__   :  Dict=0						,						lowercase__   :  str=1						,						lowercase__   :  int=2						,						lowercase__   :  List[Any]=False						,						lowercase__   :  List[Any]=3						,						lowercase__   :  str=2						,						lowercase__   :  str=3						,						lowercase__   :  Tuple=None						,						**lowercase__   :  Dict						,						):


           '''simple docstring'''

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

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

           # ctc loss
           a_     :							Dict     						=  ctc_loss_reduction
           a_     :							List[Any]     						=  ctc_zero_infinity

           # adapter
           a_     :							Optional[Any]     						=  add_adapter
           a_     :							Union[str, Any]     						=  adapter_kernel_size
           a_     :							Dict     						=  adapter_stride
           a_     :							List[Any]     						=  num_adapter_layers
           a_     :							int     						=  output_hidden_size or hidden_size

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

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






      @property
      def 							lowercase_						( 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_tf_available,
    is_torch_available,
    is_vision_available,
)


lowerCAmelCase_      :  Optional[Any]				     =  {
    'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileViTConfig', 'MobileViTOnnxConfig'],
}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_      :  int				     =  ['MobileViTFeatureExtractor']
 lowerCAmelCase_      :  int				     =  ['MobileViTImageProcessor']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_      :  str				     =  [
     'MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST',
     'MobileViTForImageClassification',
     'MobileViTForSemanticSegmentation',
     'MobileViTModel',
     'MobileViTPreTrainedModel',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCAmelCase_      :  Optional[Any]				     =  [
     'TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TFMobileViTForImageClassification',
     'TFMobileViTForSemanticSegmentation',
     'TFMobileViTModel',
     'TFMobileViTPreTrainedModel',
 ]

if TYPE_CHECKING:
 from .configuration_mobilevit import MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileViTConfig, MobileViTOnnxConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_mobilevit import MobileViTFeatureExtractor
  from .image_processing_mobilevit import MobileViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_mobilevit import (
      MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      MobileViTForImageClassification,
      MobileViTForSemanticSegmentation,
      MobileViTModel,
      MobileViTPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_mobilevit import (
      TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFMobileViTForImageClassification,
      TFMobileViTForSemanticSegmentation,
      TFMobileViTModel,
      TFMobileViTPreTrainedModel,
  )


else:
 import sys

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