


'''simple docstring'''






def 							UpperCamelCase_     (       A__   :  int   ):
  '''simple docstring'''





  if not isinstance(A__				,       A__   ):
    raise TypeError("""only integers accepted as input"""   )
  else:
    lowerCAmelCase_     : List[str]     =  str(abs(A__   )   )
    lowerCAmelCase_     : List[Any]     =  [list(A__   ) for char in range(len(A__   )   )]
    for index in range(len(A__   )   ):
      num_transpositions[index].pop(A__   )
    return max(
        int("""""".join(list(A__   )   )   ) for transposition in num_transpositions   )


if __name__ == "__main__":
  __import__("doctest").testmod()







'''simple docstring'''






from typing import Union

import fire
import torch
from tqdm import tqdm







def 							UpperCamelCase_     (       A__   :  str				,       A__   :  str = "cpu"				,       A__   :  Union[str, None] = None   ):
  '''simple docstring'''





  lowerCAmelCase_     : Dict     =  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"""   )
    lowerCAmelCase_     : List[str]     =  v.half()
  if save_path is None:  # overwrite src_path
    lowerCAmelCase_     : List[str]     =  src_path
  torch.save(A__				,       A__   )


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



