


import functools
import operator

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


lowerCamelCase_       :       List[Any]      						=  logging.get_logger(__name__)

lowerCamelCase_       :       Dict      						=  {
    '''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 				__A    (	SCREAMING_SNAKE_CASE_      ):






 """simple docstring"""




 __lowerCAmelCase			 =  "wavlm"


 def __init__(		self			,   __A=32			,   __A=768			,   __A=12			,   __A=12			,   __A=3072			,   __A="gelu"			,   __A=0.1			,   __A=0.1			,   __A=0.1			,   __A=0.0			,   __A=0.1			,   __A=0.1			,   __A=0.02			,   __A=1E-5			,   __A="group"			,   __A="gelu"			,   __A=(512, 512, 512, 512, 512, 512, 512)			,   __A=(5, 2, 2, 2, 2, 2, 2)			,   __A=(10, 3, 3, 3, 3, 2, 2)			,   __A=False			,   __A=128			,   __A=16			,   __A=320			,   __A=800			,   __A=False			,   __A=True			,   __A=0.05			,   __A=10			,   __A=2			,   __A=0.0			,   __A=10			,   __A=320			,   __A=2			,   __A=0.1			,   __A=100			,   __A=256			,   __A=256			,   __A=0.1			,   __A="mean"			,   __A=False			,   __A=False			,   __A=256			,   __A=(512, 512, 512, 512, 1500)			,   __A=(5, 3, 3, 1, 1)			,   __A=(1, 2, 3, 1, 1)			,   __A=512			,   __A=80			,   __A=0			,   __A=1			,   __A=2			,   __A=False			,   __A=3			,   __A=2			,   __A=3			,   __A=None			,   **__A			,   ) ->					List[Any]:
     super().__init__(**__a			,   pad_token_id=__a			,   bos_token_id=__a			,   eos_token_id=__a						)
     a					=hidden_size
     a					=feat_extract_norm
     a					=feat_extract_activation
     a					=list(__a						)
     a					=list(__a						)
     a					=list(__a						)
     a					=conv_bias
     a					=num_buckets
     a					=max_bucket_distance
     a					=num_conv_pos_embeddings
     a					=num_conv_pos_embedding_groups
     a					=len(self.conv_dim						)
     a					=num_hidden_layers
     a					=intermediate_size
     a					=hidden_act
     a					=num_attention_heads
     a					=hidden_dropout
     a					=attention_dropout
     a					=activation_dropout
     a					=feat_proj_dropout
     a					=final_dropout
     a					=layerdrop
     a					=layer_norm_eps
     a					=initializer_range
     a					=num_ctc_classes
     a					=vocab_size
     a					=do_stable_layer_norm
     a					=use_weighted_layer_sum
     a					=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					=apply_spec_augment
     a					=mask_time_prob
     a					=mask_time_length
     a					=mask_time_min_masks
     a					=mask_feature_prob
     a					=mask_feature_length

     # parameters for pretraining with codevector quantized representations
     a					=num_codevectors_per_group
     a					=num_codevector_groups
     a					=contrastive_logits_temperature
     a					=num_negatives
     a					=codevector_dim
     a					=proj_codevector_dim
     a					=diversity_loss_weight

     # ctc loss
     a					=ctc_loss_reduction
     a					=ctc_zero_infinity

     # adapter
     a					=add_adapter
     a					=adapter_kernel_size
     a					=adapter_stride
     a					=num_adapter_layers
     a					=output_hidden_size or hidden_size

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

     # XVector-specific parameters. Feel free to ignore for other classes.
     a					=list(__a						)
     a					=list(__a						)
     a					=list(__a						)
     a					=xvector_output_dim





 @property
 def 				SCREAMING_SNAKE_CASE							(		self						) ->					str:
     return functools.reduce(operator.mul			,   self.conv_stride			,   1						)



"""simple docstring"""







from typing import TYPE_CHECKING

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


lowerCamelCase_       :       Union[str, Any]      						=  {"""processing_layoutxlm""": ["""LayoutXLMProcessor"""]}

try:
       if not is_sentencepiece_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       lowerCamelCase_       :       Optional[int]      						=  ["""LayoutXLMTokenizer"""]

try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       lowerCamelCase_       :       Dict      						=  ["""LayoutXLMTokenizerFast"""]

if TYPE_CHECKING:
       from .processing_layoutxlm import LayoutXLMProcessor

       try:
              if not is_sentencepiece_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_layoutxlm import LayoutXLMTokenizer

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_layoutxlm_fast import LayoutXLMTokenizerFast

else:
       import sys

       lowerCamelCase_       :       Union[str, Any]      						=  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)