

'''simple docstring'''





from typing import Union

import fire
import torch
from tqdm import tqdm

def    A_  (							a					,   a = "cpu"					,   a = None  ):

      """simple docstring"""



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


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









def    A_  (							a					,   a  ):

      """simple docstring"""



      return numa ^ numa < 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()






