






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

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


__magic_name__		:     Tuple					=    logging.get_logger(__name__)

__magic_name__		:     List[Any]					=    {
    '''microsoft/unispeech-large-1500h-cv''': (
        '''https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'''
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}







class 	UpperCamelCase__					(     a_			):

		"""simple docstring"""
		UpperCAmelCase__     			=						'unispeech'




		def __init__( self						:						Union[str, Any]							,    __A						:						int=3_2							,    __A						:						Tuple=7_6_8							,    __A						:						Optional[int]=1_2							,    __A						:						Dict=1_2							,    __A						:						Optional[int]=3_0_7_2							,    __A						:						Any="gelu"							,    __A						:						Any=0.1							,    __A						:						Tuple=0.1							,    __A						:						Union[str, Any]=0.1							,    __A						:						Any=0.0							,    __A						:						List[Any]=0.0							,    __A						:						str=0.1							,    __A						:						Optional[int]=0.1							,    __A						:						Tuple=0.0_2							,    __A						:						Tuple=1e-5							,    __A						:						Union[str, Any]="group"							,    __A						:						Optional[Any]="gelu"							,    __A						:						int=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)							,    __A						:						Dict=(5, 2, 2, 2, 2, 2, 2)							,    __A						:						Tuple=(1_0, 3, 3, 3, 3, 2, 2)							,    __A						:						Union[str, Any]=False							,    __A						:						Dict=1_2_8							,    __A						:						Optional[int]=1_6							,    __A						:						List[Any]=False							,    __A						:						List[Any]=True							,    __A						:						Dict=0.0_5							,    __A						:						List[Any]=1_0							,    __A						:						Optional[Any]=2							,    __A						:						Any=0.0							,    __A						:						Optional[Any]=1_0							,    __A						:						Any=0							,    __A						:						str=3_2_0							,    __A						:						Tuple=2							,    __A						:						Union[str, Any]=0.1							,    __A						:						Dict=1_0_0							,    __A						:						Optional[Any]=2_5_6							,    __A						:						Tuple=2_5_6							,    __A						:						Dict=0.1							,    __A						:						List[Any]="mean"							,    __A						:						str=False							,    __A						:						Dict=False							,    __A						:						List[str]=2_5_6							,    __A						:						str=8_0							,    __A						:						Tuple=0							,    __A						:						Any=1							,    __A						:						List[str]=2							,    __A						:						Optional[Any]=0.5							,    **__A						:						Any							,    ):







							"""simple docstring"""
							super().__init__(**__UpperCamelCase							,    pad_token_id=__UpperCamelCase							,    bos_token_id=__UpperCamelCase							,    eos_token_id=__UpperCamelCase    )
							_lowercase			= hidden_size
							_lowercase			= feat_extract_norm
							_lowercase			= feat_extract_activation
							_lowercase			= list(__UpperCamelCase    )
							_lowercase			= list(__UpperCamelCase    )
							_lowercase			= list(__UpperCamelCase    )
							_lowercase			= conv_bias
							_lowercase			= num_conv_pos_embeddings
							_lowercase			= num_conv_pos_embedding_groups
							_lowercase			= len(self.conv_dim    )
							_lowercase			= num_hidden_layers
							_lowercase			= intermediate_size
							_lowercase			= hidden_act
							_lowercase			= num_attention_heads
							_lowercase			= hidden_dropout
							_lowercase			= attention_dropout
							_lowercase			= activation_dropout
							_lowercase			= feat_proj_dropout
							_lowercase			= final_dropout
							_lowercase			= layerdrop
							_lowercase			= layer_norm_eps
							_lowercase			= initializer_range
							_lowercase			= num_ctc_classes
							_lowercase			= vocab_size
							_lowercase			= do_stable_layer_norm
							_lowercase			= use_weighted_layer_sum
							_lowercase			= classifier_proj_size

							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
							_lowercase			= apply_spec_augment
							_lowercase			= mask_time_prob
							_lowercase			= mask_time_length
							_lowercase			= mask_time_min_masks
							_lowercase			= mask_feature_prob
							_lowercase			= mask_feature_length
							_lowercase			= mask_feature_min_masks

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

							# ctc loss
							_lowercase			= ctc_loss_reduction
							_lowercase			= ctc_zero_infinity

							# pretraining loss
							_lowercase			= replace_prob




		@property
		def       snake_case     ( self						:						Dict    ):







							"""simple docstring"""
							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__)






