import inspect
import unittest
import warnings
from typing import List

from transformers import EfficientFormerConfig
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
		import torch

		from transformers import (
		    MODEL_FOR_IMAGE_CLASSIFICATION_MAPPING,
		    MODEL_MAPPING,
		    EfficientFormerForImageClassification,
		    EfficientFormerForImageClassificationWithTeacher,
		    EfficientFormerModel,
		)
		from transformers.models.efficientformer.modeling_efficientformer import (
		    EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		)


if is_vision_available():
		from PIL import Image

		from transformers import EfficientFormerImageProcessor






class 		a__						:

					def __init__(   self				:	Optional[int],_A				:	Optional[int],_A				:	int = 13,_A				:	int = 64,_A				:	int = 2,_A				:	int = 3,_A				:	int = 3,_A				:	bool = True,_A				:	bool = True,_A				:	int = 128,_A				:	str=[16, 32, 64, 128],_A				:	int = 7,_A				:	int = 4,_A				:	int = 37,_A				:	str = "gelu",_A				:	float = 0.1,_A				:	float = 0.1,_A				:	int = 10,_A				:	float = 0.02,_A				:	int = 2,_A				:	int = 1,_A				:	int = 128,_A				:	List[int] = [2, 2, 2, 2],_A				:	int = 2,_A				:	int = 2,):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   parent
							SCREAMING_SNAKE_CASE_  :		int    				=   batch_size
							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   image_size
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   patch_size
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   num_channels
							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   is_training
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   use_labels
							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   hidden_size
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   num_hidden_layers
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   num_attention_heads
							SCREAMING_SNAKE_CASE_  :		Any    				=   intermediate_size
							SCREAMING_SNAKE_CASE_  :		Dict    				=   hidden_act
							SCREAMING_SNAKE_CASE_  :		str    				=   hidden_dropout_prob
							SCREAMING_SNAKE_CASE_  :		str    				=   attention_probs_dropout_prob
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   type_sequence_label_size
							SCREAMING_SNAKE_CASE_  :		str    				=   initializer_range
							SCREAMING_SNAKE_CASE_  :		str    				=   encoder_stride
							SCREAMING_SNAKE_CASE_  :		str    				=   num_attention_outputs
							SCREAMING_SNAKE_CASE_  :		Any    				=   embed_dim
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   embed_dim + 1
							SCREAMING_SNAKE_CASE_  :		int    				=   resolution
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   depths
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   hidden_sizes
							SCREAMING_SNAKE_CASE_  :		str    				=   dim
							SCREAMING_SNAKE_CASE_  :		int    				=   mlp_expansion_ratio

					def     __UpperCamelCase       (   self				:	Optional[Any]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Tuple    				=   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]   )

							SCREAMING_SNAKE_CASE_  :		Tuple    				=   None
							if self.use_labels:
									SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   ids_tensor([self.batch_size],self.type_sequence_label_size   )

							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   self.get_config()
							return config, pixel_values, labels

					def     __UpperCamelCase       (   self				:	List[Any]   ):







							"""simple docstring"""






							return EfficientFormerConfig(
							    image_size=self.image_size,patch_size=self.patch_size,num_channels=self.num_channels,hidden_size=self.hidden_size,num_hidden_layers=self.num_hidden_layers,num_attention_heads=self.num_attention_heads,intermediate_size=self.intermediate_size,hidden_act=self.hidden_act,hidden_dropout_prob=self.hidden_dropout_prob,attention_probs_dropout_prob=self.attention_probs_dropout_prob,is_decoder=_A,initializer_range=self.initializer_range,encoder_stride=self.encoder_stride,resolution=self.resolution,depths=self.depths,hidden_sizes=self.hidden_sizes,dim=self.dim,mlp_expansion_ratio=self.mlp_expansion_ratio,)

					def     __UpperCamelCase       (   self				:	List[str],_A				:	Dict,_A				:	Optional[int],_A				:	Union[str, Any]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   EfficientFormerModel(config=_A   )
							model.to(_A   )
							model.eval()
							SCREAMING_SNAKE_CASE_  :		Tuple    				=   model(_A   )
							self.parent.assertEqual(result.last_hidden_state.shape,(self.batch_size, self.seq_length, self.hidden_size)   )

					def     __UpperCamelCase       (   self				:	List[Any],_A				:	Union[str, Any],_A				:	List[Any],_A				:	Tuple   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   self.type_sequence_label_size
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   EfficientFormerForImageClassification(_A   )
							model.to(_A   )
							model.eval()
							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   model(_A,labels=_A   )
							self.parent.assertEqual(result.logits.shape,(self.batch_size, self.type_sequence_label_size)   )

							# test greyscale images
							SCREAMING_SNAKE_CASE_  :		Dict    				=   1
							SCREAMING_SNAKE_CASE_  :		Dict    				=   EfficientFormerForImageClassification(_A   )
							model.to(_A   )
							model.eval()

							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   floats_tensor([self.batch_size, 1, self.image_size, self.image_size]   )
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   model(_A   )
							self.parent.assertEqual(result.logits.shape,(self.batch_size, self.type_sequence_label_size)   )






					def     __UpperCamelCase       (   self				:	Optional[int]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		str    				=   self.prepare_config_and_inputs()
							(
							    (
							    SCREAMING_SNAKE_CASE_
							)				,   (
							    SCREAMING_SNAKE_CASE_
							)				,   (
							    SCREAMING_SNAKE_CASE_
							)				,   
							)  :		List[str]    				=   config_and_inputs
							SCREAMING_SNAKE_CASE_  :		int    				=   {"pixel_values": pixel_values}
							return config, inputs_dict







@require_torch
class 		a__						( A__   ,		A__   ,		unittest.TestCase ):
					A     	=							(
					    (
					        EfficientFormerModel,
					        EfficientFormerForImageClassificationWithTeacher,
					        EfficientFormerForImageClassification,
					    )
					    if is_torch_available()
					    else ()
					)
					A     	=							(
					    {
					        'feature-extraction': EfficientFormerModel,
					        'image-classification': (
					            EfficientFormerForImageClassification,
					            EfficientFormerForImageClassificationWithTeacher,
					        ),
					    }
					    if is_torch_available()
					    else {}
					)
					A     	=							False

					A     	=							False
					A     	=							False
					A     	=							False

					def     __UpperCamelCase       (   self				:	List[Any]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Dict    				=   EfficientFormerModelTester(self   )
							SCREAMING_SNAKE_CASE_  :		int    				=   ConfigTester(
							    self,config_class=_A,has_text_modality=_A,hidden_size=37   )

					def     __UpperCamelCase       (   self				:	Union[str, Any]   ):







							"""simple docstring"""






							self.config_tester.run_common_tests()

					@unittest.skip(reason="EfficientFormer does not use inputs_embeds"   )
					def     __UpperCamelCase       (   self				:	str   ):







							"""simple docstring"""






							pass

					@unittest.skip(reason="EfficientFormer does not support input and output embeddings"   )
					def     __UpperCamelCase       (   self				:	Union[str, Any]   ):







							"""simple docstring"""






							pass

					def     __UpperCamelCase       (   self				:	Optional[int]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_				,   SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									SCREAMING_SNAKE_CASE_  :		List[Any]    				=   model_class(_A   )
									SCREAMING_SNAKE_CASE_  :		Dict    				=   inspect.signature(model.forward   )
									# signature.parameters is an OrderedDict => so arg_names order is deterministic
									SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   [*signature.parameters.keys()]

									SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   ["pixel_values"]
									self.assertListEqual(arg_names[:1],_A   )

					def     __UpperCamelCase       (   self				:	Union[str, Any]   ):







							"""simple docstring"""






							def check_hidden_states_output(_A				:	Optional[Any],_A				:	Optional[Any],_A				:	List[Any]   ):
									SCREAMING_SNAKE_CASE_  :		Dict    				=   model_class(_A   )
									model.to(_A   )
									model.eval()

									with torch.no_grad():
											SCREAMING_SNAKE_CASE_  :		str    				=   model(**self._prepare_for_class(_A,_A   )   )

									SCREAMING_SNAKE_CASE_  :		int    				=   outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

									SCREAMING_SNAKE_CASE_  :		Any    				=   getattr(
									    self.model_tester,"expected_num_hidden_layers",self.model_tester.num_hidden_layers + 1   )
									self.assertEqual(len(_A   ),_A   )

									if hasattr(self.model_tester,"encoder_seq_length"   ):
											SCREAMING_SNAKE_CASE_  :		List[Any]    				=   self.model_tester.encoder_seq_length
											if hasattr(self.model_tester,"chunk_length"   ) and self.model_tester.chunk_length > 1:
													SCREAMING_SNAKE_CASE_  :		List[str]    				=   seq_length * self.model_tester.chunk_length
									else:
											SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   self.model_tester.seq_length

									self.assertListEqual(
									    list(hidden_states[-1].shape[-2:]   ),[seq_length, self.model_tester.hidden_size],)

									if config.is_encoder_decoder:
											SCREAMING_SNAKE_CASE_  :		List[str]    				=   outputs.decoder_hidden_states

											self.assertIsInstance(_A,(list, tuple)   )
											self.assertEqual(len(_A   ),_A   )
											SCREAMING_SNAKE_CASE_  :		str    				=   getattr(self.model_tester,"seq_length",_A   )
											SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   getattr(self.model_tester,"decoder_seq_length",_A   )

											self.assertListEqual(
											    list(hidden_states[-1].shape[-2:]   ),[decoder_seq_length, self.model_tester.hidden_size],)

							SCREAMING_SNAKE_CASE_				,   SCREAMING_SNAKE_CASE_  :		Any    				=   self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
									SCREAMING_SNAKE_CASE_  :		str    				=   True
									check_hidden_states_output(_A,_A,_A   )

									# check that output_hidden_states also work using config
									del inputs_dict["output_hidden_states"]
									SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   True

									check_hidden_states_output(_A,_A,_A   )

					def     __UpperCamelCase       (   self				:	str,_A				:	Optional[int],_A				:	Dict,_A				:	Dict=False   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   super()._prepare_for_class(_A,_A,return_labels=_A   )

							if return_labels:
									if model_class.__name__ == "EfficientFormerForImageClassificationWithTeacher":
											del inputs_dict["labels"]

							return inputs_dict

					def     __UpperCamelCase       (   self				:	List[str]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Dict    				=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*_A   )

					@unittest.skip(reason="EfficientFormer does not implement masked image modeling yet"   )
					def     __UpperCamelCase       (   self				:	List[str]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		str    				=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_image_modeling(*_A   )

					def     __UpperCamelCase       (   self				:	Tuple   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_image_classification(*_A   )

					def     __UpperCamelCase       (   self				:	Dict   ):







							"""simple docstring"""






							if not self.model_tester.is_training:
									return

							SCREAMING_SNAKE_CASE_				,   SCREAMING_SNAKE_CASE_  :		Dict    				=   self.model_tester.prepare_config_and_inputs_for_common()
							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   True

							for model_class in self.all_model_classes:
									# EfficientFormerForImageClassificationWithTeacher supports inference-only
									if (
									    model_class in get_values(_A   )
									    or model_class.__name__ == "EfficientFormerForImageClassificationWithTeacher"
									):
											continue
									SCREAMING_SNAKE_CASE_  :		int    				=   model_class(_A   )
									model.to(_A   )
									model.train()
									SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   self._prepare_for_class(_A,_A,return_labels=_A   )
									SCREAMING_SNAKE_CASE_  :		Tuple    				=   model(**_A   ).loss
									loss.backward()

					def     __UpperCamelCase       (   self				:	int   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_				,   SCREAMING_SNAKE_CASE_  :		int    				=   self.model_tester.prepare_config_and_inputs_for_common()

							SCREAMING_SNAKE_CASE_  :		int    				=   [
							    {"title": "multi_label_classification", "num_labels": 2, "dtype": torch.float},
							    {"title": "single_label_classification", "num_labels": 1, "dtype": torch.long},
							    {"title": "regression", "num_labels": 1, "dtype": torch.float},
							]

							for model_class in self.all_model_classes:
									if (
									    model_class
									    not in [
									        *get_values(_A   ),
									    ]
									    or model_class.__name__ == "EfficientFormerForImageClassificationWithTeacher"
									):
											continue

									for problem_type in problem_types:
											with self.subTest(msg=F'Testing {model_class} with {problem_type["title"]}'   ):
													SCREAMING_SNAKE_CASE_  :		List[str]    				=   problem_type["title"]
													SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   problem_type["num_labels"]

													SCREAMING_SNAKE_CASE_  :		Dict    				=   model_class(_A   )
													model.to(_A   )
													model.train()

													SCREAMING_SNAKE_CASE_  :		List[str]    				=   self._prepare_for_class(_A,_A,return_labels=_A   )

													if problem_type["num_labels"] > 1:
															SCREAMING_SNAKE_CASE_  :		List[Any]    				=   inputs["labels"].unsqueeze(1   ).repeat(1,problem_type["num_labels"]   )

													SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   inputs["labels"].to(problem_type["dtype"]   )

													# This tests that we do not trigger the warning form PyTorch "Using a target size that is different
													# to the input size. This will likely lead to incorrect results due to broadcasting. Please ensure
													# they have the same size." which is a symptom something in wrong for the regression problem.
													# See https://github.com/huggingface/transformers/issues/11780
													with warnings.catch_warnings(record=_A   ) as warning_list:
															SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   model(**_A   ).loss
													for w in warning_list:
															if "Using a target size that is different to the input size" in str(w.message   ):
																	raise ValueError(
																	    F'Something is going wrong in the regression problem: intercepted {w.message}'   )

													loss.backward()

					@slow
					def     __UpperCamelCase       (   self				:	Optional[Any]   ):







							"""simple docstring"""






							for model_name in EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   EfficientFormerModel.from_pretrained(_A   )
									self.assertIsNotNone(_A   )






					def     __UpperCamelCase       (   self				:	int   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_				,   SCREAMING_SNAKE_CASE_  :		Tuple    				=   self.model_tester.prepare_config_and_inputs_for_common()
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   True

							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   getattr(self.model_tester,"seq_length",_A   )
							SCREAMING_SNAKE_CASE_  :		Any    				=   getattr(self.model_tester,"encoder_seq_length",_A   )
							SCREAMING_SNAKE_CASE_  :		Dict    				=   getattr(self.model_tester,"key_length",_A   )
							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   getattr(self.model_tester,"chunk_length",_A   )

							if chunk_length is not None and hasattr(self.model_tester,"num_hashes"   ):
									SCREAMING_SNAKE_CASE_  :		int    				=   encoder_seq_length * self.model_tester.num_hashes

							for model_class in self.all_model_classes:
									SCREAMING_SNAKE_CASE_  :		List[Any]    				=   True
									SCREAMING_SNAKE_CASE_  :		Tuple    				=   False
									SCREAMING_SNAKE_CASE_  :		List[str]    				=   True
									SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   model_class(_A   )
									model.to(_A   )
									model.eval()
									with torch.no_grad():
											SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   model(**self._prepare_for_class(_A,_A   )   )
									SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
									self.assertEqual(len(_A   ),self.model_tester.num_attention_outputs   )

									# check that output_attentions also work using config
									del inputs_dict["output_attentions"]
									SCREAMING_SNAKE_CASE_  :		int    				=   True
									SCREAMING_SNAKE_CASE_  :		Dict    				=   model_class(_A   )
									model.to(_A   )
									model.eval()
									with torch.no_grad():
											SCREAMING_SNAKE_CASE_  :		Dict    				=   model(**self._prepare_for_class(_A,_A   )   )
									SCREAMING_SNAKE_CASE_  :		str    				=   outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
									self.assertEqual(len(_A   ),self.model_tester.num_attention_outputs   )

									if chunk_length is not None:
											self.assertListEqual(
											    list(attentions[0].shape[-4:]   ),[self.model_tester.num_attention_heads, encoder_seq_length, chunk_length, encoder_key_length],)
									else:
											self.assertListEqual(
											    list(attentions[0].shape[-3:]   ),[self.model_tester.num_attention_heads, encoder_seq_length, encoder_key_length],)







def 				_snake_case     (       ):
		"""simple docstring"""







		SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"     )
		return image







@require_torch
@require_vision
class 		a__						( unittest.TestCase ):

					@cached_property
					def     __UpperCamelCase       (   self				:	Union[str, Any]   ):







							"""simple docstring"""






							return (
							    EfficientFormerImageProcessor.from_pretrained("snap-research/efficientformer-l1-300"   )
							    if is_vision_available()
							    else None
							)

					@slow
					def     __UpperCamelCase       (   self				:	List[Any]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Optional[int]    				=   EfficientFormerForImageClassification.from_pretrained("snap-research/efficientformer-l1-300"   ).to(
							    _A   )

							SCREAMING_SNAKE_CASE_  :		int    				=   self.default_image_processor
							SCREAMING_SNAKE_CASE_  :		Union[str, Any]    				=   prepare_img()
							SCREAMING_SNAKE_CASE_  :		Dict    				=   image_processor(images=_A,return_tensors="pt"   ).to(_A   )

							# forward pass
							with torch.no_grad():
									SCREAMING_SNAKE_CASE_  :		Any    				=   model(**_A   )

							# verify the logits
							SCREAMING_SNAKE_CASE_  :		str    				=   (1, 1000)
							self.assertEqual(outputs.logits.shape,_A   )

							SCREAMING_SNAKE_CASE_  :		Any    				=   torch.tensor([-0.0555, 0.4825, -0.0852]   ).to(_A   )
							self.assertTrue(torch.allclose(outputs.logits[0][:3],_A,atol=1E-4   )   )






					@slow
					def     __UpperCamelCase       (   self				:	Union[str, Any]   ):







							"""simple docstring"""






							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   EfficientFormerForImageClassificationWithTeacher.from_pretrained(
							    "snap-research/efficientformer-l1-300"   ).to(_A   )

							SCREAMING_SNAKE_CASE_  :		Any    				=   self.default_image_processor
							SCREAMING_SNAKE_CASE_  :		Optional[Any]    				=   prepare_img()
							SCREAMING_SNAKE_CASE_  :		List[Any]    				=   image_processor(images=_A,return_tensors="pt"   ).to(_A   )

							# forward pass
							with torch.no_grad():
									SCREAMING_SNAKE_CASE_  :		Tuple    				=   model(**_A   )

							# verify the logits
							SCREAMING_SNAKE_CASE_  :		List[str]    				=   (1, 1000)
							self.assertEqual(outputs.logits.shape,_A   )

							SCREAMING_SNAKE_CASE_  :		Tuple    				=   torch.tensor([-0.1312, 0.4353, -1.0499]   ).to(_A   )
							self.assertTrue(torch.allclose(outputs.logits[0][:3],_A,atol=1E-4   )   )

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)
