



'''simple docstring'''



def        UpperCAmelCase (    A	:					int       ,		A	:					int					):
							if a < 0 or b < 0:
														raise ValueError('''the value of both inputs must be positive'''					)

							SCREAMING_SNAKE_CASE       :   Optional[Any]         =      str(bin(A					)					)[2:]  # remove the leading "0b"
							SCREAMING_SNAKE_CASE       :   List[Any]         =      str(bin(A					)					)[2:]  # remove the leading "0b"

							SCREAMING_SNAKE_CASE       :   Optional[Any]         =      max(len(A					)       ,		len(A					)					)

							return "0b" + "".join(
							    str(int(char_a != char_b					)					)
							    for char_a, char_b in zip(a_binary.zfill(A					)       ,		b_binary.zfill(A					)					)					)


if __name__ == "__main__":
							import doctest

							doctest.testmod()









'''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	:					Optional[Any]       ,		A	:					Optional[int]       ,		A	:					int					):
							# Initialise PyTorch model
							SCREAMING_SNAKE_CASE       :   str         =      TaConfig.from_json_file(A					)
							print(F"""Building PyTorch model from configuration: {config}"""					)
							SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      TaForConditionalGeneration(A					)

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

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


if __name__ == "__main__":
							lowerCAmelCase_  :							Union[str, Any]             =    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_  :							Tuple             =    parser.parse_args()
							convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)




