




'''simple docstring'''



import argparse

import torch

from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging


logging.set_verbosity_info()







def       _UpperCamelCase			(_lowerCamelCase				:  Union[str, Any] ,						_lowerCamelCase				:  List[Any] ,						_lowerCamelCase				:  int						)-> Any:




     '''simple docstring'''





     if gpta_config_file == "":
          __snake_case            =	GPTaConfig()
     else:
          __snake_case            =	GPTaConfig.from_json_file(_lowerCamelCase						)
     __snake_case            =	GPTaModel(_lowerCamelCase						)

     # Load weights from numpy
     load_tf_weights_in_gpta(_lowerCamelCase ,						_lowerCamelCase ,						_lowerCamelCase						)

     # Save pytorch-model
     __snake_case            =	pytorch_dump_folder_path + '''/''' + WEIGHTS_NAME
     __snake_case            =	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__":
     UpperCAmelCase_							:	int	     =		argparse.ArgumentParser()
     # Required parameters
     parser.add_argument(
         '''--gpt2_checkpoint_path''', default=None, type=str, required=True, help='''Path to the TensorFlow checkpoint path.'''
     )
     parser.add_argument(
         '''--pytorch_dump_folder_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
     )
     parser.add_argument(
         '''--gpt2_config_file''',
         default='''''',
         type=str,
         help=(
             '''An optional config json file corresponding to the pre-trained OpenAI model. \n'''
             '''This specifies the model architecture.'''
         ),
     )
     UpperCAmelCase_							:	Optional[Any]	     =		parser.parse_args()
     convert_gpta_checkpoint_to_pytorch(args.gpta_checkpoint_path, args.gpta_config_file, args.pytorch_dump_folder_path)












'''simple docstring'''



def       _UpperCamelCase			(_lowerCamelCase				:  int						)-> int:




     '''simple docstring'''





     __snake_case            =	[[0 for _ in range(_lowerCamelCase						)] for _ in range(m + 1						)]
     for i in range(m + 1						):
          __snake_case            =	1

     for n in range(m + 1						):
          for k in range(1 ,						_lowerCamelCase						):
               memo[n][k] += memo[n][k - 1]
               if n - k > 0:
                    memo[n][k] += memo[n - k - 1][k]

     return memo[m][m - 1]


if __name__ == "__main__":
     import sys

     if len(sys.argv) == 1:
          try:
               UpperCAmelCase_							:	List[str]	     =		int(input('''Enter a number: ''').strip())
               print(partition(n))
          except ValueError:
               print('''Please enter a number.''')
     else:
          try:
               UpperCAmelCase_							:	Union[str, Any]	     =		int(sys.argv[1])
               print(partition(n))
          except ValueError:
               print('''Please pass a number.''')






