





"""simple docstring"""




def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							int   ,				UpperCamelCase__:							List[str] = 13      ):
		SCREAMING_SNAKE_CASE__								= ''''''
		for c in s:
				if "A" <= c <= "Z":
						out += chr(ord("""A"""      ) + (ord(UpperCamelCase__      ) - ord("""A"""      ) + n) % 26      )
				elif "a" <= c <= "z":
						out += chr(ord("""a"""      ) + (ord(UpperCamelCase__      ) - ord("""a"""      ) + n) % 26      )
				else:
						out += c
		return out






def 			SCREAMING_SNAKE_CASE__							(    ):
		SCREAMING_SNAKE_CASE__								= input("""Enter message: """      )

		SCREAMING_SNAKE_CASE__								= dencrypt(UpperCamelCase__   ,				13      )
		print("""Encryption:"""   ,				UpperCamelCase__      )

		SCREAMING_SNAKE_CASE__								= dencrypt(UpperCamelCase__   ,				13      )
		print("""Decryption: """   ,				UpperCamelCase__      )


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	main()






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 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							Any   ,				UpperCamelCase__:							List[Any]   ,				UpperCamelCase__:							Union[str, Any]      ):
		# Construct configuration depending on size
		SCREAMING_SNAKE_CASE__								= {"""small""": (512, 8, 24), """medium""": (1_024, 8, 36), """large""": (1_536, 16, 48)}
		SCREAMING_SNAKE_CASE__		,  SCREAMING_SNAKE_CASE__		,  SCREAMING_SNAKE_CASE__								= MODELS[model_size]  # set model hyperparameters
		SCREAMING_SNAKE_CASE__								= ImageGPTConfig(n_embd=UpperCamelCase__   ,				n_layer=UpperCamelCase__   ,				n_head=UpperCamelCase__      )
		SCREAMING_SNAKE_CASE__								= ImageGPTForCausalLM(UpperCamelCase__      )

		# Load weights from numpy
		load_tf_weights_in_imagegpt(UpperCamelCase__   ,				UpperCamelCase__   ,				UpperCamelCase__      )

		# Save pytorch-model
		SCREAMING_SNAKE_CASE__								= pytorch_dump_folder_path + """/""" + WEIGHTS_NAME
		SCREAMING_SNAKE_CASE__								= pytorch_dump_folder_path + """/""" + CONFIG_NAME
		print(f'''Save PyTorch model to {pytorch_weights_dump_path}'''      )
		torch.save(model.state_dict()   ,				UpperCamelCase__      )
		print(f'''Save configuration file to {pytorch_config_dump_path}'''      )
		with open(UpperCamelCase__   ,				"""w"""   ,				encoding="""utf-8"""      ) as f:
				f.write(config.to_json_string()      )


if __name__ == "__main__":
	_lowerCamelCase							=     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.'
	)
	_lowerCamelCase							=     parser.parse_args()
	convert_imagegpt_checkpoint_to_pytorch(
	    args.imagegpt_checkpoint_path, args.model_size, args.pytorch_dump_folder_path
	)