from typing import Union

import fire
import torch
from tqdm import tqdm




def        lowerCAmelCase_			(					__A,  __A = "cpu",  __A = None							)					->    None:







      '''simple docstring'''


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


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




def        lowerCAmelCase_			(					__A							)					->    str:







      '''simple docstring'''


      return " ".join(input_str.split()[::-1]							)


if __name__ == "__main__":
      import doctest

      doctest.testmod()



