






import argparse

import torch

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


logging.set_verbosity_info()


def __A    (      __lowerCAmelCase ,		__lowerCAmelCase ,		__lowerCAmelCase	)->  Dict:





						"""simple docstring"""



						_UpperCAmelCase									=			LxmertConfig.from_json_file(_a	)
						print(F"""Building PyTorch model from configuration: {config}"""	)
						_UpperCAmelCase									=			LxmertForPreTraining(_a	)

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

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


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






'''simple docstring'''







import os
from distutils.util import strtobool





def 						snake_case_							(_a	:							Union[str, Any]    ,   _a	:							List[Any]     ):
    for e in env_keys:
        UpperCAmelCase			       =		int(os.environ.get(_a    ,   -1     )     )
        if val >= 0:
            return val
    return default





def 						snake_case_							(_a	:							Dict    ,   _a	:							Any=False     ):
    UpperCAmelCase			       =		os.environ.get(_a    ,   str(_a     )     )
    return strtobool(_a     ) == 1  # As its name indicates `strtobool` actually returns an int...







def 						snake_case_							(_a	:							str    ,   _a	:							Optional[Any]="no"     ):
    UpperCAmelCase			       =		os.environ.get(_a    ,   str(_a     )     )
    return value




