'''simple docstring'''




from typing import Union

import fire
import torch
from tqdm import tqdm






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__ = "cpu"    ,  UpperCamelCase__ = None    )     ->   None:
    __lowerCamelCase          =  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'''    )
        __lowerCamelCase          =  v.half()
    if save_path is None:  # overwrite src_path
        __lowerCamelCase          =  src_path
    torch.save(UpperCamelCase__    ,  UpperCamelCase__    )


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

'''simple docstring'''




def __lowerCAmelCase			(							UpperCamelCase__    )     ->   str:
    return "".join(chr(ord(UpperCamelCase__    ) - 32    ) if '''a''' <= char <= '''z''' else char for char in word    )


if __name__ == "__main__":
  from doctest import testmod

  testmod()
