



import argparse

import torch

from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert
from transformers.utils import logging


logging.set_verbosity_info()


def  __lowerCamelCase (       lowerCamelCase__					,			lowerCamelCase__					,			lowerCamelCase__						):

				"""simple docstring"""


				lowercase__					:   Union[str, Any]													=					LxmertConfig.from_json_file(lowerCamelCase__						)
				print(F"""Building PyTorch model from configuration: {config}"""						)
				lowercase__					:   List[Any]													=					LxmertForPreTraining(lowerCamelCase__						)

				# Load weights from tf checkpoint
				load_tf_weights_in_lxmert(lowerCamelCase__					,			lowerCamelCase__					,			lowerCamelCase__						)

				# Save pytorch-model
				print(F"""Save PyTorch model to {pytorch_dump_path}"""						)
				torch.save(model.state_dict()					,			lowerCamelCase__						)


if __name__ == "__main__":
				lowerCAmelCase__					  =  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 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__					  =  parser.parse_args()
				convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.config_file, args.pytorch_dump_path)









from math import ceil, sqrt


def  __lowerCamelCase (       lowerCamelCase__ = 1_000_000						):

				"""simple docstring"""


				lowercase__					:   int													=					0

				for outer_width in range(3					,			(limit // 4) + 2						):
								if outer_width**2 > limit:
												lowercase__					:   List[str]													=					max(ceil(sqrt(outer_width**2 - limit						)						)					,			1						)
								else:
												lowercase__					:   List[str]													=					1
								if (outer_width - hole_width_lower_bound) % 2:
												hole_width_lower_bound += 1

								answer += (outer_width - hole_width_lower_bound - 2) // 2 + 1

				return answer


if __name__ == "__main__":
				print(f'''{solution() = }''')




