



"""simple docstring"""
import functools
import operator

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


_lowerCAmelCase    :Union[str, Any]     =					logging.get_logger(__name__)

_lowerCAmelCase    :List[str]     =					{
    '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							( SCREAMING_SNAKE_CASE_      ):





     '''simple docstring'''



     a__									='''unispeech'''





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

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

         # ctc loss
         _UpperCAmelCase							:  str											=    ctc_loss_reduction
         _UpperCAmelCase							:  Tuple											=    ctc_zero_infinity

         # pretraining loss
         _UpperCAmelCase							:  Union[str, Any]											=    replace_prob





     @property
     def  __lowerCAmelCase	(					self		)							->					Any:
         return functools.reduce(operator.mul       ,	self.conv_stride       ,	1		)







'''simple docstring'''





from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_lowerCAmelCase      						=	logging.get_logger(__name__)

_lowerCAmelCase      						=	{
    '''microsoft/focalnet-tiny''': '''https://huggingface.co/microsoft/focalnet-tiny/resolve/main/config.json''',
}






class        lowerCAmelCase_(				SCREAMING_SNAKE_CASE_						, SCREAMING_SNAKE_CASE_     ):
  '''simple docstring'''




  __lowercase							:      Optional[Any]				=      '''focalnet'''




  def __init__(    self  ,__UpperCAmelCase=224  ,__UpperCAmelCase=4  ,__UpperCAmelCase=3  ,__UpperCAmelCase=96  ,__UpperCAmelCase=False  ,__UpperCAmelCase=[192, 384, 768, 768]  ,__UpperCAmelCase=[2, 2, 6, 2]  ,__UpperCAmelCase=[2, 2, 2, 2]  ,__UpperCAmelCase=[3, 3, 3, 3]  ,__UpperCAmelCase="gelu"  ,__UpperCAmelCase=4.0  ,__UpperCAmelCase=0.0  ,__UpperCAmelCase=0.1  ,__UpperCAmelCase=False  ,__UpperCAmelCase=1E-4  ,__UpperCAmelCase=False  ,__UpperCAmelCase=False  ,__UpperCAmelCase=False  ,__UpperCAmelCase=0.0_2  ,__UpperCAmelCase=1E-5  ,__UpperCAmelCase=32  ,__UpperCAmelCase=None  ,__UpperCAmelCase=None  ,**__UpperCAmelCase  ,)    ->		Optional[Any]:
      super().__init__(**__UpperCAmelCase      )

      lowerCAmelCase__ :  Dict							      =					image_size
      lowerCAmelCase__ :  int							      =					patch_size
      lowerCAmelCase__ :  str							      =					num_channels
      lowerCAmelCase__ :  Dict							      =					embed_dim
      lowerCAmelCase__ :  List[str]							      =					use_conv_embed
      lowerCAmelCase__ :  List[Any]							      =					hidden_sizes
      lowerCAmelCase__ :  Dict							      =					depths
      lowerCAmelCase__ :  List[str]							      =					focal_levels
      lowerCAmelCase__ :  List[str]							      =					focal_windows
      lowerCAmelCase__ :  Dict							      =					hidden_act
      lowerCAmelCase__ :  Dict							      =					mlp_ratio
      lowerCAmelCase__ :  Tuple							      =					hidden_dropout_prob
      lowerCAmelCase__ :  Tuple							      =					drop_path_rate
      lowerCAmelCase__ :  Dict							      =					use_layerscale
      lowerCAmelCase__ :  Optional[Any]							      =					layerscale_value
      lowerCAmelCase__ :  str							      =					use_post_layernorm
      lowerCAmelCase__ :  Union[str, Any]							      =					use_post_layernorm_in_modulation
      lowerCAmelCase__ :  int							      =					normalize_modulator
      lowerCAmelCase__ :  Optional[Any]							      =					initializer_range
      lowerCAmelCase__ :  List[str]							      =					layer_norm_eps
      lowerCAmelCase__ :  List[Any]							      =					encoder_stride
      lowerCAmelCase__ :  Dict							      =					["""stem"""] + [F"""stage{idx}""" for idx in range(1  ,len(self.depths      ) + 1      )]
      lowerCAmelCase__      ,   lowerCAmelCase__ :  Any							      =					get_aligned_output_features_output_indices(
          out_features=__UpperCAmelCase  ,out_indices=__UpperCAmelCase  ,stage_names=self.stage_names      )


