



'''simple docstring'''




import math

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


UpperCamelCase__       :	Any    = logging.get_logger(__name__)

UpperCamelCase__       :	Optional[int]    = {
    '''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 						_UpperCamelCase  (							lowerCamelCase__    ):


			'''simple docstring'''

			_A      :		Optional[int]			    =		'''data2vec-audio'''

			def __init__(							self     : Tuple							,     lowerCAmelCase__     : Tuple=3_2							,     lowerCAmelCase__     : str=7_6_8							,     lowerCAmelCase__     : Optional[int]=1_2							,     lowerCAmelCase__     : Dict=1_2							,     lowerCAmelCase__     : Optional[Any]=3_0_7_2							,     lowerCAmelCase__     : Optional[Any]="gelu"							,     lowerCAmelCase__     : int=0.1							,     lowerCAmelCase__     : int=0.1							,     lowerCAmelCase__     : Dict=0.1							,     lowerCAmelCase__     : List[str]=0.0							,     lowerCAmelCase__     : Union[str, Any]=0.1							,     lowerCAmelCase__     : int=0.1							,     lowerCAmelCase__     : str=0.02							,     lowerCAmelCase__     : Union[str, Any]=1E-5							,     lowerCAmelCase__     : Optional[Any]="gelu"							,     lowerCAmelCase__     : Optional[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)							,     lowerCAmelCase__     : Optional[Any]=(5, 2, 2, 2, 2, 2, 2)							,     lowerCAmelCase__     : Union[str, Any]=(1_0, 3, 3, 3, 3, 2, 2)							,     lowerCAmelCase__     : Union[str, Any]=False							,     lowerCAmelCase__     : Optional[Any]=1_6							,     lowerCAmelCase__     : Optional[Any]=1_9							,     lowerCAmelCase__     : int=5							,     lowerCAmelCase__     : Union[str, Any]=0.05							,     lowerCAmelCase__     : str=1_0							,     lowerCAmelCase__     : Optional[int]=2							,     lowerCAmelCase__     : Optional[Any]=0.0							,     lowerCAmelCase__     : Optional[Any]=1_0							,     lowerCAmelCase__     : Optional[Any]=0							,     lowerCAmelCase__     : int="sum"							,     lowerCAmelCase__     : Dict=False							,     lowerCAmelCase__     : Optional[Any]=False							,     lowerCAmelCase__     : int=2_5_6							,     lowerCAmelCase__     : List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)							,     lowerCAmelCase__     : Dict=(5, 3, 3, 1, 1)							,     lowerCAmelCase__     : Union[str, Any]=(1, 2, 3, 1, 1)							,     lowerCAmelCase__     : Optional[Any]=5_1_2							,     lowerCAmelCase__     : Tuple=0							,     lowerCAmelCase__     : int=1							,     lowerCAmelCase__     : Optional[Any]=2							,     lowerCAmelCase__     : Optional[Any]=False							,     lowerCAmelCase__     : Dict=3							,     lowerCAmelCase__     : Union[str, Any]=2							,     lowerCAmelCase__     : List[Any]=3							,     lowerCAmelCase__     : Dict=None							,     **lowerCAmelCase__     : Union[str, Any]							,     ):





					"""simple docstring"""






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

					# ctc loss
					__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		ctc_loss_reduction
					__SCREAMING_SNAKE_CASE       :		Tuple           =		ctc_zero_infinity

					# adapter
					__SCREAMING_SNAKE_CASE       :		Dict           =		add_adapter
					__SCREAMING_SNAKE_CASE       :		Dict           =		adapter_kernel_size
					__SCREAMING_SNAKE_CASE       :		int           =		adapter_stride
					__SCREAMING_SNAKE_CASE       :		int           =		num_adapter_layers
					__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		output_hidden_size or hidden_size

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

					# XVector-specific parameters. Feel free to ignore for other classes.
					__SCREAMING_SNAKE_CASE       :		str           =		list(lowerCAmelCase__						)
					__SCREAMING_SNAKE_CASE       :		int           =		list(lowerCAmelCase__						)
					__SCREAMING_SNAKE_CASE       :		Dict           =		list(lowerCAmelCase__						)
					__SCREAMING_SNAKE_CASE       :		List[str]           =		xvector_output_dim



			@property
			def UpperCamelCase__					(							self     : List[Any]						):





					"""simple docstring"""






					return math.prod(self.conv_stride						)




'''simple docstring'''




from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

UpperCamelCase__       :	Dict    = [
    '''python''',
    '''tqdm''',
    '''regex''',
    '''requests''',
    '''packaging''',
    '''filelock''',
    '''numpy''',
    '''tokenizers''',
    '''huggingface-hub''',
    '''safetensors''',
    '''accelerate''',
    '''pyyaml''',
]

for pkg in pkgs_to_check_at_runtime:
						if pkg in deps:
												if pkg == "tokenizers":
																		# must be loaded here, or else tqdm check may fail
																		from .utils import is_tokenizers_available

																		if not is_tokenizers_available():
																								continue  # not required, check version only if installed
												elif pkg == "accelerate":
																		# must be loaded here, or else tqdm check may fail
																		from .utils import is_accelerate_available

																		# Maybe switch to is_torch_available in the future here so that Accelerate is hard dep of
																		# Transformers with PyTorch
																		if not is_accelerate_available():
																								continue  # not required, check version only if installed

												require_version_core(deps[pkg])
						else:
												raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py")


def 				lowerCAmelCase_   (	_lowerCamelCase:   List[Any]       ,      _lowerCamelCase:   Optional[int]=None					):
		require_version(deps[pkg]       ,      _lowerCamelCase					)