




"""simple docstring"""






import os
from distutils.util import strtobool





def 							UpperCAmelCase		(		snake_case			:					Tuple      ,       snake_case			:					int    ):


					for e in env_keys:
										_lowerCAmelCase:Any									=  int(os.environ.get(lowerCAmelCase_      ,       -1    )    )
										if val >= 0:
															return val
					return default





def 							UpperCAmelCase		(		snake_case			:					List[Any]      ,       snake_case			:					List[str]=False    ):
					_lowerCAmelCase:List[str]									=  os.environ.get(lowerCAmelCase_      ,       str(lowerCAmelCase_    )    )
					return strtobool(lowerCAmelCase_    ) == 1  # As its name indicates `strtobool` actually returns an int...





def 							UpperCAmelCase		(		snake_case			:					Any      ,       snake_case			:					List[Any]="no"    ):
					_lowerCAmelCase:Optional[Any]									=  os.environ.get(lowerCAmelCase_      ,       str(lowerCAmelCase_    )    )
					return value






"""simple docstring"""






from argparse import ArgumentParser

from .add_new_model import AddNewModelCommand
from .add_new_model_like import AddNewModelLikeCommand
from .convert import ConvertCommand
from .download import DownloadCommand
from .env import EnvironmentCommand
from .lfs import LfsCommands
from .pt_to_tf import PTtoTFCommand
from .run import RunCommand
from .serving import ServeCommand
from .user import UserCommands





def 							UpperCAmelCase		(		):
					_lowerCAmelCase:List[Any]									=  ArgumentParser('''Transformers CLI tool'''      ,       usage='''transformers-cli <command> [<args>]'''    )
					_lowerCAmelCase:Union[str, Any]									=  parser.add_subparsers(help='''transformers-cli command helpers'''    )

					# Register commands
					ConvertCommand.register_subcommand(snake_case    )
					DownloadCommand.register_subcommand(snake_case    )
					EnvironmentCommand.register_subcommand(snake_case    )
					RunCommand.register_subcommand(snake_case    )
					ServeCommand.register_subcommand(snake_case    )
					UserCommands.register_subcommand(snake_case    )
					AddNewModelCommand.register_subcommand(snake_case    )
					AddNewModelLikeCommand.register_subcommand(snake_case    )
					LfsCommands.register_subcommand(snake_case    )
					PTtoTFCommand.register_subcommand(snake_case    )

					# Let's go
					_lowerCAmelCase:Union[str, Any]									=  parser.parse_args()

					if not hasattr(snake_case      ,       '''func'''    ):
										parser.print_help()
										exit(1    )

					# Run
					_lowerCAmelCase:Any									=  args.func(snake_case    )
					service.run()


if __name__ == "__main__":
				main()






