






"""simple docstring"""



import math

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


A__	:    str			 = logging.get_logger(__name__)

A__	:    List[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        lowercase__      (							snake_case__       ):
			_UpperCAmelCase		:Optional[int]             =			"data2vec-audio"


			def __init__(				self					:  Optional[Any]       ,	snake_case__					:  Optional[Any]=32       ,	snake_case__					:  int=768       ,	snake_case__					:  Optional[Any]=12       ,	snake_case__					:  str=12       ,	snake_case__					:  Tuple=3072       ,	snake_case__					:  str="gelu"       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  str=0.1       ,	snake_case__					:  str=0.1       ,	snake_case__					:  List[Any]=0.0       ,	snake_case__					:  Tuple=0.1       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  Union[str, Any]=0.02       ,	snake_case__					:  str=1E-5       ,	snake_case__					:  Tuple="gelu"       ,	snake_case__					:  Tuple=(512, 512, 512, 512, 512, 512, 512)       ,	snake_case__					:  List[str]=(5, 2, 2, 2, 2, 2, 2)       ,	snake_case__					:  str=(10, 3, 3, 3, 3, 2, 2)       ,	snake_case__					:  Optional[Any]=False       ,	snake_case__					:  List[str]=16       ,	snake_case__					:  Union[str, Any]=19       ,	snake_case__					:  Union[str, Any]=5       ,	snake_case__					:  int=0.05       ,	snake_case__					:  List[Any]=10       ,	snake_case__					:  str=2       ,	snake_case__					:  Dict=0.0       ,	snake_case__					:  str=10       ,	snake_case__					:  str=0       ,	snake_case__					:  int="sum"       ,	snake_case__					:  Tuple=False       ,	snake_case__					:  int=False       ,	snake_case__					:  Any=256       ,	snake_case__					:  int=(512, 512, 512, 512, 1500)       ,	snake_case__					:  List[Any]=(5, 3, 3, 1, 1)       ,	snake_case__					:  str=(1, 2, 3, 1, 1)       ,	snake_case__					:  Tuple=512       ,	snake_case__					:  str=0       ,	snake_case__					:  Union[str, Any]=1       ,	snake_case__					:  Any=2       ,	snake_case__					:  Union[str, Any]=False       ,	snake_case__					:  Union[str, Any]=3       ,	snake_case__					:  Tuple=2       ,	snake_case__					:  Optional[int]=3       ,	snake_case__					:  int=None       ,	**snake_case__					:  Optional[int]       ,	):
										super().__init__(**snake_case__       ,	pad_token_id=snake_case__       ,	bos_token_id=snake_case__       ,	eos_token_id=snake_case__ )
										lowerCamelCase_	:							Tuple									=hidden_size
										lowerCamelCase_	:							Any									=feat_extract_activation
										lowerCamelCase_	:							List[Any]									=list(snake_case__ )
										lowerCamelCase_	:							List[str]									=list(snake_case__ )
										lowerCamelCase_	:							List[str]									=list(snake_case__ )
										lowerCamelCase_	:							int									=conv_bias
										lowerCamelCase_	:							Optional[int]									=num_conv_pos_embeddings
										lowerCamelCase_	:							List[str]									=num_conv_pos_embedding_groups
										lowerCamelCase_	:							Union[str, Any]									=conv_pos_kernel_size
										lowerCamelCase_	:							List[Any]									=len(self.conv_dim )
										lowerCamelCase_	:							Optional[int]									=num_hidden_layers
										lowerCamelCase_	:							Union[str, Any]									=intermediate_size
										lowerCamelCase_	:							Optional[int]									=hidden_act
										lowerCamelCase_	:							Any									=num_attention_heads
										lowerCamelCase_	:							List[Any]									=hidden_dropout
										lowerCamelCase_	:							Tuple									=attention_dropout
										lowerCamelCase_	:							Optional[int]									=activation_dropout
										lowerCamelCase_	:							Optional[int]									=feat_proj_dropout
										lowerCamelCase_	:							List[str]									=final_dropout
										lowerCamelCase_	:							Any									=layerdrop
										lowerCamelCase_	:							List[str]									=layer_norm_eps
										lowerCamelCase_	:							Optional[Any]									=initializer_range
										lowerCamelCase_	:							List[str]									=vocab_size
										lowerCamelCase_	:							int									=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
										lowerCamelCase_	:							Union[str, Any]									=mask_time_prob
										lowerCamelCase_	:							List[Any]									=mask_time_length
										lowerCamelCase_	:							int									=mask_time_min_masks
										lowerCamelCase_	:							List[str]									=mask_feature_prob
										lowerCamelCase_	:							Any									=mask_feature_length
										lowerCamelCase_	:							Any									=mask_feature_min_masks

										# ctc loss
										lowerCamelCase_	:							Dict									=ctc_loss_reduction
										lowerCamelCase_	:							List[str]									=ctc_zero_infinity

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

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

										# XVector-specific parameters. Feel free to ignore for other classes.
										lowerCamelCase_	:							List[Any]									=list(snake_case__ )
										lowerCamelCase_	:							Dict									=list(snake_case__ )
										lowerCamelCase_	:							Tuple									=list(snake_case__ )
										lowerCamelCase_	:							Optional[Any]									=xvector_output_dim


			@property
			def      UpperCAmelCase__						(				self					:  str ):
										return math.prod(self.conv_stride )











"""simple docstring"""



import torch

def 			_snake_case    (					)    ->     Union[str, Any]:
							if torch.cuda.is_available():
														lowerCamelCase_	:							int									=torch.cuda.device_count()
							else:
														lowerCamelCase_	:							List[str]									=0
							print(F"""Successfully ran on {num_gpus} GPUs"""  )


if __name__ == "__main__":
						main()



