





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__ (					lowercase__  ,    lowercase__  ,    lowercase__  ):






   '''simple docstring'''






   UpperCAmelCase_											=LxmertConfig.from_json_file(lowercase__  )
   print(F'Building PyTorch model from configuration: {config}'  )
   UpperCAmelCase_											=LxmertForPreTraining(lowercase__  )

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

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


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











from ....configuration_utils import PretrainedConfig
from ....utils import logging


__lowercase  :   Optional[int]						      =logging.get_logger(__name__)

__lowercase  :   Union[str, Any]						      ={
    """Visual-Attention-Network/van-base""": (
        """https://huggingface.co/Visual-Attention-Network/van-base/blob/main/config.json"""
    ),
}

class      A       (	__lowercase						):
      _snake_case							     ='''van'''



      def __init__(	self:						str		,  _lowerCAmelCase:						List[Any]=224		,  _lowerCAmelCase:						Any=3		,  _lowerCAmelCase:						Tuple=[7, 3, 3, 3]		,  _lowerCAmelCase:						Union[str, Any]=[4, 2, 2, 2]		,  _lowerCAmelCase:						List[str]=[64, 128, 320, 512]		,  _lowerCAmelCase:						Tuple=[3, 3, 12, 3]		,  _lowerCAmelCase:						Union[str, Any]=[8, 8, 4, 4]		,  _lowerCAmelCase:						Any="gelu"		,  _lowerCAmelCase:						Optional[int]=0.02		,  _lowerCAmelCase:						List[str]=1e-6		,  _lowerCAmelCase:						Any=1e-2		,  _lowerCAmelCase:						Any=0.0		,  _lowerCAmelCase:						Optional[Any]=0.0		,  **_lowerCAmelCase:						List[str]		,  )						->    Dict:
         '''simple docstring'''

         super().__init__(**_lowerCAmelCase       )
         UpperCAmelCase_											=image_size
         UpperCAmelCase_											=num_channels
         UpperCAmelCase_											=patch_sizes
         UpperCAmelCase_											=strides
         UpperCAmelCase_											=hidden_sizes
         UpperCAmelCase_											=depths
         UpperCAmelCase_											=mlp_ratios
         UpperCAmelCase_											=hidden_act
         UpperCAmelCase_											=initializer_range
         UpperCAmelCase_											=layer_norm_eps
         UpperCAmelCase_											=layer_scale_init_value
         UpperCAmelCase_											=drop_path_rate
         UpperCAmelCase_											=dropout_rate




