

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 				snake_case_(_UpperCamelCase			,	_UpperCamelCase					)							->     Optional[int]:



  """simple docstring"""






  _snake_case						=							torch.load(_UpperCamelCase					)
  _snake_case						=							d.pop(_UpperCamelCase					)
  os.makedirs(_UpperCamelCase			,	exist_ok=_UpperCamelCase					)
  torch.save(_UpperCamelCase			,	os.path.join(_UpperCamelCase			,	_UpperCamelCase					)					)


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




import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
 import ctypes
 import msvcrt  # noqa



 class   lowercase_   (  ctypes.Structure					):
       # _fields is a specific attr expected by ctypes
       UpperCamelCase_      :		List[Any]										=    [("size", ctypes.c_int), ("visible", ctypes.c_byte)]



def 				snake_case_()							->     int:



  """simple docstring"""






  if os.name == "nt":
    _snake_case						=							CursorInfo()
    _snake_case						=							ctypes.windll.kernelaa.GetStdHandle(-11					)
    ctypes.windll.kernelaa.GetConsoleCursorInfo(_UpperCamelCase			,	ctypes.byref(_UpperCamelCase					)					)
    _snake_case						=							False
    ctypes.windll.kernelaa.SetConsoleCursorInfo(_UpperCamelCase			,	ctypes.byref(_UpperCamelCase					)					)
  elif os.name == "posix":
    sys.stdout.write('''\033[?25l'''					)
    sys.stdout.flush()



def 				snake_case_()							->     Optional[Any]:



  """simple docstring"""






  if os.name == "nt":
    _snake_case						=							CursorInfo()
    _snake_case						=							ctypes.windll.kernelaa.GetStdHandle(-11					)
    ctypes.windll.kernelaa.GetConsoleCursorInfo(_UpperCamelCase			,	ctypes.byref(_UpperCamelCase					)					)
    _snake_case						=							True
    ctypes.windll.kernelaa.SetConsoleCursorInfo(_UpperCamelCase			,	ctypes.byref(_UpperCamelCase					)					)
  elif os.name == "posix":
    sys.stdout.write('''\033[?25h'''					)
    sys.stdout.flush()



@contextmanager
def 				snake_case_()							->     int:



  """simple docstring"""






  try:
    hide_cursor()
    yield
  finally:
    show_cursor()

