


import functools
import operator

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


lowerCamelCase		   =			logging.get_logger(__name__)

lowerCamelCase		   =			{
    '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 A    (  UpperCamelCase_	):
      UpperCamelCase__				:    Optional[Any] ='unispeech'






      def __init__(   self		:	List[str]     ,  lowercase_		:	Dict=32     ,  lowercase_		:	str=768     ,  lowercase_		:	int=12     ,  lowercase_		:	Optional[int]=12     ,  lowercase_		:	int=3072     ,  lowercase_		:	Union[str, Any]="gelu"     ,  lowercase_		:	Optional[int]=0.1     ,  lowercase_		:	Dict=0.1     ,  lowercase_		:	str=0.1     ,  lowercase_		:	Optional[int]=0.0     ,  lowercase_		:	List[str]=0.0     ,  lowercase_		:	Optional[int]=0.1     ,  lowercase_		:	Tuple=0.1     ,  lowercase_		:	Union[str, Any]=0.02     ,  lowercase_		:	List[Any]=1E-5     ,  lowercase_		:	Optional[Any]="group"     ,  lowercase_		:	Optional[Any]="gelu"     ,  lowercase_		:	List[str]=(512, 512, 512, 512, 512, 512, 512)     ,  lowercase_		:	List[str]=(5, 2, 2, 2, 2, 2, 2)     ,  lowercase_		:	Any=(10, 3, 3, 3, 3, 2, 2)     ,  lowercase_		:	Any=False     ,  lowercase_		:	Tuple=128     ,  lowercase_		:	Optional[Any]=16     ,  lowercase_		:	List[str]=False     ,  lowercase_		:	str=True     ,  lowercase_		:	Optional[int]=0.05     ,  lowercase_		:	int=10     ,  lowercase_		:	Any=2     ,  lowercase_		:	Any=0.0     ,  lowercase_		:	int=10     ,  lowercase_		:	Optional[Any]=0     ,  lowercase_		:	Optional[Any]=320     ,  lowercase_		:	Any=2     ,  lowercase_		:	str=0.1     ,  lowercase_		:	Union[str, Any]=100     ,  lowercase_		:	List[str]=256     ,  lowercase_		:	List[str]=256     ,  lowercase_		:	int=0.1     ,  lowercase_		:	Tuple="mean"     ,  lowercase_		:	Any=False     ,  lowercase_		:	Dict=False     ,  lowercase_		:	Optional[Any]=256     ,  lowercase_		:	Tuple=80     ,  lowercase_		:	str=0     ,  lowercase_		:	Optional[Any]=1     ,  lowercase_		:	Union[str, Any]=2     ,  lowercase_		:	Dict=0.5     ,  **lowercase_		:	Tuple     ,  )   ->		Union[str, Any]:
             """simple docstring"""




             super().__init__(**lowercase_     ,  pad_token_id=lowercase_     ,  bos_token_id=lowercase_     ,  eos_token_id=lowercase_					)
             _lowerCamelCase			:						Dict            =hidden_size
             _lowerCamelCase			:						int            =feat_extract_norm
             _lowerCamelCase			:						Any            =feat_extract_activation
             _lowerCamelCase			:						str            =list(lowercase_					)
             _lowerCamelCase			:						int            =list(lowercase_					)
             _lowerCamelCase			:						List[str]            =list(lowercase_					)
             _lowerCamelCase			:						List[Any]            =conv_bias
             _lowerCamelCase			:						List[str]            =num_conv_pos_embeddings
             _lowerCamelCase			:						List[str]            =num_conv_pos_embedding_groups
             _lowerCamelCase			:						Any            =len(self.conv_dim					)
             _lowerCamelCase			:						Optional[int]            =num_hidden_layers
             _lowerCamelCase			:						Optional[Any]            =intermediate_size
             _lowerCamelCase			:						Optional[Any]            =hidden_act
             _lowerCamelCase			:						Tuple            =num_attention_heads
             _lowerCamelCase			:						Union[str, Any]            =hidden_dropout
             _lowerCamelCase			:						Dict            =attention_dropout
             _lowerCamelCase			:						Any            =activation_dropout
             _lowerCamelCase			:						Optional[Any]            =feat_proj_dropout
             _lowerCamelCase			:						List[str]            =final_dropout
             _lowerCamelCase			:						List[str]            =layerdrop
             _lowerCamelCase			:						int            =layer_norm_eps
             _lowerCamelCase			:						Dict            =initializer_range
             _lowerCamelCase			:						Any            =num_ctc_classes
             _lowerCamelCase			:						int            =vocab_size
             _lowerCamelCase			:						Tuple            =do_stable_layer_norm
             _lowerCamelCase			:						Optional[int]            =use_weighted_layer_sum
             _lowerCamelCase			:						Union[str, Any]            =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
             _lowerCamelCase			:						Optional[int]            =apply_spec_augment
             _lowerCamelCase			:						List[Any]            =mask_time_prob
             _lowerCamelCase			:						Optional[int]            =mask_time_length
             _lowerCamelCase			:						Union[str, Any]            =mask_time_min_masks
             _lowerCamelCase			:						Tuple            =mask_feature_prob
             _lowerCamelCase			:						Optional[Any]            =mask_feature_length
             _lowerCamelCase			:						List[Any]            =mask_feature_min_masks

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

             # ctc loss
             _lowerCamelCase			:						List[str]            =ctc_loss_reduction
             _lowerCamelCase			:						Any            =ctc_zero_infinity

             # pretraining loss
             _lowerCamelCase			:						int            =replace_prob






      @property
      def 			lowerCamelCase			(   self		:	Union[str, Any]					)   ->		str:
             """simple docstring"""




             return functools.reduce(operator.mul     ,  self.conv_stride     ,  1					)






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 A    (  UpperCamelCase_       ,				UpperCamelCase_	):
      UpperCamelCase__				:    str ='focalnet'






      def __init__(   self		:	Optional[int]     ,  lowercase_		:	List[Any]=224     ,  lowercase_		:	str=4     ,  lowercase_		:	Any=3     ,  lowercase_		:	Dict=96     ,  lowercase_		:	List[str]=False     ,  lowercase_		:	Any=[192, 384, 768, 768]     ,  lowercase_		:	Dict=[2, 2, 6, 2]     ,  lowercase_		:	Optional[int]=[2, 2, 2, 2]     ,  lowercase_		:	List[Any]=[3, 3, 3, 3]     ,  lowercase_		:	Any="gelu"     ,  lowercase_		:	str=4.0     ,  lowercase_		:	List[Any]=0.0     ,  lowercase_		:	Tuple=0.1     ,  lowercase_		:	Optional[Any]=False     ,  lowercase_		:	Optional[int]=1E-4     ,  lowercase_		:	Dict=False     ,  lowercase_		:	Optional[Any]=False     ,  lowercase_		:	Dict=False     ,  lowercase_		:	List[Any]=0.02     ,  lowercase_		:	Any=1E-5     ,  lowercase_		:	Any=32     ,  lowercase_		:	List[str]=None     ,  lowercase_		:	int=None     ,  **lowercase_		:	Optional[Any]     ,  )   ->		Optional[Any]:
             """simple docstring"""




             super().__init__(**lowercase_					)

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


