


"""simple docstring"""

def 							A						(    snake_case				:Optional[Any]		)				->     str:







 if not nums:  # Makes sure that the list is not empty
  raise ValueError('List is empty'		)

 __UpperCamelCase      =	sum(_lowercase		) / len(_lowercase		)  # Calculate the average
 return sum(abs(x - average		) for x in nums		) / len(_lowercase		)


if __name__ == "__main__":
      import doctest

      doctest.testmod()





"""simple docstring"""

from typing import Union

import fire
import torch
from tqdm import tqdm






def 							A						(    snake_case				:str    , snake_case				:str = "cpu"    , snake_case				:Union[str, None] = 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)



