'''simple docstring'''






class    a :



  """simple docstring"""







  def __init__(							self   ,    snake_case_   ,    snake_case_=None   ,    snake_case_=None					):

    '''simple docstring'''







    __UpperCAmelCase:					List[str]		= data
    __UpperCAmelCase:					List[Any]		= previous
    __UpperCAmelCase:					Any		= next_node







  def __str__(							self					):

    '''simple docstring'''







    return F'''{self.data}'''







  def    lowercase_  (							self					):

    '''simple docstring'''







    return self.data







  def    lowercase_  (							self					):

    '''simple docstring'''







    return self.next







  def    lowercase_  (							self					):

    '''simple docstring'''







    return self.previous




class    a :



  """simple docstring"""







  def __init__(							self   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Tuple		= head







  def __iter__(							self					):

    '''simple docstring'''







    return self







  def    lowercase_  (							self					):

    '''simple docstring'''







    if not self.current:
      raise StopIteration
    else:
      __UpperCAmelCase:					Union[str, Any]		= self.current.get_data()
      __UpperCAmelCase:					Tuple		= self.current.get_next()
      return value




class    a :



  """simple docstring"""







  def __init__(							self					):

    '''simple docstring'''







    __UpperCAmelCase:					Optional[Any]		= None  # First node in list
    __UpperCAmelCase:					Optional[int]		= None  # Last node in list







  def __str__(							self					):

    '''simple docstring'''







    __UpperCAmelCase:					Tuple		= self.head
    __UpperCAmelCase:					str		= []
    while current is not None:
      nodes.append(current.get_data()					)
      __UpperCAmelCase:					Any		= current.get_next()
    return " ".join(str(snake_case_					) for node in nodes					)







  def __contains__(							self   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Optional[Any]		= self.head
    while current:
      if current.get_data() == value:
        return True
      __UpperCAmelCase:					str		= current.get_next()
    return False







  def __iter__(							self					):

    '''simple docstring'''







    return LinkedListIterator(self.head					)







  def    lowercase_  (							self					):

    '''simple docstring'''







    if self.head:
      return self.head.get_data()
    return None







  def    lowercase_  (							self					):

    '''simple docstring'''







    if self.tail:
      return self.tail.get_data()
    return None







  def    lowercase_  (							self   ,    snake_case_					):

    '''simple docstring'''







    if self.head is None:
      __UpperCAmelCase:					Any		= node
      __UpperCAmelCase:					str		= node
    else:
      self.insert_before_node(self.head   ,    snake_case_					)







  def    lowercase_  (							self   ,    snake_case_					):

    '''simple docstring'''







    if self.head is None:
      self.set_head(snake_case_					)
    else:
      self.insert_after_node(self.tail   ,    snake_case_					)







  def    lowercase_  (							self   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					List[Any]		= Node(snake_case_					)
    if self.head is None:
      self.set_head(snake_case_					)
    else:
      self.set_tail(snake_case_					)







  def    lowercase_  (							self   ,    snake_case_   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Any		= node
    __UpperCAmelCase:					List[str]		= node.previous

    if node.get_previous() is None:
      __UpperCAmelCase:					Union[str, Any]		= node_to_insert
    else:
      __UpperCAmelCase:					int		= node_to_insert

    __UpperCAmelCase:					Optional[int]		= node_to_insert







  def    lowercase_  (							self   ,    snake_case_   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Tuple		= node
    __UpperCAmelCase:					Optional[int]		= node.next

    if node.get_next() is None:
      __UpperCAmelCase:					List[Any]		= node_to_insert
    else:
      __UpperCAmelCase:					List[Any]		= node_to_insert

    __UpperCAmelCase:					Optional[int]		= node_to_insert







  def    lowercase_  (							self   ,    snake_case_   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Any		= 1
    __UpperCAmelCase:					Dict		= Node(snake_case_					)
    __UpperCAmelCase:					Tuple		= self.head
    while node:
      if current_position == position:
        self.insert_before_node(snake_case_   ,    snake_case_					)
        return
      current_position += 1
      __UpperCAmelCase:					Optional[int]		= node.next
    self.insert_after_node(self.tail   ,    snake_case_					)







  def    lowercase_  (							self   ,    snake_case_					):

    '''simple docstring'''







    __UpperCAmelCase:					Any		= self.head
    while node:
      if node.get_data() == item:
        return node
      __UpperCAmelCase:					Union[str, Any]		= node.get_next()
    raise Exception("""Node not found"""					)







  def    lowercase_  (							self   ,    snake_case_					):

    '''simple docstring'''







    if (node := self.get_node(snake_case_					)) is not None:
      if node == self.head:
        __UpperCAmelCase:					Optional[Any]		= self.head.get_next()

      if node == self.tail:
        __UpperCAmelCase:					str		= self.tail.get_previous()

      self.remove_node_pointers(snake_case_					)







  @staticmethod
  def    lowercase_  (							snake_case_					):

    '''simple docstring'''







    if node.get_next():
      __UpperCAmelCase:					Dict		= node.previous

    if node.get_previous():
      __UpperCAmelCase:					List[str]		= node.next

    __UpperCAmelCase:					Optional[Any]		= None
    __UpperCAmelCase:					str		= None







  def    lowercase_  (							self					):

    '''simple docstring'''







    return self.head is None






def  UpperCamelCase__					(					)							->	None:
  pass


if __name__ == "__main__":
    import doctest

    doctest.testmod()
'''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,
        )