




"""simple docstring"""



from typing import Union

import fire
import torch
from tqdm import tqdm







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


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











"""simple docstring"""



import baseaa







def   _SCREAMING_SNAKE_CASE       (							lowercase_						)						->		bytes:
 return baseaa.aaaencode(string.encode("utf-8"						)						)







def   _SCREAMING_SNAKE_CASE       (							lowercase_						)						->		str:
 return baseaa.aaadecode(lowercase_						).decode("utf-8"						)


if __name__ == "__main__":
      import doctest

      doctest.testmod()





