





'''simple docstring'''




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 		__A		(  lowerCamelCase_			,			lowerCamelCase_	):


		"""simple docstring"""



		SCREAMING_SNAKE_CASE :				Tuple		=			torch.load(lowerCamelCase_	)
		SCREAMING_SNAKE_CASE :				Optional[int]		=			d.pop(lowerCamelCase_	)
		os.makedirs(lowerCamelCase_			,			exist_ok=lowerCamelCase_	)
		torch.save(lowerCamelCase_			,			os.path.join(lowerCamelCase_			,			lowerCamelCase_	)	)


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




from __future__ import annotations



def 		__A		(  lowerCamelCase_			,			lowerCamelCase_	):


		"""simple docstring"""



		if partitions <= 0:
				raise ValueError("""partitions must be a positive number!"""	)
		if partitions > number_of_bytes:
				raise ValueError("""partitions can not > number_of_bytes!"""	)
		SCREAMING_SNAKE_CASE :				int		=			number_of_bytes // partitions
		SCREAMING_SNAKE_CASE :				int		=			[]
		for i in range(lowerCamelCase_	):
				SCREAMING_SNAKE_CASE :				Optional[Any]		=			i * bytes_per_partition + 1
				SCREAMING_SNAKE_CASE :				Optional[int]		=			(
				    number_of_bytes if i == partitions - 1 else (i + 1) * bytes_per_partition
				)
				allocation_list.append(f'''{start_bytes}-{end_bytes}'''	)
		return allocation_list


if __name__ == "__main__":
							import doctest

							doctest.testmod()



