



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   snake_case_ (lowercase__  ):




       """simple docstring"""






       _lowerCamelCase			    =				"""data2vec-audio"""



       def __init__(     self     ,lowercase=32     ,lowercase=768     ,lowercase=12     ,lowercase=12     ,lowercase=3072     ,lowercase="gelu"     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.0     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.02     ,lowercase=1E-5     ,lowercase="gelu"     ,lowercase=(512, 512, 512, 512, 512, 512, 512)     ,lowercase=(5, 2, 2, 2, 2, 2, 2)     ,lowercase=(10, 3, 3, 3, 3, 2, 2)     ,lowercase=False     ,lowercase=16     ,lowercase=19     ,lowercase=5     ,lowercase=0.05     ,lowercase=10     ,lowercase=2     ,lowercase=0.0     ,lowercase=10     ,lowercase=0     ,lowercase="sum"     ,lowercase=False     ,lowercase=False     ,lowercase=256     ,lowercase=(512, 512, 512, 512, 1500)     ,lowercase=(5, 3, 3, 1, 1)     ,lowercase=(1, 2, 3, 1, 1)     ,lowercase=512     ,lowercase=0     ,lowercase=1     ,lowercase=2     ,lowercase=False     ,lowercase=3     ,lowercase=2     ,lowercase=3     ,lowercase=None     ,**lowercase     ,):

             """simple docstring"""





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

             # ctc loss
             UpperCAmelCase_  :	int				      =		ctc_loss_reduction
             UpperCAmelCase_  :	str				      =		ctc_zero_infinity

             # adapter
             UpperCAmelCase_  :	Optional[Any]				      =		add_adapter
             UpperCAmelCase_  :	Tuple				      =		adapter_kernel_size
             UpperCAmelCase_  :	Optional[Any]				      =		adapter_stride
             UpperCAmelCase_  :	List[str]				      =		num_adapter_layers
             UpperCAmelCase_  :	Optional[int]				      =		output_hidden_size or hidden_size

             # SequenceClassification-specific parameter. Feel free to ignore for other classes.
             UpperCAmelCase_  :	List[Any]				      =		classifier_proj_size

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



       @property
       def  A_   (     self):

             """simple docstring"""





             return math.prod(self.conv_stride)





from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__lowerCamelCase         =			logging.get_logger(__name__)

__lowerCamelCase         =			{
    '''microsoft/focalnet-tiny''': '''https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json''',
}


class   snake_case_ (lowercase__ , lowercase__  ):




       """simple docstring"""






       _lowerCamelCase			    =				"""focalnet"""



       def __init__(     self     ,lowercase=224     ,lowercase=4     ,lowercase=3     ,lowercase=96     ,lowercase=False     ,lowercase=[192, 384, 768, 768]     ,lowercase=[2, 2, 6, 2]     ,lowercase=[2, 2, 2, 2]     ,lowercase=[3, 3, 3, 3]     ,lowercase="gelu"     ,lowercase=4.0     ,lowercase=0.0     ,lowercase=0.1     ,lowercase=False     ,lowercase=1E-4     ,lowercase=False     ,lowercase=False     ,lowercase=False     ,lowercase=0.02     ,lowercase=1E-5     ,lowercase=32     ,lowercase=None     ,lowercase=None     ,**lowercase     ,):

             """simple docstring"""





             super().__init__(**lowercase)

             UpperCAmelCase_  :	int				      =		image_size
             UpperCAmelCase_  :	Optional[Any]				      =		patch_size
             UpperCAmelCase_  :	Dict				      =		num_channels
             UpperCAmelCase_  :	Dict				      =		embed_dim
             UpperCAmelCase_  :	Optional[int]				      =		use_conv_embed
             UpperCAmelCase_  :	int				      =		hidden_sizes
             UpperCAmelCase_  :	Optional[int]				      =		depths
             UpperCAmelCase_  :	Optional[Any]				      =		focal_levels
             UpperCAmelCase_  :	Tuple				      =		focal_windows
             UpperCAmelCase_  :	int				      =		hidden_act
             UpperCAmelCase_  :	Any				      =		mlp_ratio
             UpperCAmelCase_  :	List[Any]				      =		hidden_dropout_prob
             UpperCAmelCase_  :	Tuple				      =		drop_path_rate
             UpperCAmelCase_  :	List[str]				      =		use_layerscale
             UpperCAmelCase_  :	List[str]				      =		layerscale_value
             UpperCAmelCase_  :	List[str]				      =		use_post_layernorm
             UpperCAmelCase_  :	Dict				      =		use_post_layernorm_in_modulation
             UpperCAmelCase_  :	int				      =		normalize_modulator
             UpperCAmelCase_  :	Dict				      =		initializer_range
             UpperCAmelCase_  :	str				      =		layer_norm_eps
             UpperCAmelCase_  :	Union[str, Any]				      =		encoder_stride
             UpperCAmelCase_  :	str				      =		["stem"] + [F"""stage{idx}""" for idx in range(1     ,len(self.depths) + 1)]
             UpperCAmelCase_      ,      UpperCAmelCase_  :	Any				      =		get_aligned_output_features_output_indices(
                 out_features=lowercase     ,out_indices=lowercase     ,stage_names=self.stage_names)
