
import argparse

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


logging.set_verbosity_info()

def 				lowercase      (_lowerCAmelCase				,  _lowerCAmelCase				,  _lowerCAmelCase		):
						__lowerCAmelCase        =       ConvBertConfig.from_json_file(_lowerCAmelCase		)
						__lowerCAmelCase        =       ConvBertModel(_lowerCAmelCase		)

						__lowerCAmelCase        =       load_tf_weights_in_convbert(_lowerCAmelCase				,  _lowerCAmelCase				,  _lowerCAmelCase		)
						model.save_pretrained(_lowerCAmelCase		)

						__lowerCAmelCase        =       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 unittest

from transformers import is_torch_available, load_tool

from .test_tools_common import ToolTesterMixin


if is_torch_available():
			import torch
class      lowerCAmelCase_						(							unittest.TestCase							,							A__				):



							'''simple docstring'''





							def  A__		(				self							)   ->       Any:
													__lowerCAmelCase        =       load_tool("""speech-to-text"""							)
													self.tool.setup()




							def  A__		(				self							)   ->       int:
													__lowerCAmelCase        =       self.tool(torch.ones(3_000							)							)
													self.assertEqual(snake_case_  ,							""" you"""							)




							def  A__		(				self							)   ->       Optional[int]:
													__lowerCAmelCase        =       self.tool(audio=torch.ones(3_000							)							)
													self.assertEqual(snake_case_  ,							""" you"""							)
