"""simple docstring"""




import argparse

from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta
from transformers.utils import logging


logging.set_verbosity_info()
def 			UpperCamelCase__						(    A__      ,			A__      ,			A__   )       -> List[Any]:
				snake_case__ :     Any 							=				TaConfig.from_json_file(UpperCamelCase_   )
				print(F"""Building PyTorch model from configuration: {config}"""   )
				snake_case__ :     Union[str, Any] 							=				TaForConditionalGeneration(UpperCamelCase_   )

				# Load weights from tf checkpoint
				load_tf_weights_in_ta(UpperCamelCase_      ,			UpperCamelCase_      ,			UpperCamelCase_   )

				# Save pytorch-model
				print(F"""Save PyTorch model to {pytorch_dump_path}"""   )
				model.save_pretrained(UpperCamelCase_   )


if __name__ == "__main__":
				lowerCAmelCase__					:       str		=       argparse.ArgumentParser()
				# Required parameters
				parser.add_argument(
				    '''--tf_checkpoint_path''', default=None, type=str, required=True, help='''Path to the TensorFlow checkpoint path.'''
				)
				parser.add_argument(
				    '''--config_file''',
				    default=None,
				    type=str,
				    required=True,
				    help=(
				        '''The config json file corresponding to the pre-trained T5 model. \nThis specifies the model architecture.'''
				    ),
				)
				parser.add_argument(
				    '''--pytorch_dump_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
				)
				lowerCAmelCase__					:       Dict		=       parser.parse_args()
				convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)



def 			UpperCamelCase__						(    A__   )       -> int:
				if number != int(A__   ):
								raise ValueError('factorial() only accepts integral values'   )
				if number < 0:
								raise ValueError('factorial() not defined for negative values'   )
				snake_case__ :     Optional[Any] 							=				1
				for i in range(1      ,			number + 1   ):
								value *= i
				return value
def 			UpperCamelCase__						(    A__   )       -> int:
				if not isinstance(A__      ,			A__   ):
								raise ValueError('factorial() only accepts integral values'   )
				if n < 0:
								raise ValueError('factorial() not defined for negative values'   )
				return 1 if n == 0 or n == 1 else n * factorial(n - 1   )


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				lowerCAmelCase__					:       Any		=       int(input('''Enter a positive integer: ''').strip() or 0)
				print(F'''factorial{n} is {factorial(n)}''')


