

'''simple docstring'''

import math

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


lowercase__         =      logging.get_logger(__name__)

lowercase__         =      {
    "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_			(    _snake_case							):






     '''simple docstring'''



     UpperCAmelCase_						:     Optional[int]  		=  """data2vec-audio"""


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

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

      # adapter
      UpperCAmelCase	:     Optional[int]						 =			add_adapter
      UpperCAmelCase	:     Tuple						 =			adapter_kernel_size
      UpperCAmelCase	:     Any						 =			adapter_stride
      UpperCAmelCase	:     Union[str, Any]						 =			num_adapter_layers
      UpperCAmelCase	:     List[Any]						 =			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	:     List[Any]						 =			list(lowercase_	)
      UpperCAmelCase	:     Dict						 =			list(lowercase_	)
      UpperCAmelCase	:     Union[str, Any]						 =			list(lowercase_	)
      UpperCAmelCase	:     Tuple						 =			xvector_output_dim




     @property
     def        UpperCAmelCase_	(		self			:					List[Any]	)						->     int:
      return math.prod(self.conv_stride	)







'''simple docstring'''

from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


lowercase__         =      {"configuration_van": ["VAN_PRETRAINED_CONFIG_ARCHIVE_MAP", "VanConfig"]}


try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowercase__         =      [
     "VAN_PRETRAINED_MODEL_ARCHIVE_LIST",
     "VanForImageClassification",
     "VanModel",
     "VanPreTrainedModel",
 ]

if TYPE_CHECKING:
 from .configuration_van import VAN_PRETRAINED_CONFIG_ARCHIVE_MAP, VanConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_van import (
      VAN_PRETRAINED_MODEL_ARCHIVE_LIST,
      VanForImageClassification,
      VanModel,
      VanPreTrainedModel,
  )

else:
 import sys

 lowercase__         =      _LazyModule(__name__, globals()["__file__"], _import_structure)




