


import argparse

from transformers import CanineConfig, CanineModel, CanineTokenizer, load_tf_weights_in_canine
from transformers.utils import logging


logging.set_verbosity_info()






def 		lowercase_(  SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  lowerCamelCase			: str   =    CanineConfig()
  lowerCamelCase			: Dict   =    CanineModel(SCREAMING_SNAKE_CASE_     )
  model.eval()

  print(f"""Building PyTorch model from configuration: {config}"""     )

  # Load weights from tf checkpoint
  load_tf_weights_in_canine(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     )

  # Save pytorch-model (weights and configuration)
  print(f"""Save PyTorch model to {pytorch_dump_path}"""     )
  model.save_pretrained(SCREAMING_SNAKE_CASE_     )

  # Save tokenizer files
  lowerCamelCase			: Optional[Any]   =    CanineTokenizer()
  print(f"""Save tokenizer files to {pytorch_dump_path}"""     )
  tokenizer.save_pretrained(SCREAMING_SNAKE_CASE_     )


if __name__ == "__main__":
 _snake_case					=					argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     '''--tf_checkpoint_path''',
     default=None,
     type=str,
     required=True,
     help='''Path to the TensorFlow checkpoint. Should end with model.ckpt''',
 )
 parser.add_argument(
     '''--pytorch_dump_path''',
     default=None,
     type=str,
     required=True,
     help='''Path to a folder where the PyTorch model will be placed.''',
 )
 _snake_case					=					parser.parse_args()
 convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.pytorch_dump_path)







def 		lowercase_(  SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  if number != int(SCREAMING_SNAKE_CASE_     ):
    raise ValueError("factorial() only accepts integral values"     )
  if number < 0:
    raise ValueError("factorial() not defined for negative values"     )
  lowerCamelCase			: Optional[Any]   =    1
  for i in range(1				,						number + 1     ):
    value *= i
  return value






def 		lowercase_(  SCREAMING_SNAKE_CASE_     ):


  '''simple docstring'''

  if not isinstance(SCREAMING_SNAKE_CASE_				,						SCREAMING_SNAKE_CASE_     ):
    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()

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



