




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


lowerCamelCase__ :   Tuple					=							logging.get_logger(__name__)

lowerCamelCase__ :   int					=							{}





class        lowerCamelCase_							(      _SCREAMING_SNAKE_CASE					):


 '''simple docstring'''







 lowercase_				    =    "llama"
 lowercase_				    =    ["past_key_values"]



 def __init__(							self  :		List[Any]				,				_lowerCAmelCase  :		Optional[Any]=32_000				,				_lowerCAmelCase  :		Optional[int]=4_096				,				_lowerCAmelCase  :		str=11_008				,				_lowerCAmelCase  :		Optional[Any]=32				,				_lowerCAmelCase  :		Tuple=32				,				_lowerCAmelCase  :		List[str]=None				,				_lowerCAmelCase  :		List[str]="silu"				,				_lowerCAmelCase  :		Optional[int]=2_048				,				_lowerCAmelCase  :		List[str]=0.02				,				_lowerCAmelCase  :		Dict=1E-6				,				_lowerCAmelCase  :		List[str]=True				,				_lowerCAmelCase  :		Any=0				,				_lowerCAmelCase  :		Tuple=1				,				_lowerCAmelCase  :		Any=2				,				_lowerCAmelCase  :		str=1				,				_lowerCAmelCase  :		List[str]=False				,				_lowerCAmelCase  :		List[Any]=None				,				**_lowerCAmelCase  :		Dict				,				):
       SCREAMING_SNAKE_CASE_							=			vocab_size
       SCREAMING_SNAKE_CASE_							=			max_position_embeddings
       SCREAMING_SNAKE_CASE_							=			hidden_size
       SCREAMING_SNAKE_CASE_							=			intermediate_size
       SCREAMING_SNAKE_CASE_							=			num_hidden_layers
       SCREAMING_SNAKE_CASE_							=			num_attention_heads

       # for backward compatibility
       if num_key_value_heads is None:
             SCREAMING_SNAKE_CASE_							=			num_attention_heads

       SCREAMING_SNAKE_CASE_							=			num_key_value_heads
       SCREAMING_SNAKE_CASE_							=			hidden_act
       SCREAMING_SNAKE_CASE_							=			initializer_range
       SCREAMING_SNAKE_CASE_							=			rms_norm_eps
       SCREAMING_SNAKE_CASE_							=			pretraining_tp
       SCREAMING_SNAKE_CASE_							=			use_cache
       SCREAMING_SNAKE_CASE_							=			rope_scaling
       self._rope_scaling_validation()

       super().__init__(
           pad_token_id=_lowerCAmelCase				,				bos_token_id=_lowerCAmelCase				,				eos_token_id=_lowerCAmelCase				,				tie_word_embeddings=_lowerCAmelCase				,				**_lowerCAmelCase				,				)




 def       lowerCAmelCase_  (							self  :		List[Any]						):
       if self.rope_scaling is None:
             return

       if not isinstance(self.rope_scaling				,				_lowerCAmelCase						) or len(self.rope_scaling						) != 2:
             raise ValueError(
                 '`rope_scaling` must be a dictionary with with two fields, `name` and `factor`, '
                 F"got {self.rope_scaling}"						)
       SCREAMING_SNAKE_CASE_							=			self.rope_scaling.get('type'				,				_lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_							=			self.rope_scaling.get('factor'				,				_lowerCAmelCase						)
       if rope_scaling_type is None or rope_scaling_type not in ["linear", "dynamic"]:
             raise ValueError(
                 F"`rope_scaling`'s name field must be one of ['linear', 'dynamic'], got {rope_scaling_type}"						)
       if rope_scaling_factor is None or not isinstance(_lowerCAmelCase				,				_lowerCAmelCase						) or rope_scaling_factor <= 1.0:
             raise ValueError(F"`rope_scaling`'s factor field must be an float > 1, got {rope_scaling_factor}"						)





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


lowerCamelCase__ :   List[str]					=							logging.get_logger(__name__)

lowerCamelCase__ :   List[str]					=							{
    '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        lowerCamelCase_							(      _SCREAMING_SNAKE_CASE					):


 '''simple docstring'''







 lowercase_				    =    "speech_to_text"
 lowercase_				    =    ["past_key_values"]
 lowercase_				    =    {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}



 def __init__(							self  :		Tuple				,				_lowerCAmelCase  :		List[Any]=10_000				,				_lowerCAmelCase  :		List[Any]=12				,				_lowerCAmelCase  :		Union[str, Any]=2_048				,				_lowerCAmelCase  :		Optional[int]=4				,				_lowerCAmelCase  :		Union[str, Any]=6				,				_lowerCAmelCase  :		Optional[int]=2_048				,				_lowerCAmelCase  :		Optional[Any]=4				,				_lowerCAmelCase  :		Any=0.0				,				_lowerCAmelCase  :		Optional[Any]=0.0				,				_lowerCAmelCase  :		List[str]=True				,				_lowerCAmelCase  :		List[Any]=True				,				_lowerCAmelCase  :		int="relu"				,				_lowerCAmelCase  :		Union[str, Any]=256				,				_lowerCAmelCase  :		List[str]=0.1				,				_lowerCAmelCase  :		str=0.0				,				_lowerCAmelCase  :		Tuple=0.0				,				_lowerCAmelCase  :		List[str]=0.02				,				_lowerCAmelCase  :		List[str]=2				,				_lowerCAmelCase  :		Tuple=True				,				_lowerCAmelCase  :		List[str]=1				,				_lowerCAmelCase  :		str=0				,				_lowerCAmelCase  :		str=2				,				_lowerCAmelCase  :		Union[str, Any]=6_000				,				_lowerCAmelCase  :		List[str]=1_024				,				_lowerCAmelCase  :		str=2				,				_lowerCAmelCase  :		Optional[Any]=(5, 5)				,				_lowerCAmelCase  :		str=1_024				,				_lowerCAmelCase  :		str=80				,				_lowerCAmelCase  :		Tuple=1				,				**_lowerCAmelCase  :		Any				,				):
       SCREAMING_SNAKE_CASE_							=			vocab_size
       SCREAMING_SNAKE_CASE_							=			d_model
       SCREAMING_SNAKE_CASE_							=			encoder_ffn_dim
       SCREAMING_SNAKE_CASE_							=			encoder_layers
       SCREAMING_SNAKE_CASE_							=			encoder_attention_heads
       SCREAMING_SNAKE_CASE_							=			decoder_ffn_dim
       SCREAMING_SNAKE_CASE_							=			decoder_layers
       SCREAMING_SNAKE_CASE_							=			decoder_attention_heads
       SCREAMING_SNAKE_CASE_							=			dropout
       SCREAMING_SNAKE_CASE_							=			attention_dropout
       SCREAMING_SNAKE_CASE_							=			activation_dropout
       SCREAMING_SNAKE_CASE_							=			activation_function
       SCREAMING_SNAKE_CASE_							=			init_std
       SCREAMING_SNAKE_CASE_							=			encoder_layerdrop
       SCREAMING_SNAKE_CASE_							=			decoder_layerdrop
       SCREAMING_SNAKE_CASE_							=			use_cache
       SCREAMING_SNAKE_CASE_							=			encoder_layers
       SCREAMING_SNAKE_CASE_							=			scale_embedding  # scale factor will be sqrt(d_model) if True
       SCREAMING_SNAKE_CASE_							=			max_source_positions
       SCREAMING_SNAKE_CASE_							=			max_target_positions
       SCREAMING_SNAKE_CASE_							=			num_conv_layers
       SCREAMING_SNAKE_CASE_							=			list(_lowerCAmelCase						)
       SCREAMING_SNAKE_CASE_							=			conv_channels
       SCREAMING_SNAKE_CASE_							=			input_feat_per_channel
       SCREAMING_SNAKE_CASE_							=			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=_lowerCAmelCase				,				bos_token_id=_lowerCAmelCase				,				eos_token_id=_lowerCAmelCase				,				is_encoder_decoder=_lowerCAmelCase				,				decoder_start_token_id=_lowerCAmelCase				,				**_lowerCAmelCase				,				)