





"""simple docstring"""





from typing import Union

import fire
import torch
from tqdm import tqdm


def 			UpperCAmelCase__							(  SCREAMING_SNAKE_CASE     :						str							,						SCREAMING_SNAKE_CASE     :						str = "cpu"							,						SCREAMING_SNAKE_CASE     :						Union[str, None] = None			):







      '''simple docstring'''




      lowerCAmelCase  						=       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"""			)
            lowerCAmelCase  						=       v.half()
      if save_path is None:  # overwrite src_path
            lowerCAmelCase  						=       src_path
      torch.save(SCREAMING_SNAKE_CASE							,						SCREAMING_SNAKE_CASE			)


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







'''simple docstring'''





import os
from math import logaa





def 	lowerCAmelCase_				(					snake_case_       : str = "base_exp.txt"			)    ->      int:


     '''simple docstring'''




     UpperCAmelCase_           =   0
     UpperCAmelCase_           =   0
     for i, line in enumerate(open(os.path.join(os.path.dirname(snake_case_			)					,    snake_case_			)			)			):
          UpperCAmelCase_    , UpperCAmelCase_           =   list(map(snake_case_					,    line.split(","			)			)			)
          if x * logaa(snake_case_			) > largest:
               UpperCAmelCase_           =   x * logaa(snake_case_			)
               UpperCAmelCase_           =   i + 1
     return result


if __name__ == "__main__":
    print(solution())




