



"""simple docstring"""
from typing import List

from .keymap import KEYMAP, get_character

def       _snake_case						(						UpperCamelCase						:		str						):

 def decorator(UpperCamelCase						:		Union[str, Any]						):
  UpperCAmelCase	:					List[str]	=	getattr(UpperCamelCase			,		"""handle_key"""			,		[]						)
  handle += [key]
  setattr(UpperCamelCase			,		"""handle_key"""			,		UpperCamelCase						)
  return func

 return decorator

def       _snake_case						(						*UpperCamelCase						:		List[str]						):

 def decorator(UpperCamelCase						:		str						):
  UpperCAmelCase	:					Tuple	=	getattr(UpperCamelCase			,		"""handle_key"""			,		[]						)
  handle += keys
  setattr(UpperCamelCase			,		"""handle_key"""			,		UpperCamelCase						)
  return func

 return decorator



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):

   def __new__(   cls      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)  ->      Optional[Any]:





    '''simple docstring'''




    UpperCAmelCase	:					Tuple	=	super().__new__(cls      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE      ,     _SCREAMING_SNAKE_CASE						)
    if not hasattr(_SCREAMING_SNAKE_CASE      ,     """key_handler"""						):
     setattr(_SCREAMING_SNAKE_CASE      ,     """key_handler"""      ,     {}						)
    setattr(_SCREAMING_SNAKE_CASE      ,     """handle_input"""      ,     KeyHandler.handle_input						)

    for value in attrs.values():
     UpperCAmelCase	:					Any	=	getattr(_SCREAMING_SNAKE_CASE      ,     """handle_key"""      ,     []						)
     for key in handled_keys:
      UpperCAmelCase	:					Optional[Any]	=	value
    return new_cls




   @staticmethod
   def 	SCREAMING_SNAKE_CASE     (   cls						)  ->      Dict:





    '''simple docstring'''




    UpperCAmelCase	:					Any	=	get_character()
    if char != KEYMAP["undefined"]:
     UpperCAmelCase	:					Optional[Any]	=	ord(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Tuple	=	cls.key_handler.get(_SCREAMING_SNAKE_CASE						)
    if handler:
     UpperCAmelCase	:					Tuple	=	char
     return handler(cls						)
    else:
     return None

def       _snake_case						(						cls						:		Tuple						):
 return KeyHandler(cls.__name__			,		cls.__bases__			,		cls.__dict__.copy()						)





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_		(  a__							):
       UpperCAmelCase__				:					Optional[Any]        =  "speech_to_text_2"
       UpperCAmelCase__				:					List[Any]        =  ["past_key_values"]
       UpperCAmelCase__				:					Any        =  {"num_attention_heads": "decoder_attention_heads", "hidden_size": "d_model"}
       def __init__(			self,			SCREAMING_SNAKE_CASE_=1_0000,			SCREAMING_SNAKE_CASE_=6,			SCREAMING_SNAKE_CASE_=2048,			SCREAMING_SNAKE_CASE_=4,			SCREAMING_SNAKE_CASE_=0.0,			SCREAMING_SNAKE_CASE_=True,			SCREAMING_SNAKE_CASE_="relu",			SCREAMING_SNAKE_CASE_=256,			SCREAMING_SNAKE_CASE_=0.1,			SCREAMING_SNAKE_CASE_=0.0,			SCREAMING_SNAKE_CASE_=0.0,			SCREAMING_SNAKE_CASE_=0.02,			SCREAMING_SNAKE_CASE_=2,			SCREAMING_SNAKE_CASE_=True,			SCREAMING_SNAKE_CASE_=1,			SCREAMING_SNAKE_CASE_=0,			SCREAMING_SNAKE_CASE_=2,			SCREAMING_SNAKE_CASE_=1024,			**SCREAMING_SNAKE_CASE_,			)     ->		int:
          UpperCamelCase    :  Optional[int]							=	vocab_size
          UpperCamelCase    :  List[str]							=	d_model
          UpperCamelCase    :  List[str]							=	decoder_ffn_dim
          UpperCamelCase    :  Optional[Any]							=	decoder_layers
          UpperCamelCase    :  Any							=	decoder_attention_heads
          UpperCamelCase    :  Tuple							=	dropout
          UpperCamelCase    :  str							=	attention_dropout
          UpperCamelCase    :  str							=	activation_dropout
          UpperCamelCase    :  Union[str, Any]							=	activation_function
          UpperCamelCase    :  Optional[int]							=	init_std
          UpperCamelCase    :  Tuple							=	decoder_layerdrop
          UpperCamelCase    :  Dict							=	use_cache
          UpperCamelCase    :  Any							=	decoder_layers
          UpperCamelCase    :  Union[str, Any]							=	scale_embedding  # scale factor will be sqrt(d_model) if True
          UpperCamelCase    :  Union[str, Any]							=	max_target_positions

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



