

import math

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


A									=  logging.get_logger(__name__)

A									=  {
    '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 SCREAMING_SNAKE_CASE	(		__snake_case				):






			"""simple docstring"""




			__A    	=	"""data2vec-audio"""


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

				"""simple docstring"""


				super().__init__(**__UpperCamelCase			,					pad_token_id=__UpperCamelCase			,					bos_token_id=__UpperCamelCase			,					eos_token_id=__UpperCamelCase				)
				snake_case_   		=			hidden_size
				snake_case_   		=			feat_extract_activation
				snake_case_   		=			list(__UpperCamelCase				)
				snake_case_   		=			list(__UpperCamelCase				)
				snake_case_   		=			list(__UpperCamelCase				)
				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(__UpperCamelCase				)
				snake_case_   		=			list(__UpperCamelCase				)
				snake_case_   		=			list(__UpperCamelCase				)
				snake_case_   		=			xvector_output_dim







			@property
			def       __lowerCAmelCase			(     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


A									=  logging.get_logger(__name__)

A									=  {
    'google/bit-50': 'https://huggingface.co/google/bit-50/resolve/main/config.json',
}


class SCREAMING_SNAKE_CASE	(		__snake_case				,    __snake_case				):






			"""simple docstring"""




			__A    	=	"""bit"""
			__A    	=	["""preactivation""", """bottleneck"""]
			__A    	=	["""SAME""", """VALID"""]


			def __init__(     self			,					__UpperCamelCase=3			,					__UpperCamelCase=64			,					__UpperCamelCase=[2_56, 5_12, 10_24, 20_48]			,					__UpperCamelCase=[3, 4, 6, 3]			,					__UpperCamelCase="preactivation"			,					__UpperCamelCase="relu"			,					__UpperCamelCase=None			,					__UpperCamelCase=32			,					__UpperCamelCase=0.0			,					__UpperCamelCase=False			,					__UpperCamelCase=32			,					__UpperCamelCase=1			,					__UpperCamelCase=None			,					__UpperCamelCase=None			,					**__UpperCamelCase			,					):

				"""simple docstring"""


				super().__init__(**__UpperCamelCase				)
				if layer_type not in self.layer_types:
					raise ValueError(f"""layer_type={layer_type} is not one of {','.join(self.layer_types				)}"""				)
				if global_padding is not None:
					if global_padding.upper() in self.supported_padding:
						snake_case_   		=			global_padding.upper()
					else:
						raise ValueError(f"""Padding strategy {global_padding} not supported"""				)
				snake_case_   		=			num_channels
				snake_case_   		=			embedding_size
				snake_case_   		=			hidden_sizes
				snake_case_   		=			depths
				snake_case_   		=			layer_type
				snake_case_   		=			hidden_act
				snake_case_   		=			global_padding
				snake_case_   		=			num_groups
				snake_case_   		=			drop_path_rate
				snake_case_   		=			embedding_dynamic_padding
				snake_case_   		=			output_stride
				snake_case_   		=			width_factor

				snake_case_   		=			['stem'] + [f"""stage{idx}""" for idx in range(1			,					len(__UpperCamelCase				) + 1				)]
				snake_case_		,							snake_case_   		=			get_aligned_output_features_output_indices(
				    out_features=__UpperCamelCase			,					out_indices=__UpperCamelCase			,					stage_names=self.stage_names				)
