"""simple docstring"""
import math

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


SCREAMING_SNAKE_CASE__					  =     logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__					  =     {
    """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_			(	__snake_case    ):



				"""simple docstring"""
				_lowerCAmelCase   :			Any	     =  'data2vec-audio'

				def __init__( self						,			lowerCAmelCase=32						,			lowerCAmelCase=7_68						,			lowerCAmelCase=12						,			lowerCAmelCase=12						,			lowerCAmelCase=30_72						,			lowerCAmelCase="gelu"						,			lowerCAmelCase=0.1						,			lowerCAmelCase=0.1						,			lowerCAmelCase=0.1						,			lowerCAmelCase=0.0						,			lowerCAmelCase=0.1						,			lowerCAmelCase=0.1						,			lowerCAmelCase=0.02						,			lowerCAmelCase=1E-5						,			lowerCAmelCase="gelu"						,			lowerCAmelCase=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)						,			lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)						,			lowerCAmelCase=(10, 3, 3, 3, 3, 2, 2)						,			lowerCAmelCase=False						,			lowerCAmelCase=16						,			lowerCAmelCase=19						,			lowerCAmelCase=5						,			lowerCAmelCase=0.05						,			lowerCAmelCase=10						,			lowerCAmelCase=2						,			lowerCAmelCase=0.0						,			lowerCAmelCase=10						,			lowerCAmelCase=0						,			lowerCAmelCase="sum"						,			lowerCAmelCase=False						,			lowerCAmelCase=False						,			lowerCAmelCase=2_56						,			lowerCAmelCase=(5_12, 5_12, 5_12, 5_12, 15_00)						,			lowerCAmelCase=(5, 3, 3, 1, 1)						,			lowerCAmelCase=(1, 2, 3, 1, 1)						,			lowerCAmelCase=5_12						,			lowerCAmelCase=0						,			lowerCAmelCase=1						,			lowerCAmelCase=2						,			lowerCAmelCase=False						,			lowerCAmelCase=3						,			lowerCAmelCase=2						,			lowerCAmelCase=3						,			lowerCAmelCase=None						,			**lowerCAmelCase						,			):






										"""simple docstring"""

										super().__init__(**A_						,			pad_token_id=A_						,			bos_token_id=A_						,			eos_token_id=A_			)
										snake_case	    =	hidden_size
										snake_case	    =	feat_extract_activation
										snake_case	    =	list(A_			)
										snake_case	    =	list(A_			)
										snake_case	    =	list(A_			)
										snake_case	    =	conv_bias
										snake_case	    =	num_conv_pos_embeddings
										snake_case	    =	num_conv_pos_embedding_groups
										snake_case	    =	conv_pos_kernel_size
										snake_case	    =	len(self.conv_dim			)
										snake_case	    =	num_hidden_layers
										snake_case	    =	intermediate_size
										snake_case	    =	hidden_act
										snake_case	    =	num_attention_heads
										snake_case	    =	hidden_dropout
										snake_case	    =	attention_dropout
										snake_case	    =	activation_dropout
										snake_case	    =	feat_proj_dropout
										snake_case	    =	final_dropout
										snake_case	    =	layerdrop
										snake_case	    =	layer_norm_eps
										snake_case	    =	initializer_range
										snake_case	    =	vocab_size
										snake_case	    =	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
										snake_case	    =	mask_time_prob
										snake_case	    =	mask_time_length
										snake_case	    =	mask_time_min_masks
										snake_case	    =	mask_feature_prob
										snake_case	    =	mask_feature_length
										snake_case	    =	mask_feature_min_masks

										# ctc loss
										snake_case	    =	ctc_loss_reduction
										snake_case	    =	ctc_zero_infinity

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

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

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

				@property
				def 						snake_case       ( self			):






										"""simple docstring"""

										return math.prod(self.conv_stride			)









from typing import TYPE_CHECKING

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


__lowerCamelCase       :     Any   =     {
    """configuration_electra""": ["""ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ElectraConfig""", """ElectraOnnxConfig"""],
    """tokenization_electra""": ["""ElectraTokenizer"""],
}

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

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase       :     Tuple   =     [
        """ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """ElectraForCausalLM""",
        """ElectraForMaskedLM""",
        """ElectraForMultipleChoice""",
        """ElectraForPreTraining""",
        """ElectraForQuestionAnswering""",
        """ElectraForSequenceClassification""",
        """ElectraForTokenClassification""",
        """ElectraModel""",
        """ElectraPreTrainedModel""",
        """load_tf_weights_in_electra""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase       :     List[Any]   =     [
        """TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TFElectraForMaskedLM""",
        """TFElectraForMultipleChoice""",
        """TFElectraForPreTraining""",
        """TFElectraForQuestionAnswering""",
        """TFElectraForSequenceClassification""",
        """TFElectraForTokenClassification""",
        """TFElectraModel""",
        """TFElectraPreTrainedModel""",
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase       :     List[str]   =     [
        """FlaxElectraForCausalLM""",
        """FlaxElectraForMaskedLM""",
        """FlaxElectraForMultipleChoice""",
        """FlaxElectraForPreTraining""",
        """FlaxElectraForQuestionAnswering""",
        """FlaxElectraForSequenceClassification""",
        """FlaxElectraForTokenClassification""",
        """FlaxElectraModel""",
        """FlaxElectraPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig, ElectraOnnxConfig
    from .tokenization_electra import ElectraTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_electra_fast import ElectraTokenizerFast

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_electra import (
            ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            ElectraForCausalLM,
            ElectraForMaskedLM,
            ElectraForMultipleChoice,
            ElectraForPreTraining,
            ElectraForQuestionAnswering,
            ElectraForSequenceClassification,
            ElectraForTokenClassification,
            ElectraModel,
            ElectraPreTrainedModel,
            load_tf_weights_in_electra,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_electra import (
            TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFElectraForMaskedLM,
            TFElectraForMultipleChoice,
            TFElectraForPreTraining,
            TFElectraForQuestionAnswering,
            TFElectraForSequenceClassification,
            TFElectraForTokenClassification,
            TFElectraModel,
            TFElectraPreTrainedModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_electra import (
            FlaxElectraForCausalLM,
            FlaxElectraForMaskedLM,
            FlaxElectraForMultipleChoice,
            FlaxElectraForPreTraining,
            FlaxElectraForQuestionAnswering,
            FlaxElectraForSequenceClassification,
            FlaxElectraForTokenClassification,
            FlaxElectraModel,
            FlaxElectraPreTrainedModel,
        )

else:
    import sys

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