
'''simple docstring'''






import functools
import operator

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


UpperCAmelCase_							: str =							logging.get_logger(__name__)

UpperCAmelCase_							: Any =							{
    '''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			):
    lowerCAmelCase_					     =		'''unispeech-sat'''



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

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

          # ctc loss
          _lowerCamelCase					: Optional[Any]		    = ctc_loss_reduction
          _lowerCamelCase					: Union[str, Any]		    = ctc_zero_infinity

          # SequenceClassification-specific parameter. Feel free to ignore for other classes.
          _lowerCamelCase					: Dict		    = classifier_proj_size

          # XVector-specific parameters. Feel free to ignore for other classes.
          _lowerCamelCase					: Optional[int]		    = list(__UpperCamelCase  )
          _lowerCamelCase					: List[str]		    = list(__UpperCamelCase  )
          _lowerCamelCase					: Union[str, Any]		    = list(__UpperCamelCase  )
          _lowerCamelCase					: int		    = xvector_output_dim



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

def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	list[int]		,   SCREAMING_SNAKE_CASE_	:	int       )  ->     bool:
						_lowercase					       =					len(SCREAMING_SNAKE_CASE_       )
						_lowercase					       =					[[False] * (required_sum + 1) for _ in range(arr_len + 1       )]

						# for each arr value, a sum of zero(0) can be formed by not taking any element
						# hence True/1
						for i in range(arr_len + 1       ):
												_lowercase					       =					True

						# sum is not zero and set is empty then false
						for i in range(1		,   required_sum + 1       ):
												_lowercase					       =					False

						for i in range(1		,   arr_len + 1       ):
												for j in range(1		,   required_sum + 1       ):
																		if arr[i - 1] > j:
																								_lowercase					       =					subset[i - 1][j]
																		if arr[i - 1] <= j:
																								_lowercase					       =					subset[i - 1][j] or subset[i - 1][j - arr[i - 1]]

						return subset[arr_len][required_sum]


if __name__ == "__main__":
		import doctest

		doctest.testmod()