


'''simple docstring'''


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 					lowercase						(  a_ ):
							_lowerCamelCase		:      Optional[Any]=   "data2vec-audio"


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

								# ctc loss
								UpperCAmelCase_		:      int       	=					ctc_loss_reduction
								UpperCAmelCase_		:      List[str]       	=					ctc_zero_infinity

								# adapter
								UpperCAmelCase_		:      Any       	=					add_adapter
								UpperCAmelCase_		:      int       	=					adapter_kernel_size
								UpperCAmelCase_		:      Tuple       	=					adapter_stride
								UpperCAmelCase_		:      List[str]       	=					num_adapter_layers
								UpperCAmelCase_		:      str       	=					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_		:      Optional[int]       	=					list(_snake_case)
								UpperCAmelCase_		:      List[Any]       	=					list(_snake_case)
								UpperCAmelCase_		:      str       	=					list(_snake_case)
								UpperCAmelCase_		:      Tuple       	=					xvector_output_dim





							@property
							def 						_snake_case							(			self)							->				Optional[Any]:
								return math.prod(self.conv_stride)









'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase__										= {
    "configuration_clap": [
        "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
        "ClapAudioConfig",
        "ClapConfig",
        "ClapTextConfig",
    ],
    "processing_clap": ["ClapProcessor"],
}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= [
						    "CLAP_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "ClapModel",
						    "ClapPreTrainedModel",
						    "ClapTextModel",
						    "ClapTextModelWithProjection",
						    "ClapAudioModel",
						    "ClapAudioModelWithProjection",
						]
						lowerCAmelCase__										= ["ClapFeatureExtractor"]

if TYPE_CHECKING:
						from .configuration_clap import (
						    CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
						    ClapAudioConfig,
						    ClapConfig,
						    ClapTextConfig,
						)
						from .processing_clap import ClapProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .feature_extraction_clap import ClapFeatureExtractor
												from .modeling_clap import (
												    CLAP_PRETRAINED_MODEL_ARCHIVE_LIST,
												    ClapAudioModel,
												    ClapAudioModelWithProjection,
												    ClapModel,
												    ClapPreTrainedModel,
												    ClapTextModel,
												    ClapTextModelWithProjection,
												)


else:
						import sys

						lowerCAmelCase__										= _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)






