






'''simple docstring'''





import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin





class 		SCREAMING_SNAKE_CASE__ (  unittest.TestCase		,		lowercase_     ):



		def _lowerCAmelCase  (     self:     Optional[int])	->List[str]:






								'''simple docstring'''


								a_					  = load_tool("text-classification")
								self.tool.setup()
								a_					  = load_tool("text-classification"					, remote=a)



		def _lowerCAmelCase  (     self:     Optional[int])	->Optional[int]:






								'''simple docstring'''


								a_					  = self.tool("That's quite cool"					, ["positive", "negative"])
								self.assertEqual(a					, "positive")



		def _lowerCAmelCase  (     self:     str)	->int:






								'''simple docstring'''


								a_					  = self.remote_tool("That's quite cool"					, ["positive", "negative"])
								self.assertEqual(a					, "positive")



		def _lowerCAmelCase  (     self:     List[str])	->List[str]:






								'''simple docstring'''


								a_					  = self.tool(text="That's quite cool"					, labels=["positive", "negative"])
								self.assertEqual(a					, "positive")




		def _lowerCAmelCase  (     self:     Any)	->Optional[Any]:






								'''simple docstring'''


								a_					  = self.remote_tool(text="That's quite cool"					, labels=["positive", "negative"])
								self.assertEqual(a					, "positive")











'''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 		__SCREAMING_SNAKE_CASE       (	_UpperCamelCase    ,		_UpperCamelCase				):


   """simple docstring"""




   lowercase_						:     Optional[Any]							     =  torch.load(_UpperCamelCase				)
   lowercase_						:     List[Any]							     =  d.pop(_UpperCamelCase				)
   os.makedirs(_UpperCamelCase    ,		exist_ok=_UpperCamelCase				)
   torch.save(_UpperCamelCase    ,		os.path.join(_UpperCamelCase    ,		_UpperCamelCase				)				)


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




