'''simple docstring'''

import functools
import operator

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


__a: Dict          =   logging.get_logger(__name__)

__a: Tuple          =   {
    """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__					):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE							=    "unispeech-sat"

       def __init__(						self	,   __lowerCAmelCase=32	,   __lowerCAmelCase=768	,   __lowerCAmelCase=12	,   __lowerCAmelCase=12	,   __lowerCAmelCase=3072	,   __lowerCAmelCase="gelu"	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.0	,   __lowerCAmelCase=0.0	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=0.0_2	,   __lowerCAmelCase=1E-5	,   __lowerCAmelCase="group"	,   __lowerCAmelCase="gelu"	,   __lowerCAmelCase=(512, 512, 512, 512, 512, 512, 512)	,   __lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)	,   __lowerCAmelCase=(10, 3, 3, 3, 3, 2, 2)	,   __lowerCAmelCase=False	,   __lowerCAmelCase=128	,   __lowerCAmelCase=16	,   __lowerCAmelCase=False	,   __lowerCAmelCase=True	,   __lowerCAmelCase=0.0_5	,   __lowerCAmelCase=10	,   __lowerCAmelCase=2	,   __lowerCAmelCase=0.0	,   __lowerCAmelCase=10	,   __lowerCAmelCase=0	,   __lowerCAmelCase=320	,   __lowerCAmelCase=2	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase=100	,   __lowerCAmelCase=256	,   __lowerCAmelCase=256	,   __lowerCAmelCase=0.1	,   __lowerCAmelCase="mean"	,   __lowerCAmelCase=False	,   __lowerCAmelCase=False	,   __lowerCAmelCase=256	,   __lowerCAmelCase=(512, 512, 512, 512, 1500)	,   __lowerCAmelCase=(5, 3, 3, 1, 1)	,   __lowerCAmelCase=(1, 2, 3, 1, 1)	,   __lowerCAmelCase=512	,   __lowerCAmelCase=0	,   __lowerCAmelCase=1	,   __lowerCAmelCase=2	,   __lowerCAmelCase=504	,   **__lowerCAmelCase	,   )  ->  List[Any]:
        super().__init__(**__lowerCAmelCase	,   pad_token_id=__lowerCAmelCase	,   bos_token_id=__lowerCAmelCase	,   eos_token_id=__lowerCAmelCase )
        lowercase__				:    str  =					hidden_size
        lowercase__				:    Optional[Any]  =					feat_extract_norm
        lowercase__				:    int  =					feat_extract_activation
        lowercase__				:    Optional[int]  =					list(__lowerCAmelCase )
        lowercase__				:    Dict  =					list(__lowerCAmelCase )
        lowercase__				:    str  =					list(__lowerCAmelCase )
        lowercase__				:    List[str]  =					conv_bias
        lowercase__				:    Tuple  =					num_conv_pos_embeddings
        lowercase__				:    Dict  =					num_conv_pos_embedding_groups
        lowercase__				:    List[Any]  =					len(self.conv_dim )
        lowercase__				:    int  =					num_hidden_layers
        lowercase__				:    int  =					intermediate_size
        lowercase__				:    List[Any]  =					hidden_act
        lowercase__				:    Any  =					num_attention_heads
        lowercase__				:    List[str]  =					hidden_dropout
        lowercase__				:    List[Any]  =					attention_dropout
        lowercase__				:    int  =					activation_dropout
        lowercase__				:    Optional[int]  =					feat_proj_dropout
        lowercase__				:    int  =					final_dropout
        lowercase__				:    Tuple  =					layerdrop
        lowercase__				:    Union[str, Any]  =					layer_norm_eps
        lowercase__				:    Any  =					initializer_range
        lowercase__				:    Tuple  =					vocab_size
        lowercase__				:    List[str]  =					num_clusters
        lowercase__				:    Optional[Any]  =					do_stable_layer_norm
        lowercase__				:    Optional[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
        lowercase__				:    int  =					apply_spec_augment
        lowercase__				:    Any  =					mask_time_prob
        lowercase__				:    str  =					mask_time_length
        lowercase__				:    Any  =					mask_time_min_masks
        lowercase__				:    Any  =					mask_feature_prob
        lowercase__				:    Dict  =					mask_feature_length
        lowercase__				:    Optional[Any]  =					mask_feature_min_masks

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

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

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

        # XVector-specific parameters. Feel free to ignore for other classes.
        lowercase__				:    Optional[Any]  =					list(__lowerCAmelCase )
        lowercase__				:    int  =					list(__lowerCAmelCase )
        lowercase__				:    Any  =					list(__lowerCAmelCase )
        lowercase__				:    Dict  =					xvector_output_dim


       @property
       def _lowerCAmelCase(						self )  ->  List[Any]:
        return functools.reduce(operator.mul	,   self.conv_stride	,   1 )


'''simple docstring'''

from math import pow
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     ):
 if current_sum == needed_sum:
  # If the sum of the powers is equal to needed_sum, then we have a solution.
  solutions_count += 1
  return current_sum, solutions_count

 lowercase__				:    Optional[Any]  =					int(pow(UpperCAmelCase		,     UpperCAmelCase     )     )
 if current_sum + i_to_n <= needed_sum:
  # If the sum of the powers is less than needed_sum, then continue adding powers.
  current_sum += i_to_n
  lowercase__ ,							lowercase__				:    Dict  =					backtrack(
      UpperCAmelCase		,     UpperCAmelCase		,     current_number + 1		,     UpperCAmelCase		,     UpperCAmelCase     )
  current_sum -= i_to_n
 if i_to_n < needed_sum:
  # If the power of i is less than needed_sum, then try with the next power.
  lowercase__ ,							lowercase__				:    str  =					backtrack(
      UpperCAmelCase		,     UpperCAmelCase		,     current_number + 1		,     UpperCAmelCase		,     UpperCAmelCase     )
 return current_sum, solutions_count
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase     ):
 if not (1 <= needed_sum <= 1000 and 2 <= power <= 10):
  raise ValueError(
      '''Invalid input\n'''
      '''needed_sum must be between 1 and 1000, power between 2 and 10.'''     )

 return backtrack(UpperCAmelCase		,     UpperCAmelCase		,     1		,     0		,     0     )[1]  # Return the solutions_count


if __name__ == "__main__":
  import doctest

  doctest.testmod()

