






'''simple docstring'''







def 						A__			(				__lowerCAmelCase		:			int | float | str						):
						try:
												lowerCamelCase__         =  float(__lowerCAmelCase						)
						except ValueError:
												raise ValueError("""Please enter a valid number"""						)
						lowerCamelCase__         =  decimal - int(__lowerCAmelCase						)
						if fractional_part == 0:
												return int(__lowerCAmelCase						), 1
						else:
												lowerCamelCase__         =  len(str(__lowerCAmelCase						).split("""."""						)[1]						)
												lowerCamelCase__         =  int(decimal * (10**number_of_frac_digits)						)
												lowerCamelCase__         =  10**number_of_frac_digits
												lowerCamelCase__       ,			lowerCamelCase__         =  denominator, numerator
												while True:
																		lowerCamelCase__         =  dividend % divisor
																		if remainder == 0:
																								break
																		lowerCamelCase__       ,			lowerCamelCase__         =  divisor, remainder
												lowerCamelCase__       ,			lowerCamelCase__         =  numerator / divisor, denominator / divisor
												return int(__lowerCAmelCase						), int(__lowerCAmelCase						)


if __name__ == "__main__":
							print(F'{decimal_to_fraction(2) = }')
							print(F'{decimal_to_fraction(89.0) = }')
							print(F'{decimal_to_fraction("67") = }')
							print(F'{decimal_to_fraction("45.0") = }')
							print(F'{decimal_to_fraction(1.5) = }')
							print(F'{decimal_to_fraction("6.25") = }')
							print(F'{decimal_to_fraction("78td") = }')









'''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,
														)

