






import functools
import operator

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


lowerCamelCase      :       str    =						logging.get_logger(__name__)

lowerCamelCase      :       int    =						{
    '''microsoft/unispeech-sat-base-100h-libri-ft''': (
        '''https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json'''
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}



class 				_UpperCamelCase      (a_      ):
      snake_case_	=				"""unispeech-sat"""


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

           # parameters for pretraining with codevector quantized representations
           __lowerCAmelCase             =       num_codevectors_per_group
           __lowerCAmelCase             =       num_codevector_groups
           __lowerCAmelCase             =       contrastive_logits_temperature
           __lowerCAmelCase             =       feat_quantizer_dropout
           __lowerCAmelCase             =       num_negatives
           __lowerCAmelCase             =       codevector_dim
           __lowerCAmelCase             =       proj_codevector_dim
           __lowerCAmelCase             =       diversity_loss_weight

           # ctc loss
           __lowerCAmelCase             =       ctc_loss_reduction
           __lowerCAmelCase             =       ctc_zero_infinity

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

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


      @property
      def 			__UpperCAmelCase		(						self						)->						List[str]:
           return functools.reduce(operator.mul       ,    self.conv_stride       ,    1						)














from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


lowerCamelCase      :       List[Any]    =						{
    '''configuration_owlvit''': [
        '''OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''OwlViTConfig''',
        '''OwlViTOnnxConfig''',
        '''OwlViTTextConfig''',
        '''OwlViTVisionConfig''',
    ],
    '''processing_owlvit''': ['''OwlViTProcessor'''],
}


try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase      :       List[Any]    =						['''OwlViTFeatureExtractor''']
 lowerCamelCase      :       str    =						['''OwlViTImageProcessor''']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase      :       List[str]    =						[
     '''OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''OwlViTModel''',
     '''OwlViTPreTrainedModel''',
     '''OwlViTTextModel''',
     '''OwlViTVisionModel''',
     '''OwlViTForObjectDetection''',
 ]

if TYPE_CHECKING:
 from .configuration_owlvit import (
     OWLVIT_PRETRAINED_CONFIG_ARCHIVE_MAP,
     OwlViTConfig,
     OwlViTOnnxConfig,
     OwlViTTextConfig,
     OwlViTVisionConfig,
 )
 from .processing_owlvit import OwlViTProcessor

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .feature_extraction_owlvit import OwlViTFeatureExtractor
  from .image_processing_owlvit import OwlViTImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_owlvit import (
      OWLVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
      OwlViTForObjectDetection,
      OwlViTModel,
      OwlViTPreTrainedModel,
      OwlViTTextModel,
      OwlViTVisionModel,
  )

else:
 import sys

 lowerCamelCase      :       List[str]    =						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






