




from __future__ import annotations

import math
from collections.abc import Callable



def 						lowerCAmelCase		(		_lowerCAmelCase							:   Callable[[int | float], int | float]						,							_lowerCAmelCase							:   int | float						,							_lowerCAmelCase							:   int | float						,							_lowerCAmelCase							:   int = 100						,							):




 """simple docstring"""







 UpperCAmelCase__							 =						x_start
 UpperCAmelCase__							 =						fnc(SCREAMING_SNAKE_CASE_	)
 UpperCAmelCase__							 =						0.0

 for _ in range(SCREAMING_SNAKE_CASE_	):
  # Approximates curve as a sequence of linear lines and sums their length
  UpperCAmelCase__							 =						(x_end - x_start) / steps + xa
  UpperCAmelCase__							 =						fnc(SCREAMING_SNAKE_CASE_	)
  length += math.hypot(xa - xa						,							fxa - fxa	)

  # Increment step
  UpperCAmelCase__							 =						xa
  UpperCAmelCase__							 =						fxa

 return length


if __name__ == "__main__":



  def 						lowerCAmelCase		(		_lowerCAmelCase							:   Optional[Any]	):




   """simple docstring"""







   return math.sin(10 * x	)

  print("f(x) = sin(10 * x)")
  print("The length of the curve from x = -10 to x = 10 is:")
  _lowerCAmelCase						:   List[str]		=   1_0
  while i <= 1_0_0_0_0_0:
    print(F'''With {i} steps: {line_length(f, -1_0, 1_0, i)}''')
    i *= 1_0











import argparse
import os

import torch

from transformers.utils import WEIGHTS_NAME


_lowerCAmelCase						:   List[Any]		=   ["small", "medium", "large"]

_lowerCAmelCase						:   List[Any]		=   "lm_head.decoder.weight"
_lowerCAmelCase						:   Optional[int]		=   "lm_head.weight"



def 						lowerCAmelCase		(		_lowerCAmelCase							:   str						,							_lowerCAmelCase							:   str	):




 """simple docstring"""







 UpperCAmelCase__							 =						torch.load(_lowerCAmelCase	)
 UpperCAmelCase__							 =						d.pop(_lowerCAmelCase	)
 os.makedirs(_lowerCAmelCase						,							exist_ok=_lowerCAmelCase	)
 torch.save(_lowerCAmelCase						,							os.path.join(_lowerCAmelCase						,							_lowerCAmelCase	)	)


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





