'''simple docstring'''




import functools
import operator

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


_a   :	str 							=   logging.get_logger(__name__)

_a   :	Optional[int] 							=   {
    "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json",
    # See all SEW models at https://huggingface.co/models?filter=sew
}






class 		__A       (__magic_name__   ):
       snake_case       :Union[str, Any]				    =					"sew"






       def __init__(      self				,     UpperCamelCase_=32				,     UpperCamelCase_=7_68				,     UpperCamelCase_=12				,     UpperCamelCase_=12				,     UpperCamelCase_=30_72				,     UpperCamelCase_=2				,     UpperCamelCase_="gelu"				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.0				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.1				,     UpperCamelCase_=0.0_2				,     UpperCamelCase_=1E-5				,     UpperCamelCase_="group"				,     UpperCamelCase_="gelu"				,     UpperCamelCase_=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)				,     UpperCamelCase_=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)				,     UpperCamelCase_=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)				,     UpperCamelCase_=False				,     UpperCamelCase_=1_28				,     UpperCamelCase_=16				,     UpperCamelCase_=True				,     UpperCamelCase_=0.0_5				,     UpperCamelCase_=10				,     UpperCamelCase_=2				,     UpperCamelCase_=0.0				,     UpperCamelCase_=10				,     UpperCamelCase_=0				,     UpperCamelCase_="mean"				,     UpperCamelCase_=False				,     UpperCamelCase_=False				,     UpperCamelCase_=2_56				,     UpperCamelCase_=0				,     UpperCamelCase_=1				,     UpperCamelCase_=2				,     **UpperCamelCase_				,     ):
              super().__init__(**UpperCamelCase_				,     pad_token_id=UpperCamelCase_				,     bos_token_id=UpperCamelCase_				,     eos_token_id=UpperCamelCase_      )
              __UpperCAmelCase  :				Tuple       				=		hidden_size
              __UpperCAmelCase  :				Tuple       				=		feat_extract_norm
              __UpperCAmelCase  :				Optional[int]       				=		feat_extract_activation
              __UpperCAmelCase  :				Dict       				=		list(UpperCamelCase_      )
              __UpperCAmelCase  :				Optional[Any]       				=		list(UpperCamelCase_      )
              __UpperCAmelCase  :				str       				=		list(UpperCamelCase_      )
              __UpperCAmelCase  :				Union[str, Any]       				=		conv_bias
              __UpperCAmelCase  :				Any       				=		num_conv_pos_embeddings
              __UpperCAmelCase  :				Optional[int]       				=		num_conv_pos_embedding_groups
              __UpperCAmelCase  :				List[str]       				=		len(self.conv_dim      )
              __UpperCAmelCase  :				Optional[Any]       				=		num_hidden_layers
              __UpperCAmelCase  :				Optional[int]       				=		intermediate_size
              __UpperCAmelCase  :				Tuple       				=		squeeze_factor
              __UpperCAmelCase  :				str       				=		hidden_act
              __UpperCAmelCase  :				Any       				=		num_attention_heads
              __UpperCAmelCase  :				int       				=		hidden_dropout
              __UpperCAmelCase  :				List[str]       				=		attention_dropout
              __UpperCAmelCase  :				List[str]       				=		activation_dropout
              __UpperCAmelCase  :				str       				=		feat_proj_dropout
              __UpperCAmelCase  :				Union[str, Any]       				=		final_dropout
              __UpperCAmelCase  :				Dict       				=		layerdrop
              __UpperCAmelCase  :				Any       				=		layer_norm_eps
              __UpperCAmelCase  :				List[str]       				=		initializer_range
              __UpperCAmelCase  :				Any       				=		vocab_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)`,"
                         f"""but is `len(config.conv_dim) = {len(self.conv_dim      )}`, `len(config.conv_stride)"""
                         f"""= {len(self.conv_stride      )}`, `len(config.conv_kernel) = {len(self.conv_kernel      )}`."""      )

              # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
              __UpperCAmelCase  :				Optional[Any]       				=		apply_spec_augment
              __UpperCAmelCase  :				int       				=		mask_time_prob
              __UpperCAmelCase  :				Optional[int]       				=		mask_time_length
              __UpperCAmelCase  :				Tuple       				=		mask_time_min_masks
              __UpperCAmelCase  :				Dict       				=		mask_feature_prob
              __UpperCAmelCase  :				Optional[int]       				=		mask_feature_length
              __UpperCAmelCase  :				List[str]       				=		mask_feature_min_masks

              # ctc loss
              __UpperCAmelCase  :				int       				=		ctc_loss_reduction
              __UpperCAmelCase  :				List[Any]       				=		ctc_zero_infinity

              # sequence classification
              __UpperCAmelCase  :				List[str]       				=		use_weighted_layer_sum
              __UpperCAmelCase  :				List[Any]       				=		classifier_proj_size







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





'''simple docstring'''




class 		__A       :






       def __init__(      self				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Any       				=		set_counts
              __UpperCAmelCase  :				int       				=		max(UpperCamelCase_      )
              __UpperCAmelCase  :				List[str]       				=		len(UpperCamelCase_      )
              __UpperCAmelCase  :				Any       				=		[1] * num_sets
              __UpperCAmelCase  :				Any       				=		list(range(UpperCamelCase_      )      )






       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_      ):
              __UpperCAmelCase  :				Optional[int]       				=		self.get_parent(UpperCamelCase_      )
              __UpperCAmelCase  :				List[Any]       				=		self.get_parent(UpperCamelCase_      )

              if src_parent == dst_parent:
                     return False

              if self.ranks[dst_parent] >= self.ranks[src_parent]:
                     self.set_counts[dst_parent] += self.set_counts[src_parent]
                     __UpperCAmelCase  :				Optional[Any]       				=		0
                     __UpperCAmelCase  :				List[Any]       				=		dst_parent
                     if self.ranks[dst_parent] == self.ranks[src_parent]:
                            self.ranks[dst_parent] += 1
                     __UpperCAmelCase  :				Union[str, Any]       				=		self.set_counts[dst_parent]
              else:
                     self.set_counts[src_parent] += self.set_counts[dst_parent]
                     __UpperCAmelCase  :				Union[str, Any]       				=		0
                     __UpperCAmelCase  :				Dict       				=		src_parent
                     __UpperCAmelCase  :				Dict       				=		self.set_counts[src_parent]

              __UpperCAmelCase  :				Dict       				=		max(self.max_set				,     UpperCamelCase_      )
              return True







       def 			_snake_case						(      self				,     UpperCamelCase_      ):
              if self.parents[disj_set] == disj_set:
                     return disj_set
              __UpperCAmelCase  :				str       				=		self.get_parent(self.parents[disj_set]      )
              return self.parents[disj_set]






