





import numpy as np

UpperCamelCase__      =[
    ['a', 'b', 'c', 'd', 'e'],
    ['f', 'g', 'h', 'i', 'k'],
    ['l', 'm', 'n', 'o', 'p'],
    ['q', 'r', 's', 't', 'u'],
    ['v', 'w', 'x', 'y', 'z'],
]





class 			lowerCAmelCase__:






       '''simple docstring'''


       def __init__(      self							)			->     None:
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							np.array(__lowerCamelCase							)




       def     UpperCamelCase_			(      self    ,						__lowerCamelCase							)			->     np.ndarray:
            _SCREAMING_SNAKE_CASE    ,			_SCREAMING_SNAKE_CASE       :	Optional[int]						    =							np.where(letter == self.SQUARE							)
            _SCREAMING_SNAKE_CASE       :	str						    =							np.concatenate([indexa + 1, indexa + 1]							)
            return indexes




       def     UpperCamelCase_			(      self    ,						__lowerCamelCase    ,						__lowerCamelCase							)			->     str:
            _SCREAMING_SNAKE_CASE       :	int						    =							self.SQUARE[indexa - 1, indexa - 1]
            return letter




       def     UpperCamelCase_			(      self    ,						__lowerCamelCase							)			->     str:
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							message.lower()
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							message.replace(" "    ,						""							)
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							message.replace("j"    ,						"i"							)

            _SCREAMING_SNAKE_CASE       :	Any						    =							np.empty((2, len(__lowerCamelCase							))							)
            for letter_index in range(len(__lowerCamelCase							)							):
                 _SCREAMING_SNAKE_CASE       :	Dict						    =							self.letter_to_numbers(message[letter_index]							)

                 _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							numbers[0]
                 _SCREAMING_SNAKE_CASE       :	Tuple						    =							numbers[1]

            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							first_step.reshape(2 * len(__lowerCamelCase							)							)
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							""
            for numbers_index in range(len(__lowerCamelCase							)							):
                 _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							int(second_step[numbers_index * 2]							)
                 _SCREAMING_SNAKE_CASE       :	str						    =							int(second_step[(numbers_index * 2) + 1]							)
                 _SCREAMING_SNAKE_CASE       :	int						    =							self.numbers_to_letter(__lowerCamelCase    ,						__lowerCamelCase							)
                 _SCREAMING_SNAKE_CASE       :	Dict						    =							encoded_message + letter

            return encoded_message







       def     UpperCamelCase_			(      self    ,						__lowerCamelCase							)			->     str:
            _SCREAMING_SNAKE_CASE       :	Dict						    =							message.lower()
            message.replace(" "    ,						""							)
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							np.empty(2 * len(__lowerCamelCase							)							)
            for letter_index in range(len(__lowerCamelCase							)							):
                 _SCREAMING_SNAKE_CASE       :	List[str]						    =							self.letter_to_numbers(message[letter_index]							)
                 _SCREAMING_SNAKE_CASE       :	int						    =							numbers[0]
                 _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							numbers[1]

            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							first_step.reshape((2, len(__lowerCamelCase							))							)
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							""
            for numbers_index in range(len(__lowerCamelCase							)							):
                 _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							int(second_step[0, numbers_index]							)
                 _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							int(second_step[1, numbers_index]							)
                 _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							self.numbers_to_letter(__lowerCamelCase    ,						__lowerCamelCase							)
                 _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							decoded_message + letter

            return decoded_message






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


UpperCamelCase__      =logging.get_logger(__name__)

UpperCamelCase__      ={
    'facebook/s2t-wav2vec2-large-en-de': (
        'https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json'
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}





class 			lowerCAmelCase__( __lowercase    ):






       '''simple docstring'''


       __snake_case 			=    'speech_to_text_2'
       __snake_case 			=    ['past_key_values']
       __snake_case 			=    {'num_attention_heads': 'decoder_attention_heads', 'hidden_size': 'd_model'}




       def __init__(      self    ,						__lowerCamelCase=1_0_0_0_0    ,						__lowerCamelCase=6    ,						__lowerCamelCase=2_0_4_8    ,						__lowerCamelCase=4    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=True    ,						__lowerCamelCase="relu"    ,						__lowerCamelCase=2_5_6    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=0.02    ,						__lowerCamelCase=2    ,						__lowerCamelCase=True    ,						__lowerCamelCase=1    ,						__lowerCamelCase=0    ,						__lowerCamelCase=2    ,						__lowerCamelCase=1_0_2_4    ,						**__lowerCamelCase    ,						)			->     Optional[int]:
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							vocab_size
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							d_model
            _SCREAMING_SNAKE_CASE       :	Dict						    =							decoder_ffn_dim
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							decoder_layers
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							decoder_attention_heads
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							dropout
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							attention_dropout
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							activation_dropout
            _SCREAMING_SNAKE_CASE       :	Dict						    =							activation_function
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							init_std
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							decoder_layerdrop
            _SCREAMING_SNAKE_CASE       :	int						    =							use_cache
            _SCREAMING_SNAKE_CASE       :	int						    =							decoder_layers
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							scale_embedding  # scale factor will be sqrt(d_model) if True
            _SCREAMING_SNAKE_CASE       :	str						    =							max_target_positions

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