



from __future__ import annotations


def  __lowerCamelCase (       lowerCamelCase__						):

				"""simple docstring"""


				if not nums:
								return 0
				lowercase__					:   int													=					nums[0]
				lowercase__					:   Dict													=					0
				for num in nums[1:]:
								lowercase__					:   Any													=					(
								    max_excluding + num,
								    max(a_					,			a_						),
								)
				return max(a_					,			a_						)


if __name__ == "__main__":
				import doctest

				doctest.testmod()









from typing import Union

import fire
import torch
from tqdm import tqdm


def  __lowerCamelCase (       lowerCamelCase__					,			lowerCamelCase__ = "cpu"					,			lowerCamelCase__ = None						):

				"""simple docstring"""


				lowercase__					:   Any													=					torch.load(lowerCamelCase__					,			map_location=lowerCamelCase__						)
				for k, v in tqdm(state_dict.items()						):
								if not isinstance(lowerCamelCase__					,			torch.Tensor						):
												raise TypeError("FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin"						)
								lowercase__					:   int													=					v.half()
				if save_path is None:  # overwrite src_path
								lowercase__					:   Optional[Any]													=					src_path
				torch.save(lowerCamelCase__					,			lowerCamelCase__						)


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




