




a__		     =     {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []}

a__		     =     {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]}





def 				A__ (snake_case   :		dict[int, list[int]]		,	snake_case   :		int		,	snake_case   :		list[bool]				)     ->						list[int]:
					__UpperCamelCase					:	Optional[Any]             =      True
					__UpperCamelCase					:	Optional[Any]             =      []

					for neighbour in graph[vert]:
										if not visited[neighbour]:
															order += topology_sort(snake_case		,	snake_case		,	snake_case				)

					order.append(snake_case				)

					return order





def 				A__ (snake_case   :		dict[int, list[int]]		,	snake_case   :		int		,	snake_case   :		list[bool]				)     ->						list[int]:
					__UpperCamelCase					:	Optional[int]             =      True
					__UpperCamelCase					:	List[str]             =      [vert]

					for neighbour in reversed_graph[vert]:
										if not visited[neighbour]:
															component += find_components(snake_case		,	snake_case		,	snake_case				)

					return component







def 				A__ (snake_case   :		dict[int, list[int]]				)     ->						list[list[int]]:
					__UpperCamelCase					:	Any             =      len(snake_case				) * [False]
					__UpperCamelCase					:	dict[int, list[int]]             =      {vert: [] for vert in range(len(snake_case				)				)}

					for vert, neighbours in graph.items():
										for neighbour in neighbours:
															reversed_graph[neighbour].append(snake_case				)

					__UpperCamelCase					:	Optional[int]             =      []
					for i, was_visited in enumerate(snake_case				):
										if not was_visited:
															order += topology_sort(snake_case		,	snake_case		,	snake_case				)

					__UpperCamelCase					:	int             =      []
					__UpperCamelCase					:	List[Any]             =      len(snake_case				) * [False]

					for i in range(len(snake_case				)				):
										__UpperCamelCase					:	Tuple             =      order[len(snake_case				) - i - 1]
										if not visited[vert]:
															__UpperCamelCase					:	Dict             =      find_components(snake_case		,	snake_case		,	snake_case				)
															components_list.append(snake_case				)

					return components_list












import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


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

a__		     =     '''lm_head.decoder.weight'''
a__		     =     '''lm_head.weight'''





def 				A__ (snake_case   :		str		,	snake_case   :		str				)     ->						Union[str, Any]:
					__UpperCamelCase					:	Union[str, Any]             =      torch.load(snake_case				)
					__UpperCamelCase					:	int             =      d.pop(snake_case				)
					os.makedirs(snake_case		,	exist_ok=snake_case				)
					torch.save(snake_case		,	os.path.join(snake_case		,	snake_case				)				)


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






