'''simple docstring'''






def  UpperCamelCase__					(					_lowercase    :				Optional[Any]     )							->	int:
  # if the collection is empty, returns empty
  if collection == []:
    return []

  # get some information about the collection
  __UpperCAmelCase:					Optional[int]		= len(_lowercase     )
  __UpperCAmelCase:					Any		= max(_lowercase     )
  __UpperCAmelCase:					Any		= min(_lowercase     )

  # create the counting array
  __UpperCAmelCase:					Optional[int]		= coll_max + 1 - coll_min
  __UpperCAmelCase:					Optional[Any]		= [0] * counting_arr_length

  # count how much a number appears in the collection
  for number in collection:
    counting_arr[number - coll_min] += 1

  # sum each position with it's predecessors. now, counting_arr[i] tells
  # us how many elements <= i has in the collection
  for i in range(1   ,    _lowercase     ):
    __UpperCAmelCase:					Any		= counting_arr[i] + counting_arr[i - 1]

  # create the output collection
  __UpperCAmelCase:					Any		= [0] * coll_len

  # place the elements in the output, respecting the original order (stable
  # sort) from end to begin, updating counting_arr
  for i in reversed(range(0   ,    _lowercase     )     ):
    __UpperCAmelCase:					Optional[Any]		= collection[i]
    counting_arr[collection[i] - coll_min] -= 1

  return ordered






def  UpperCamelCase__					(					_lowercase    :				Dict     )							->	Dict:
  return "".join([chr(_lowercase     ) for i in counting_sort([ord(_lowercase     ) for c in string]     )]     )


if __name__ == "__main__":
    # Test string sort
    assert counting_sort_string('thisisthestring') == "eghhiiinrsssttt"

    SCREAMING_SNAKE_CASE_	   =			input('Enter numbers separated by a comma:\n').strip()
    SCREAMING_SNAKE_CASE_	   =			[int(item) for item in user_input.split(',')]
    print(counting_sort(unsorted))
'''simple docstring'''






import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


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

SCREAMING_SNAKE_CASE_	   =			'lm_head.decoder.weight'
SCREAMING_SNAKE_CASE_	   =			'lm_head.weight'






def  UpperCamelCase__					(					_lowercase    :				str   ,    _lowercase    :				str     )							->	List[str]:
  __UpperCAmelCase:					Tuple		= torch.load(_lowercase     )
  __UpperCAmelCase:					Tuple		= d.pop(_lowercase     )
  os.makedirs(_lowercase   ,    exist_ok=_lowercase     )
  torch.save(_lowercase   ,    os.path.join(_lowercase   ,    _lowercase     )     )


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