import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


UpperCamelCase__											=   ['''small''', '''medium''', '''large''']

UpperCamelCase__											=   '''lm_head.decoder.weight'''
UpperCamelCase__											=   '''lm_head.weight'''




def   lowerCAmelCase_					(	__A,    __A				)	->							Tuple:







      '''simple docstring'''


      UpperCAmelCase__								=    torch.load(_lowercase				)
      UpperCAmelCase__								=    d.pop(_lowercase				)
      os.makedirs(_lowercase,    exist_ok=_lowercase				)
      torch.save(_lowercase,    os.path.join(_lowercase,    _lowercase				)				)


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










"""simple docstring"""




def  _SCREAMING_SNAKE_CASE						(      _lowercase		:       list[int]   )					->float:






	'''simple docstring'''






	if not nums:  # Makes sure that the list is not empty
		raise ValueError("List is empty"   )

	a :						Dict      =							sum(_lowercase   ) / len(_lowercase   )  # Calculate the average
	return sum(abs(x - average   ) for x in nums   ) / len(_lowercase   )


if __name__ == "__main__":
		import doctest

		doctest.testmod()


