
import functools
import operator

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


lowercase_       :						str     					=	logging.get_logger(__name__)

lowercase_       :						Union[str, 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 			UpperCamelCase      (							UpperCAmelCase__  ):
     A__      =			"""wavlm"""
     def __init__(     self  ,     snake_case__=32  ,     snake_case__=768  ,     snake_case__=12  ,     snake_case__=12  ,     snake_case__=3072  ,     snake_case__="gelu"  ,     snake_case__=0.1  ,     snake_case__=0.1  ,     snake_case__=0.1  ,     snake_case__=0.0  ,     snake_case__=0.1  ,     snake_case__=0.1  ,     snake_case__=0.02  ,     snake_case__=1E-5  ,     snake_case__="group"  ,     snake_case__="gelu"  ,     snake_case__=(512, 512, 512, 512, 512, 512, 512)  ,     snake_case__=(5, 2, 2, 2, 2, 2, 2)  ,     snake_case__=(10, 3, 3, 3, 3, 2, 2)  ,     snake_case__=False  ,     snake_case__=128  ,     snake_case__=16  ,     snake_case__=320  ,     snake_case__=800  ,     snake_case__=False  ,     snake_case__=True  ,     snake_case__=0.05  ,     snake_case__=10  ,     snake_case__=2  ,     snake_case__=0.0  ,     snake_case__=10  ,     snake_case__=320  ,     snake_case__=2  ,     snake_case__=0.1  ,     snake_case__=100  ,     snake_case__=256  ,     snake_case__=256  ,     snake_case__=0.1  ,     snake_case__="mean"  ,     snake_case__=False  ,     snake_case__=False  ,     snake_case__=256  ,     snake_case__=(512, 512, 512, 512, 1500)  ,     snake_case__=(5, 3, 3, 1, 1)  ,     snake_case__=(1, 2, 3, 1, 1)  ,     snake_case__=512  ,     snake_case__=80  ,     snake_case__=0  ,     snake_case__=1  ,     snake_case__=2  ,     snake_case__=False  ,     snake_case__=3  ,     snake_case__=2  ,     snake_case__=3  ,     snake_case__=None  ,     **snake_case__  ,     ):




       """simple docstring"""


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

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

       # ctc loss
       _SCREAMING_SNAKE_CASE   :				Optional[int]							    = ctc_loss_reduction
       _SCREAMING_SNAKE_CASE   :				Dict							    = ctc_zero_infinity

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

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

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




     @property
     def 				__SCREAMING_SNAKE_CASE							(     self				):




       """simple docstring"""


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





"""simple docstring"""
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse

from ...utils.dataclasses import (
    ComputeEnvironment,
    DistributedType,
    DynamoBackend,
    PrecisionType,
    SageMakerDistributedType,
)
from ..menu import BulletMenu


lowercase_       :						Tuple     					=	[
    '''EAGER''',
    '''AOT_EAGER''',
    '''INDUCTOR''',
    '''NVFUSER''',
    '''AOT_NVFUSER''',
    '''AOT_CUDAGRAPHS''',
    '''OFI''',
    '''FX2TRT''',
    '''ONNXRT''',
    '''IPEX''',
]





def    _lowerCAmelCase    (     lowerCamelCase__							:							Dict,						lowerCamelCase__							:							int=None,						lowerCamelCase__							:							Any=None,						lowerCamelCase__							:							Any=None				)  ->    Tuple:
  _SCREAMING_SNAKE_CASE   :				List[Any]							    = True
  while ask_again:
    _SCREAMING_SNAKE_CASE   :				List[str]							    = input(lowerCamelCase__				)
    try:
      if default is not None and len(lowerCamelCase__				) == 0:
        return default
      return convert_value(lowerCamelCase__				) if convert_value is not None else result
    except Exception:
      if error_message is not None:
        print(lowerCamelCase__				)





def    _lowerCAmelCase    (     lowerCamelCase__							:							Any,						lowerCamelCase__							:							Dict=[],						lowerCamelCase__							:							Optional[int]=None,						lowerCamelCase__							:							str=0				)  ->    str:
  _SCREAMING_SNAKE_CASE   :				int							    = BulletMenu(lowerCamelCase__,						lowerCamelCase__				)
  _SCREAMING_SNAKE_CASE   :				str							    = menu.run(default_choice=lowerCamelCase__				)
  return convert_value(lowerCamelCase__				) if convert_value is not None else result





def    _lowerCAmelCase    (     lowerCamelCase__							:							Optional[int]				)  ->    Optional[int]:
  _SCREAMING_SNAKE_CASE   :				str							    = int(lowerCamelCase__				)
  return ComputeEnvironment(["LOCAL_MACHINE", "AMAZON_SAGEMAKER"][value]				)





def    _lowerCAmelCase    (     lowerCamelCase__							:							str				)  ->    List[Any]:
  _SCREAMING_SNAKE_CASE   :				str							    = int(lowerCamelCase__				)
  return DistributedType(["NO", "MULTI_CPU", "MULTI_XPU", "MULTI_GPU", "MULTI_NPU", "TPU"][value]				)





def    _lowerCAmelCase    (     lowerCamelCase__							:							Optional[Any]				)  ->    List[Any]:
  _SCREAMING_SNAKE_CASE   :				List[Any]							    = int(lowerCamelCase__				)
  return DynamoBackend(DYNAMO_BACKENDS[value]				).value





def    _lowerCAmelCase    (     lowerCamelCase__							:							int				)  ->    Dict:
  _SCREAMING_SNAKE_CASE   :				int							    = int(lowerCamelCase__				)
  return PrecisionType(["no", "fp16", "bf16", "fp8"][value]				)





def    _lowerCAmelCase    (     lowerCamelCase__							:							List[Any]				)  ->    Any:
  _SCREAMING_SNAKE_CASE   :				Optional[Any]							    = int(lowerCamelCase__				)
  return SageMakerDistributedType(["NO", "DATA_PARALLEL", "MODEL_PARALLEL"][value]				)





def    _lowerCAmelCase    (     lowerCamelCase__							:							List[Any]				)  ->    Optional[Any]:
  return {"yes": True, "no": False}[value.lower()]





class 			UpperCamelCase      (							argparse.RawDescriptionHelpFormatter  ):
     def 				__SCREAMING_SNAKE_CASE							(     self  ,     snake_case__  ,     snake_case__  ,     snake_case__  ,     snake_case__				):




       """simple docstring"""


       _SCREAMING_SNAKE_CASE   :				Any							    = super()._format_usage(snake_case__  ,     snake_case__  ,     snake_case__  ,     snake_case__				)
       _SCREAMING_SNAKE_CASE   :				Any							    = usage.replace("<command> [<args>] "  ,     ""				)
       return usage



