

'''simple docstring'''





import argparse

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


logging.set_verbosity_info()



def  _A  (			SCREAMING_SNAKE_CASE  ,SCREAMING_SNAKE_CASE			):
	# Initialize PyTorch model
	UpperCAmelCase__:  Dict		       =   CanineConfig()
	UpperCAmelCase__:  Union[str, Any]		       =   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
	UpperCAmelCase__:  Any		       =   CanineTokenizer()
	print(f"Save tokenizer files to {pytorch_dump_path}"			)
	tokenizer.save_pretrained(SCREAMING_SNAKE_CASE			)


if __name__ == "__main__":
					_lowerCAmelCase     :			List[str]    =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.""",
					)
					_lowerCAmelCase     :			int    =parser.parse_args()
					convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.pytorch_dump_path)


import numpy as np



def  _A  (			SCREAMING_SNAKE_CASE			):
	UpperCAmelCase__:  List[Any]		       =   np.exp(SCREAMING_SNAKE_CASE			)

	# Add up the all the exponentials
	UpperCAmelCase__:  str		       =   np.sum(SCREAMING_SNAKE_CASE			)

	# Divide every exponent by the sum of all exponents
	UpperCAmelCase__:  Tuple		       =   exponent_vector / sum_of_exponents

	return softmax_vector


if __name__ == "__main__":
					print(softmax((0,)))