




"""simple docstring"""




from typing import Union

import fire
import torch
from tqdm import tqdm







def      __UpperCAmelCase     ( __UpperCamelCase	,				__UpperCamelCase = "cpu"	,				__UpperCamelCase = None	):
			__lowercase			:  str								=       torch.load(__UpperCamelCase	,				map_location=__UpperCamelCase	)
			for k, v in tqdm(state_dict.items()	):
						if not isinstance(__UpperCamelCase	,				torch.Tensor	):
									raise TypeError('''FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'''	)
						__lowercase			:  Tuple								=       v.half()
			if save_path is None:  # overwrite src_path
						__lowercase			:  List[Any]								=       src_path
			torch.save(__UpperCamelCase	,				__UpperCamelCase	)


if __name__ == "__main__":
			fire.Fire(convert)







'''simple docstring'''



def      UpperCAmelCase__   (      UpperCAmelCase_       :							int = 1_00				)	->						int:
     __lowerCamelCase  :      Union[str, Any]														=						n * (n + 1) * (2 * n + 1) / 6
     __lowerCamelCase  :      Union[str, Any]														=						(n * (n + 1) / 2) ** 2
     return int(square_of_sum - sum_of_squares				)


if __name__ == "__main__":
      print(f'''{solution() = }''')






