






'''simple docstring'''







def 						A__			(				__lowerCAmelCase		:			int						):
						lowerCamelCase__         =  abs(__lowerCAmelCase						)
						lowerCamelCase__         =  0
						while n > 0:
												res += n % 10
												n //= 10
						return res
def 						A__			(				__lowerCAmelCase		:			int						):
						lowerCamelCase__         =  abs(__lowerCAmelCase						)
						return n if n < 10 else n % 10 + sum_of_digits(n // 10						)
def 						A__			(				__lowerCAmelCase		:			int						):
						return sum(int(__lowerCAmelCase						) for c in str(abs(__lowerCAmelCase						)						)						)
def 						A__			(				):
						from collections.abc import Callable
						from timeit import timeit

						def benchmark_a_function(__lowerCAmelCase		:			Callable   ,    __lowerCAmelCase		:			int						) -> None:
												lowerCamelCase__         =  F'''{func.__name__}({value})'''
												lowerCamelCase__         =  timeit(F'''__main__.{call}'''   ,    setup="""import __main__"""						)
												print(F'''{call:56} = {func(__lowerCAmelCase						)} -- {timing:.4f} seconds'''						)

						for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
												for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
																		benchmark_a_function(__lowerCAmelCase   ,    __lowerCAmelCase						)
												print()


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							benchmark()









'''simple docstring'''







import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


UpperCamelCase    :      Optional[Any]  			=		['small', 'medium', 'large']

UpperCamelCase    :      Dict  			=		'lm_head.decoder.weight'
UpperCamelCase    :      int  			=		'lm_head.weight'
def 						A__			(				__lowerCAmelCase		:			str   ,    __lowerCAmelCase		:			str						):
						lowerCamelCase__         =  torch.load(__lowerCAmelCase						)
						lowerCamelCase__         =  d.pop(__lowerCAmelCase						)
						os.makedirs(__lowerCAmelCase   ,    exist_ok=__lowerCAmelCase						)
						torch.save(__lowerCAmelCase   ,    os.path.join(__lowerCAmelCase   ,    __lowerCAmelCase						)						)


if __name__ == "__main__":
							UpperCamelCase    :      Any  			=		argparse.ArgumentParser()
							parser.add_argument('--dialogpt_path', default='.', type=str)
							UpperCamelCase    :      Dict  			=		parser.parse_args()
							for MODEL in DIALOGPT_MODELS:
														UpperCamelCase    :      Any  			=		os.path.join(args.dialogpt_path, F'{MODEL}_ft.pkl')
														UpperCamelCase    :      str  			=		F'./DialoGPT-{MODEL}'
														convert_dialogpt_checkpoint(
														    checkpoint_path,
														    pytorch_dump_folder_path,
														)

