code: 
  
  """simple docstring"""
  import argparse
  
  import torch
  
  from transformers import ImageGPTConfig, ImageGPTForCausalLM, load_tf_weights_in_imagegpt
  from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging
  
  
  logging.set_verbosity_info()
  
  
  
  
  def 				a__	(	lowerCAmelCase ,  lowerCAmelCase ,  lowerCAmelCase						)  ->   List[Any]:
        # Construct configuration depending on size
        UpperCAmelCase__ :       int   				=						{"""small""": (5_12, 8, 24), """medium""": (10_24, 8, 36), """large""": (15_36, 16, 48)}
        UpperCAmelCase__ :       List[Any]   				=						MODELS[model_size]  # set model hyperparameters
        UpperCAmelCase__ :       Optional[Any]   				=						ImageGPTConfig(n_embd=lowerCAmelCase ,  n_layer=lowerCAmelCase ,  n_head=lowerCAmelCase						)
        UpperCAmelCase__ :       Dict   				=						ImageGPTForCausalLM(lowerCAmelCase						)
  
        # Load weights from numpy
        load_tf_weights_in_imagegpt(lowerCAmelCase ,  lowerCAmelCase ,  lowerCAmelCase						)
  
        # Save pytorch-model
        UpperCAmelCase__ :       Any   				=						pytorch_dump_folder_path + """/""" + WEIGHTS_NAME
        UpperCAmelCase__ :       Optional[int]   				=						pytorch_dump_folder_path + """/""" + CONFIG_NAME
        print(F"""Save PyTorch model to {pytorch_weights_dump_path}"""						)
        torch.save(model.state_dict() ,  lowerCAmelCase						)
        print(F"""Save configuration file to {pytorch_config_dump_path}"""						)
        with open(lowerCAmelCase ,  """w""" ,  encoding="""utf-8"""						) as f:
              f.write(config.to_json_string()						)
  
  
  if __name__ == "__main__":
      _A						=     argparse.ArgumentParser()
      # Required parameters
      parser.add_argument(
          """--imagegpt_checkpoint_path""",
          default=None,
          type=str,
          required=True,
          help="""Path to the TensorFlow checkpoint path.""",
      )
      parser.add_argument(
          """--model_size""",
          default=None,
          type=str,
          required=True,
          help="""Size of the model (can be either 'small', 'medium' or 'large').""",
      )
      parser.add_argument(
          """--pytorch_dump_folder_path""", default=None, type=str, required=True, help="""Path to the output PyTorch model."""
      )
      _A						=     parser.parse_args()
      convert_imagegpt_checkpoint_to_pytorch(
          args.imagegpt_checkpoint_path, args.model_size, args.pytorch_dump_folder_path
      )
  
  
style_context: 
  
  """simple docstring"""
  def 				a__	(	lowerCAmelCase ,  lowerCAmelCase						)  ->   str:
        if not isinstance(lowerCAmelCase ,  lowerCAmelCase						):
              raise TypeError("""plaintext must be a string"""						)
        if not isinstance(lowerCAmelCase ,  lowerCAmelCase						):
              raise TypeError("""key must be a string"""						)
  
        if not plaintext:
              raise ValueError("""plaintext is empty"""						)
        if not key:
              raise ValueError("""key is empty"""						)
  
        key += plaintext
        UpperCAmelCase__ :       Dict						=						plaintext.lower()
        UpperCAmelCase__ :       Tuple						=						key.lower()
        UpperCAmelCase__ :       Optional[int]						=						0
        UpperCAmelCase__ :       Tuple						=						0
        UpperCAmelCase__ :       Optional[int]						=						""""""
        while plaintext_iterator < len(lowerCAmelCase						):
              if (
                  ord(plaintext[plaintext_iterator]						) < 97
                  or ord(plaintext[plaintext_iterator]						) > 1_22
              ):
                    ciphertext += plaintext[plaintext_iterator]
                    plaintext_iterator += 1
              elif ord(key[key_iterator]						) < 97 or ord(key[key_iterator]						) > 1_22:
                    key_iterator += 1
              else:
                    ciphertext += chr(
                        (
                            (ord(plaintext[plaintext_iterator]						) - 97 + ord(key[key_iterator]						))
                            - 97
                        )
                        % 26
                        + 97						)
                    key_iterator += 1
                    plaintext_iterator += 1
        return ciphertext
  
  
  
  
  def 				a__	(	lowerCAmelCase ,  lowerCAmelCase						)  ->   str:
        if not isinstance(lowerCAmelCase ,  lowerCAmelCase						):
              raise TypeError("""ciphertext must be a string"""						)
        if not isinstance(lowerCAmelCase ,  lowerCAmelCase						):
              raise TypeError("""key must be a string"""						)
  
        if not ciphertext:
              raise ValueError("""ciphertext is empty"""						)
        if not key:
              raise ValueError("""key is empty"""						)
  
        UpperCAmelCase__ :       Union[str, Any]						=						key.lower()
        UpperCAmelCase__ :       int						=						0
        UpperCAmelCase__ :       int						=						0
        UpperCAmelCase__ :       int						=						""""""
        while ciphertext_iterator < len(lowerCAmelCase						):
              if (
                  ord(ciphertext[ciphertext_iterator]						) < 97
                  or ord(ciphertext[ciphertext_iterator]						) > 1_22
              ):
                    plaintext += ciphertext[ciphertext_iterator]
              else:
                    plaintext += chr(
                        (ord(ciphertext[ciphertext_iterator]						) - ord(key[key_iterator]						)) % 26
                        + 97						)
                    key += chr(
                        (ord(ciphertext[ciphertext_iterator]						) - ord(key[key_iterator]						)) % 26
                        + 97						)
                    key_iterator += 1
              ciphertext_iterator += 1
        return plaintext
  
  
  if __name__ == "__main__":
      import doctest
  
      doctest.testmod()
      _A						=     int(input("""Type 1 to encrypt or 2 to decrypt:"""))
      if operation == 1:
          _A						=     input("""Typeplaintext to be encrypted:\n""")
          _A						=     input("""Type the key:\n""")
          print(encrypt(plaintext, key))
      elif operation == 2:
          _A						=     input("""Type the ciphertext to be decrypted:\n""")
          _A						=     input("""Type the key:\n""")
          print(decrypt(ciphertext, key))
      decrypt("""jsqqs avvwo""", """coffee""")
  
  