


import math

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


A			:						Optional[int]        =  logging.get_logger(__name__)

A			:						Any        =  {
    '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 				A       (			UpperCAmelCase__				):
					'''simple docstring'''






					A__     =					'''data2vec-audio'''

					def __init__(self       :		int ,   _UpperCAmelCase       :		str=32 ,   _UpperCAmelCase       :		Dict=768 ,   _UpperCAmelCase       :		Tuple=12 ,   _UpperCAmelCase       :		Tuple=12 ,   _UpperCAmelCase       :		Dict=3072 ,   _UpperCAmelCase       :		Dict="gelu" ,   _UpperCAmelCase       :		Dict=0.1 ,   _UpperCAmelCase       :		Any=0.1 ,   _UpperCAmelCase       :		Dict=0.1 ,   _UpperCAmelCase       :		str=0.0 ,   _UpperCAmelCase       :		List[Any]=0.1 ,   _UpperCAmelCase       :		str=0.1 ,   _UpperCAmelCase       :		Tuple=0.02 ,   _UpperCAmelCase       :		str=1E-5 ,   _UpperCAmelCase       :		List[str]="gelu" ,   _UpperCAmelCase       :		str=(512, 512, 512, 512, 512, 512, 512) ,   _UpperCAmelCase       :		int=(5, 2, 2, 2, 2, 2, 2) ,   _UpperCAmelCase       :		Optional[Any]=(10, 3, 3, 3, 3, 2, 2) ,   _UpperCAmelCase       :		int=False ,   _UpperCAmelCase       :		Any=16 ,   _UpperCAmelCase       :		Dict=19 ,   _UpperCAmelCase       :		Dict=5 ,   _UpperCAmelCase       :		Dict=0.05 ,   _UpperCAmelCase       :		Dict=10 ,   _UpperCAmelCase       :		Any=2 ,   _UpperCAmelCase       :		Optional[int]=0.0 ,   _UpperCAmelCase       :		Optional[int]=10 ,   _UpperCAmelCase       :		List[Any]=0 ,   _UpperCAmelCase       :		List[str]="sum" ,   _UpperCAmelCase       :		Dict=False ,   _UpperCAmelCase       :		Tuple=False ,   _UpperCAmelCase       :		Dict=256 ,   _UpperCAmelCase       :		Optional[int]=(512, 512, 512, 512, 1500) ,   _UpperCAmelCase       :		List[str]=(5, 3, 3, 1, 1) ,   _UpperCAmelCase       :		Any=(1, 2, 3, 1, 1) ,   _UpperCAmelCase       :		List[str]=512 ,   _UpperCAmelCase       :		Optional[int]=0 ,   _UpperCAmelCase       :		str=1 ,   _UpperCAmelCase       :		List[str]=2 ,   _UpperCAmelCase       :		List[Any]=False ,   _UpperCAmelCase       :		Tuple=3 ,   _UpperCAmelCase       :		Any=2 ,   _UpperCAmelCase       :		Dict=3 ,   _UpperCAmelCase       :		List[str]=None ,   **_UpperCAmelCase       :		Tuple ,   )		->  Dict:




							"""simple docstring"""


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

							# ctc loss
							lowercase__	     =						ctc_loss_reduction
							lowercase__	     =						ctc_zero_infinity

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

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

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


					@property
					def     lowerCamelCase__	(self       :		Optional[int]						)		->  Optional[int]:




							"""simple docstring"""


							return math.prod(self.conv_stride						)





from typing import Optional

from .. import Features, NamedSplit
from ..packaged_modules.text.text import Text
from ..utils.typing import NestedDataStructureLike, PathLike
from .abc import AbstractDatasetReader



class 				A       (			UpperCAmelCase__				):
					'''simple docstring'''






					def __init__(self       :		Any ,   _UpperCAmelCase       :		NestedDataStructureLike[PathLike] ,   _UpperCAmelCase       :		Optional[NamedSplit] = None ,   _UpperCAmelCase       :		Optional[Features] = None ,   _UpperCAmelCase       :		str = None ,   _UpperCAmelCase       :		bool = False ,   _UpperCAmelCase       :		bool = False ,   _UpperCAmelCase       :		Optional[int] = None ,   **_UpperCAmelCase       :		Optional[int] ,   )		->  List[str]:




							"""simple docstring"""


							super().__init__(
							    _UpperCAmelCase ,   split=_UpperCAmelCase ,   features=_UpperCAmelCase ,   cache_dir=_UpperCAmelCase ,   keep_in_memory=_UpperCAmelCase ,   streaming=_UpperCAmelCase ,   num_proc=_UpperCAmelCase ,   **_UpperCAmelCase ,   )
							lowercase__	     =						path_or_paths if isinstance(_UpperCAmelCase ,   _UpperCAmelCase						) else {self.split: path_or_paths}
							lowercase__	     =						Text(
							    cache_dir=_UpperCAmelCase ,   data_files=_UpperCAmelCase ,   features=_UpperCAmelCase ,   **_UpperCAmelCase ,   )


					def     lowerCamelCase__	(self       :		Tuple						)		->  Any:




							"""simple docstring"""


							if self.streaming:
									lowercase__	     =						self.builder.as_streaming_dataset(split=self.split						)
							# Build regular (map-style) dataset
							else:
									lowercase__	     =						None
									lowercase__	     =						None
									lowercase__	     =						None
									lowercase__	     =						None

									self.builder.download_and_prepare(
									    download_config=_UpperCAmelCase ,   download_mode=_UpperCAmelCase ,   verification_mode=_UpperCAmelCase ,   base_path=_UpperCAmelCase ,   num_proc=self.num_proc ,   )
									lowercase__	     =						self.builder.as_dataset(
									    split=self.split ,   verification_mode=_UpperCAmelCase ,   in_memory=self.keep_in_memory						)
							return dataset

