





'''simple docstring'''



import argparse

from transformers import ConvBertConfig, ConvBertModel, TFConvBertModel, load_tf_weights_in_convbert
from transformers.utils import logging


logging.set_verbosity_info()




def       _lowerCAmelCase  ( lowerCamelCase_	:     Any						,				lowerCamelCase_	:     str						,				lowerCamelCase_	:     Any ):
			__lowercase   =							ConvBertConfig.from_json_file(lowerCamelCase_ )
			__lowercase   =							ConvBertModel(lowerCamelCase_ )

			__lowercase   =							load_tf_weights_in_convbert(lowerCamelCase_						,				lowerCamelCase_						,				lowerCamelCase_ )
			model.save_pretrained(lowerCamelCase_ )

			__lowercase   =							TFConvBertModel.from_pretrained(lowerCamelCase_						,				from_pt=lowerCamelCase_ )
			tf_model.save_pretrained(lowerCamelCase_ )


if __name__ == "__main__":
	_SCREAMING_SNAKE_CASE    =			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(
	    '''--convbert_config_file''',
	    default=None,
	    type=str,
	    required=True,
	    help=(
	        '''The config json file corresponding to the pre-trained ConvBERT model. \n'''
	        '''This specifies the model architecture.'''
	    ),
	)
	parser.add_argument(
	    '''--pytorch_dump_path''', default=None, type=str, required=True, help='''Path to the output PyTorch model.'''
	)
	_SCREAMING_SNAKE_CASE    =			parser.parse_args()
	convert_orig_tfa_checkpoint_to_pytorch(args.tf_checkpoint_path, args.convbert_config_file, args.pytorch_dump_path)












'''simple docstring'''



import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig






class 							__lowercase				(					lowerCAmelCase__  ):







	'''simple docstring'''

	a			: Union[str, Any]      =				CustomConfig


	def __init__(self   ,_lowerCamelCase       )							->							Tuple:







				'''simple docstring'''





				super().__init__(_lowerCamelCase       )
				__lowercase   =							torch.nn.Linear(config.hidden_size   ,config.hidden_size       )


	def   _UpperCAmelCase   (self   ,_lowerCamelCase       )							->							List[str]:







				'''simple docstring'''





				return self.linear(_lowerCamelCase       )


	def   _UpperCAmelCase   (self   ,_lowerCamelCase       )							->							List[Any]:







				'''simple docstring'''





				pass






class 							__lowercase				(					lowerCAmelCase__  ):







	'''simple docstring'''

	a			: Dict      =				NoSuperInitConfig


	def __init__(self   ,_lowerCamelCase       )							->							str:







				'''simple docstring'''





				super().__init__(_lowerCamelCase       )
				__lowercase   =							torch.nn.Linear(config.attribute   ,config.attribute       )


	def   _UpperCAmelCase   (self   ,_lowerCamelCase       )							->							List[str]:







				'''simple docstring'''





				return self.linear(_lowerCamelCase       )


	def   _UpperCAmelCase   (self   ,_lowerCamelCase       )							->							Tuple:







				'''simple docstring'''





				pass





