from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCamelCase :     Tuple          =  {
    "configuration_wav2vec2_conformer": [
        "WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Wav2Vec2ConformerConfig",
    ],
}


try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__lowerCamelCase :     Dict          =  [
		    "WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
		    "Wav2Vec2ConformerForAudioFrameClassification",
		    "Wav2Vec2ConformerForCTC",
		    "Wav2Vec2ConformerForPreTraining",
		    "Wav2Vec2ConformerForSequenceClassification",
		    "Wav2Vec2ConformerForXVector",
		    "Wav2Vec2ConformerModel",
		    "Wav2Vec2ConformerPreTrainedModel",
		]

if TYPE_CHECKING:
		from .configuration_wavaveca_conformer import (
		    WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    WavaVecaConformerConfig,
		)

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_wavaveca_conformer import (
				    WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    WavaVecaConformerForAudioFrameClassification,
				    WavaVecaConformerForCTC,
				    WavaVecaConformerForPreTraining,
				    WavaVecaConformerForSequenceClassification,
				    WavaVecaConformerForXVector,
				    WavaVecaConformerModel,
				    WavaVecaConformerPreTrainedModel,
				)

else:
		import sys

		__lowerCamelCase :     int          =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)







import argparse

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


logging.set_verbosity_info()




def 				_snake_case     (       lowerCAmelCase							:       Dict       ,			lowerCAmelCase							:       int       ,			lowerCAmelCase							:       Union[str, Any]     ):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		List[Any]    				=   ConvBertConfig.from_json_file(lowerCAmelCase     )
		SCREAMING_SNAKE_CASE_  :		Tuple    				=   ConvBertModel(lowerCAmelCase     )

		SCREAMING_SNAKE_CASE_  :		Dict    				=   load_tf_weights_in_convbert(lowerCAmelCase       ,			lowerCAmelCase       ,			lowerCAmelCase     )
		model.save_pretrained(lowerCAmelCase     )

		SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   TFConvBertModel.from_pretrained(lowerCAmelCase       ,			from_pt=lowerCAmelCase     )
		tf_model.save_pretrained(lowerCAmelCase     )


if __name__ == "__main__":
		__lowerCamelCase :     Optional[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(
		    '''--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.'''
		)
		__lowerCamelCase :     Optional[int]          =  parser.parse_args()
		convert_orig_tfa_checkpoint_to_pytorch(args.tf_checkpoint_path, args.convbert_config_file, args.pytorch_dump_path)
