
import math

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


lowerCamelCase      =logging.get_logger(__name__)

lowerCamelCase      ={
    "facebook/data2vec-base-960h": "https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json",
    # See all Data2VecAudio models at https://huggingface.co/models?filter=data2vec-audio
}
class 				_lowerCamelCase (      _UpperCAmelCase ):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		   =  '''data2vec-audio'''






     def __init__(							self						,						__SCREAMING_SNAKE_CASE=3_2						,						__SCREAMING_SNAKE_CASE=7_6_8						,						__SCREAMING_SNAKE_CASE=1_2						,						__SCREAMING_SNAKE_CASE=1_2						,						__SCREAMING_SNAKE_CASE=3_0_7_2						,						__SCREAMING_SNAKE_CASE="gelu"						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.0						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.1						,						__SCREAMING_SNAKE_CASE=0.02						,						__SCREAMING_SNAKE_CASE=1e-5						,						__SCREAMING_SNAKE_CASE="gelu"						,						__SCREAMING_SNAKE_CASE=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)						,						__SCREAMING_SNAKE_CASE=(5, 2, 2, 2, 2, 2, 2)						,						__SCREAMING_SNAKE_CASE=(1_0, 3, 3, 3, 3, 2, 2)						,						__SCREAMING_SNAKE_CASE=False						,						__SCREAMING_SNAKE_CASE=1_6						,						__SCREAMING_SNAKE_CASE=1_9						,						__SCREAMING_SNAKE_CASE=5						,						__SCREAMING_SNAKE_CASE=0.05						,						__SCREAMING_SNAKE_CASE=1_0						,						__SCREAMING_SNAKE_CASE=2						,						__SCREAMING_SNAKE_CASE=0.0						,						__SCREAMING_SNAKE_CASE=1_0						,						__SCREAMING_SNAKE_CASE=0						,						__SCREAMING_SNAKE_CASE="sum"						,						__SCREAMING_SNAKE_CASE=False						,						__SCREAMING_SNAKE_CASE=False						,						__SCREAMING_SNAKE_CASE=2_5_6						,						__SCREAMING_SNAKE_CASE=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)						,						__SCREAMING_SNAKE_CASE=(5, 3, 3, 1, 1)						,						__SCREAMING_SNAKE_CASE=(1, 2, 3, 1, 1)						,						__SCREAMING_SNAKE_CASE=5_1_2						,						__SCREAMING_SNAKE_CASE=0						,						__SCREAMING_SNAKE_CASE=1						,						__SCREAMING_SNAKE_CASE=2						,						__SCREAMING_SNAKE_CASE=False						,						__SCREAMING_SNAKE_CASE=3						,						__SCREAMING_SNAKE_CASE=2						,						__SCREAMING_SNAKE_CASE=3						,						__SCREAMING_SNAKE_CASE=None						,						**__SCREAMING_SNAKE_CASE						,						)  ->   List[str]:




           """simple docstring"""







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

           # ctc loss
           UpperCamelCase__    :   Any					=				ctc_loss_reduction
           UpperCamelCase__    :   Any					=				ctc_zero_infinity

           # adapter
           UpperCamelCase__    :   Any					=				add_adapter
           UpperCamelCase__    :   List[Any]					=				adapter_kernel_size
           UpperCamelCase__    :   str					=				adapter_stride
           UpperCamelCase__    :   List[str]					=				num_adapter_layers
           UpperCamelCase__    :   Any					=				output_hidden_size or hidden_size

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

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






     @property
     def    __SCREAMING_SNAKE_CASE			(							self  )  ->   int:




           """simple docstring"""







           return math.prod(self.conv_stride  )




from typing import TYPE_CHECKING

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


lowerCamelCase      ={
    "configuration_mobilebert": [
        "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "MobileBertConfig",
        "MobileBertOnnxConfig",
    ],
    "tokenization_mobilebert": ["MobileBertTokenizer"],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase      =["MobileBertTokenizerFast"]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase      =[
        "MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
        "MobileBertForMaskedLM",
        "MobileBertForMultipleChoice",
        "MobileBertForNextSentencePrediction",
        "MobileBertForPreTraining",
        "MobileBertForQuestionAnswering",
        "MobileBertForSequenceClassification",
        "MobileBertForTokenClassification",
        "MobileBertLayer",
        "MobileBertModel",
        "MobileBertPreTrainedModel",
        "load_tf_weights_in_mobilebert",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    lowerCamelCase      =[
        "TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST",
        "TFMobileBertForMaskedLM",
        "TFMobileBertForMultipleChoice",
        "TFMobileBertForNextSentencePrediction",
        "TFMobileBertForPreTraining",
        "TFMobileBertForQuestionAnswering",
        "TFMobileBertForSequenceClassification",
        "TFMobileBertForTokenClassification",
        "TFMobileBertMainLayer",
        "TFMobileBertModel",
        "TFMobileBertPreTrainedModel",
    ]


if TYPE_CHECKING:
    from .configuration_mobilebert import (
        MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
        MobileBertConfig,
        MobileBertOnnxConfig,
    )
    from .tokenization_mobilebert import MobileBertTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_mobilebert_fast import MobileBertTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_mobilebert import (
            MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
            MobileBertForMaskedLM,
            MobileBertForMultipleChoice,
            MobileBertForNextSentencePrediction,
            MobileBertForPreTraining,
            MobileBertForQuestionAnswering,
            MobileBertForSequenceClassification,
            MobileBertForTokenClassification,
            MobileBertLayer,
            MobileBertModel,
            MobileBertPreTrainedModel,
            load_tf_weights_in_mobilebert,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_mobilebert import (
            TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFMobileBertForMaskedLM,
            TFMobileBertForMultipleChoice,
            TFMobileBertForNextSentencePrediction,
            TFMobileBertForPreTraining,
            TFMobileBertForQuestionAnswering,
            TFMobileBertForSequenceClassification,
            TFMobileBertForTokenClassification,
            TFMobileBertMainLayer,
            TFMobileBertModel,
            TFMobileBertPreTrainedModel,
        )

else:
    import sys

    lowerCamelCase      =_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


