




def        _SCREAMING_SNAKE_CASE      (		snake_case			,     snake_case			,     snake_case = 0			,     snake_case = 0       )						->				int:
						_UpperCAmelCase      =			right or len(snake_case       ) - 1
						if left > right:
												return -1
						elif list_data[left] == key:
												return left
						elif list_data[right] == key:
												return right
						else:
												return search(snake_case			,     snake_case			,     left + 1			,     right - 1       )


if __name__ == "__main__":
				import doctest

				doctest.testmod()





from typing import Union

import fire
import torch
from tqdm import tqdm




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


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