





def     a_       (					lowerCAmelCase_ :     str      ):
   __lowerCAmelCase				      =      ''
   for ch in key:
      if ch == " " or ch not in key_no_dups and ch.isalpha():
         key_no_dups += ch
   return key_no_dups

def     a_       (					lowerCAmelCase_ :     str      ):
   __lowerCAmelCase				      =      [chr(i + 65      ) for i in range(26      )]
   # Remove duplicate characters from key
   __lowerCAmelCase				      =      remove_duplicates(key.upper()      )
   __lowerCAmelCase				      =      len(lowerCAmelCase_      )
   # First fill cipher with key characters
   __lowerCAmelCase				      =      {alphabet[i]: char for i, char in enumerate(lowerCAmelCase_      )}
   # Then map remaining characters in alphabet to
   # the alphabet from the beginning
   for i in range(len(lowerCAmelCase_      ),      26      ):
      __lowerCAmelCase				      =      alphabet[i - offset]
      # Ensure we are not mapping letters to letters previously mapped
      while char in key:
         offset -= 1
         __lowerCAmelCase				      =      alphabet[i - offset]
      __lowerCAmelCase				      =      char
   return cipher_alphabet

def     a_       (					lowerCAmelCase_ :     str,      lowerCAmelCase_ :     dict[str, str]      ):
   return "".join(cipher_map.get(lowerCAmelCase_,      lowerCAmelCase_      ) for ch in message.upper()      )

def     a_       (					lowerCAmelCase_ :     str,      lowerCAmelCase_ :     dict[str, str]      ):
   __lowerCAmelCase				      =      {v: k for k, v in cipher_map.items()}
   return "".join(rev_cipher_map.get(lowerCAmelCase_,      lowerCAmelCase_      ) for ch in message.upper()      )

def     a_       (					):
   __lowerCAmelCase				      =      input('Enter message to encode or decode: '      ).strip()
   __lowerCAmelCase				      =      input('Enter keyword: '      ).strip()
   __lowerCAmelCase				      =      input('Encipher or decipher? E/D:'      ).strip()[0].lower()
   try:
      __lowerCAmelCase				      =      {'e': encipher, 'd': decipher}[option]
   except KeyError:
      raise KeyError('invalid input option'      )
   __lowerCAmelCase				      =      create_cipher_map(lowerCAmelCase_      )
   print(func(lowerCAmelCase_,      lowerCAmelCase_      )      )


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()






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


UpperCAmelCase_		 =					logging.get_logger(__name__)

UpperCAmelCase_		 =					{"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""}


class 	lowerCamelCase__	(       _A):



 """simple docstring"""

 a__					: int =  "openai-gpt"
 a__					: Dict =  {
     "max_position_embeddings": "n_positions",
     "hidden_size": "n_embd",
     "num_attention_heads": "n_head",
     "num_hidden_layers": "n_layer",
 }

 def __init__(    self					:					Union[str, Any]			,						__lowerCAmelCase					:					int=4_04_78			,						__lowerCAmelCase					:					Tuple=5_12			,						__lowerCAmelCase					:					str=7_68			,						__lowerCAmelCase					:					List[Any]=12			,						__lowerCAmelCase					:					Any=12			,						__lowerCAmelCase					:					Dict="gelu"			,						__lowerCAmelCase					:					Union[str, Any]=0.1			,						__lowerCAmelCase					:					Optional[int]=0.1			,						__lowerCAmelCase					:					Any=0.1			,						__lowerCAmelCase					:					List[str]=1E-5			,						__lowerCAmelCase					:					Optional[int]=0.02			,						__lowerCAmelCase					:					Optional[Any]="cls_index"			,						__lowerCAmelCase					:					str=True			,						__lowerCAmelCase					:					int=None			,						__lowerCAmelCase					:					Optional[int]=True			,						__lowerCAmelCase					:					Optional[Any]=0.1			,						**__lowerCAmelCase					:					Tuple			,						)   ->	Optional[Any]:
    _A      =       vocab_size
    _A      =       n_positions
    _A      =       n_embd
    _A      =       n_layer
    _A      =       n_head
    _A      =       afn
    _A      =       resid_pdrop
    _A      =       embd_pdrop
    _A      =       attn_pdrop
    _A      =       layer_norm_epsilon
    _A      =       initializer_range
    _A      =       summary_type
    _A      =       summary_use_proj
    _A      =       summary_activation
    _A      =       summary_first_dropout
    _A      =       summary_proj_to_labels
    super().__init__(**__lowerCAmelCase      )



