
'''simple docstring'''


from typing import Union

import fire
import torch
from tqdm import tqdm




def lowercase_	(   _lowercase			,       _lowercase = "cpu"			,       _lowercase = None				)     ->							None:
					'''simple docstring'''

					lowerCamelCase_					:      List[str]     =		torch.load(_lowercase			,       map_location=_lowercase				)
					for k, v in tqdm(state_dict.items()				):
										if not isinstance(_lowercase			,       torch.Tensor				):
															raise TypeError('''FP16 conversion only works on paths that are saved state dicts, like pytorch_model.bin'''				)
										lowerCamelCase_					:      Union[str, Any]     =		v.half()
					if save_path is None:  # overwrite src_path
										lowerCamelCase_					:      Tuple     =		src_path
					torch.save(_lowercase			,       _lowercase				)


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




'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available


__lowercase							:   int					=     {}

try:
					if not is_sentencepiece_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__lowercase							:   Any					=     ['''BartphoTokenizer''']

if TYPE_CHECKING:
					try:
										if not is_sentencepiece_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_bartpho import BartphoTokenizer

else:
					import sys

					__lowercase							:   Union[str, Any]					=     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)


