



"""simple docstring"""


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


snake_case_    					=	logging.get_logger(__name__)

snake_case_    					=	{
    """facebook/s2t-small-librispeech-asr""": (
        """https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json"""
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech_to_text
}







class 				A_      (					SCREAMING_SNAKE_CASE_    ):



      """simple docstring"""
      __UpperCamelCase		    =							"""speech_to_text"""
      __UpperCamelCase		    =							["""past_key_values"""]
      __UpperCamelCase		    =							{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}






      def __init__( self			:int       ,  lowercase_			:Any=1_00_00       ,  lowercase_			:List[Any]=12       ,  lowercase_			:List[str]=20_48       ,  lowercase_			:int=4       ,  lowercase_			:List[Any]=6       ,  lowercase_			:Optional[Any]=20_48       ,  lowercase_			:Dict=4       ,  lowercase_			:Optional[Any]=0.0       ,  lowercase_			:Any=0.0       ,  lowercase_			:List[Any]=True       ,  lowercase_			:int=True       ,  lowercase_			:Optional[Any]="relu"       ,  lowercase_			:List[str]=2_56       ,  lowercase_			:Optional[Any]=0.1       ,  lowercase_			:Dict=0.0       ,  lowercase_			:Union[str, Any]=0.0       ,  lowercase_			:Optional[int]=0.02       ,  lowercase_			:List[Any]=2       ,  lowercase_			:Dict=True       ,  lowercase_			:Optional[Any]=1       ,  lowercase_			:Union[str, Any]=0       ,  lowercase_			:Tuple=2       ,  lowercase_			:Tuple=60_00       ,  lowercase_			:Union[str, Any]=10_24       ,  lowercase_			:Dict=2       ,  lowercase_			:int=(5, 5)       ,  lowercase_			:str=10_24       ,  lowercase_			:Any=80       ,  lowercase_			:Tuple=1       ,  **lowercase_			:Dict       ,  )    ->      List[str]:
            UpperCAmelCase					=			vocab_size
            UpperCAmelCase					=			d_model
            UpperCAmelCase					=			encoder_ffn_dim
            UpperCAmelCase					=			encoder_layers
            UpperCAmelCase					=			encoder_attention_heads
            UpperCAmelCase					=			decoder_ffn_dim
            UpperCAmelCase					=			decoder_layers
            UpperCAmelCase					=			decoder_attention_heads
            UpperCAmelCase					=			dropout
            UpperCAmelCase					=			attention_dropout
            UpperCAmelCase					=			activation_dropout
            UpperCAmelCase					=			activation_function
            UpperCAmelCase					=			init_std
            UpperCAmelCase					=			encoder_layerdrop
            UpperCAmelCase					=			decoder_layerdrop
            UpperCAmelCase					=			use_cache
            UpperCAmelCase					=			encoder_layers
            UpperCAmelCase					=			scale_embedding  # scale factor will be sqrt(d_model) if True
            UpperCAmelCase					=			max_source_positions
            UpperCAmelCase					=			max_target_positions
            UpperCAmelCase					=			num_conv_layers
            UpperCAmelCase					=			list(lowercase_ )
            UpperCAmelCase					=			conv_channels
            UpperCAmelCase					=			input_feat_per_channel
            UpperCAmelCase					=			input_channels

            if len(self.conv_kernel_sizes ) != self.num_conv_layers:
                  raise ValueError(
                      'Configuration for convolutional module is incorrect. '
                      'It is required that `len(config.conv_kernel_sizes)` == `config.num_conv_layers` '
                      f"""but is `len(config.conv_kernel_sizes) = {len(self.conv_kernel_sizes )}`, """
                      f"""`config.num_conv_layers = {self.num_conv_layers}`.""" )

            super().__init__(
                pad_token_id=lowercase_       ,  bos_token_id=lowercase_       ,  eos_token_id=lowercase_       ,  is_encoder_decoder=lowercase_       ,  decoder_start_token_id=lowercase_       ,  **lowercase_       ,  )










"""simple docstring"""


import math

def 			_lowerCAmelCase				(       lowercase_						):
						assert isinstance(lowercase_		,     lowercase_						) and (
						    number >= 0
						), "'number' must been an int and positive"

						if 1 < number < 4:
												# 2 and 3 are primes
												return True
						elif number < 2 or not number % 2:
												# Negatives, 0, 1 and all even numbers are not primes
												return False

						UpperCAmelCase					=			range(3		,     int(math.sqrt(lowercase_						) + 1						)		,     2						)
						return not any(not number % i for i in odd_numbers						)






def 			_lowerCAmelCase				(       lowercase_		,     lowercase_=1		,     **lowercase_						):
						UpperCAmelCase					=			factor * value
						UpperCAmelCase					=			value

						while not is_prime(lowercase_						):
												value += 1 if not ("desc" in kwargs and kwargs["desc"] is True) else -1

						if value == first_value_val:
												return next_prime(value + 1		,     **lowercase_						)
						return value





