





'''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'''


def 					_lowerCamelCase    (      lowerCamelCase_					:							str   ):



     """simple docstring"""





     UpperCAmelCase_							:   str   =      str(lowerCamelCase_   ).strip()
     if not oct_string:
          raise ValueError('Empty string was passed to the function'   )
     UpperCAmelCase_							:   Tuple   =      oct_string[0] == '-'
     if is_negative:
          UpperCAmelCase_							:   Tuple   =      oct_string[1:]
     if not oct_string.isdigit() or not all(0 <= int(lowerCamelCase_   ) <= 7 for char in oct_string   ):
          raise ValueError('Non-octal value was passed to the function'   )
     UpperCAmelCase_							:   str   =      0
     for char in oct_string:
          UpperCAmelCase_							:   List[Any]   =      8 * decimal_number + int(lowerCamelCase_   )
     if is_negative:
          UpperCAmelCase_							:   List[Any]   =      -decimal_number
     return decimal_number


if __name__ == "__main__":
 from doctest import testmod

 testmod()






