'''simple docstring'''
import functools
import operator

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


a=  logging.get_logger(__name__)

a=  {
    '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json''',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}






class 			__lowercase		(						_lowerCamelCase						):







     """simple docstring"""






     SCREAMING_SNAKE_CASE__		   =						'''wav2vec2'''







     def __init__(		self     ,			_lowerCamelCase=3_2     ,			_lowerCamelCase=7_6_8     ,			_lowerCamelCase=1_2     ,			_lowerCamelCase=1_2     ,			_lowerCamelCase=3_0_7_2     ,			_lowerCamelCase="gelu"     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.0     ,			_lowerCamelCase=0.0     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=0.0_2     ,			_lowerCamelCase=1E-5     ,			_lowerCamelCase="group"     ,			_lowerCamelCase="gelu"     ,			_lowerCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)     ,			_lowerCamelCase=(5, 2, 2, 2, 2, 2, 2)     ,			_lowerCamelCase=(1_0, 3, 3, 3, 3, 2, 2)     ,			_lowerCamelCase=False     ,			_lowerCamelCase=1_2_8     ,			_lowerCamelCase=1_6     ,			_lowerCamelCase=False     ,			_lowerCamelCase=True     ,			_lowerCamelCase=0.0_5     ,			_lowerCamelCase=1_0     ,			_lowerCamelCase=2     ,			_lowerCamelCase=0.0     ,			_lowerCamelCase=1_0     ,			_lowerCamelCase=0     ,			_lowerCamelCase=3_2_0     ,			_lowerCamelCase=2     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase=1_0_0     ,			_lowerCamelCase=2_5_6     ,			_lowerCamelCase=2_5_6     ,			_lowerCamelCase=0.1     ,			_lowerCamelCase="sum"     ,			_lowerCamelCase=False     ,			_lowerCamelCase=False     ,			_lowerCamelCase=2_5_6     ,			_lowerCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)     ,			_lowerCamelCase=(5, 3, 3, 1, 1)     ,			_lowerCamelCase=(1, 2, 3, 1, 1)     ,			_lowerCamelCase=5_1_2     ,			_lowerCamelCase=0     ,			_lowerCamelCase=1     ,			_lowerCamelCase=2     ,			_lowerCamelCase=False     ,			_lowerCamelCase=3     ,			_lowerCamelCase=2     ,			_lowerCamelCase=3     ,			_lowerCamelCase=None     ,			_lowerCamelCase=None     ,			**_lowerCamelCase     ,			):
         super().__init__(**_lowerCamelCase     ,			pad_token_id=_lowerCamelCase     ,			bos_token_id=_lowerCamelCase     ,			eos_token_id=_lowerCamelCase    )
         __UpperCamelCase	:	Optional[int]		    =  hidden_size
         __UpperCamelCase	:	Optional[Any]		    =  feat_extract_norm
         __UpperCamelCase	:	int		    =  feat_extract_activation
         __UpperCamelCase	:	List[Any]		    =  list(_lowerCamelCase    )
         __UpperCamelCase	:	int		    =  list(_lowerCamelCase    )
         __UpperCamelCase	:	int		    =  list(_lowerCamelCase    )
         __UpperCamelCase	:	List[Any]		    =  conv_bias
         __UpperCamelCase	:	List[Any]		    =  num_conv_pos_embeddings
         __UpperCamelCase	:	str		    =  num_conv_pos_embedding_groups
         __UpperCamelCase	:	List[str]		    =  len(self.conv_dim    )
         __UpperCamelCase	:	str		    =  num_hidden_layers
         __UpperCamelCase	:	str		    =  intermediate_size
         __UpperCamelCase	:	List[str]		    =  hidden_act
         __UpperCamelCase	:	Optional[Any]		    =  num_attention_heads
         __UpperCamelCase	:	Optional[int]		    =  hidden_dropout
         __UpperCamelCase	:	Tuple		    =  attention_dropout
         __UpperCamelCase	:	Any		    =  activation_dropout
         __UpperCamelCase	:	List[Any]		    =  feat_proj_dropout
         __UpperCamelCase	:	List[str]		    =  final_dropout
         __UpperCamelCase	:	Union[str, Any]		    =  layerdrop
         __UpperCamelCase	:	str		    =  layer_norm_eps
         __UpperCamelCase	:	Union[str, Any]		    =  initializer_range
         __UpperCamelCase	:	str		    =  vocab_size
         __UpperCamelCase	:	str		    =  do_stable_layer_norm
         __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	:	int		    =  apply_spec_augment
         __UpperCamelCase	:	Tuple		    =  mask_time_prob
         __UpperCamelCase	:	Tuple		    =  mask_time_length
         __UpperCamelCase	:	Optional[Any]		    =  mask_time_min_masks
         __UpperCamelCase	:	Optional[Any]		    =  mask_feature_prob
         __UpperCamelCase	:	str		    =  mask_feature_length
         __UpperCamelCase	:	Union[str, Any]		    =  mask_feature_min_masks

         # parameters for pretraining with codevector quantized representations
         __UpperCamelCase	:	Dict		    =  num_codevectors_per_group
         __UpperCamelCase	:	Union[str, Any]		    =  num_codevector_groups
         __UpperCamelCase	:	Union[str, Any]		    =  contrastive_logits_temperature
         __UpperCamelCase	:	List[str]		    =  feat_quantizer_dropout
         __UpperCamelCase	:	Tuple		    =  num_negatives
         __UpperCamelCase	:	Dict		    =  codevector_dim
         __UpperCamelCase	:	Union[str, Any]		    =  proj_codevector_dim
         __UpperCamelCase	:	Dict		    =  diversity_loss_weight

         # ctc loss
         __UpperCamelCase	:	str		    =  ctc_loss_reduction
         __UpperCamelCase	:	List[str]		    =  ctc_zero_infinity

         # adapter
         __UpperCamelCase	:	List[Any]		    =  add_adapter
         __UpperCamelCase	:	Tuple		    =  adapter_kernel_size
         __UpperCamelCase	:	str		    =  adapter_stride
         __UpperCamelCase	:	List[str]		    =  num_adapter_layers
         __UpperCamelCase	:	List[Any]		    =  output_hidden_size or hidden_size
         __UpperCamelCase	:	Tuple		    =  adapter_attn_dim

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

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







     @property
     def lowerCAmelCase     (		self    ):
         return functools.reduce(operator.mul     ,			self.conv_stride     ,			1    )




'''simple docstring'''
from typing import TYPE_CHECKING

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


a=  {
    '''configuration_bridgetower''': [
        '''BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BridgeTowerConfig''',
        '''BridgeTowerTextConfig''',
        '''BridgeTowerVisionConfig''',
    ],
    '''processing_bridgetower''': ['''BridgeTowerProcessor'''],
}

try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a=  ['''BridgeTowerImageProcessor''']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  a=  [
      '''BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''BridgeTowerForContrastiveLearning''',
      '''BridgeTowerForImageAndTextRetrieval''',
      '''BridgeTowerForMaskedLM''',
      '''BridgeTowerModel''',
      '''BridgeTowerPreTrainedModel''',
  ]


if TYPE_CHECKING:
  from .configuration_bridgetower import (
      BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP,
      BridgeTowerConfig,
      BridgeTowerTextConfig,
      BridgeTowerVisionConfig,
  )
  from .processing_bridgetower import BridgeTowerProcessor

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .image_processing_bridgetower import BridgeTowerImageProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_bridgetower import (
        BRIDGETOWER_PRETRAINED_MODEL_ARCHIVE_LIST,
        BridgeTowerForContrastiveLearning,
        BridgeTowerForImageAndTextRetrieval,
        BridgeTowerForMaskedLM,
        BridgeTowerModel,
        BridgeTowerPreTrainedModel,
    )


else:
  import sys

  a=  _LazyModule(__name__, globals()['''__file__'''], _import_structure)



