
import inspect
import unittest

from transformers import ViTHybridConfig
from transformers.testing_utils import require_accelerate, 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, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch
							from torch import nn

							from transformers import ViTHybridForImageClassification, ViTHybridImageProcessor, ViTHybridModel
							from transformers.models.vit_hybrid.modeling_vit_hybrid import VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
							from PIL import Image





class     lowerCamelCase      :







	def __init__(     self      :List[Any]   ,     lowercase      :Optional[int]   ,     lowercase      :List[str]=1_3   ,     lowercase      :List[str]=6_4   ,     lowercase      :List[Any]=2   ,     lowercase      :str=3   ,     lowercase      :Union[str, Any]=True   ,     lowercase      :Any=True   ,     lowercase      :str=3_2   ,     lowercase      :List[str]=5   ,     lowercase      :Optional[Any]=4   ,     lowercase      :Union[str, Any]=3_7   ,     lowercase      :List[Any]="gelu"   ,     lowercase      :Any=0.1   ,     lowercase      :int=0.1   ,     lowercase      :Optional[int]=1_0   ,     lowercase      :Dict=0.02   ,     lowercase      :Any=[1, 1_6, 4, 4]   ,     lowercase      :List[Any]=None   ,     )		->      List[Any]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= parent
				SCREAMING_SNAKE_CASE     						= batch_size
				SCREAMING_SNAKE_CASE     						= image_size
				SCREAMING_SNAKE_CASE     						= patch_size
				SCREAMING_SNAKE_CASE     						= num_channels
				SCREAMING_SNAKE_CASE     						= is_training
				SCREAMING_SNAKE_CASE     						= use_labels
				SCREAMING_SNAKE_CASE     						= hidden_size
				SCREAMING_SNAKE_CASE     						= num_hidden_layers
				SCREAMING_SNAKE_CASE     						= num_attention_heads
				SCREAMING_SNAKE_CASE     						= intermediate_size
				SCREAMING_SNAKE_CASE     						= hidden_act
				SCREAMING_SNAKE_CASE     						= hidden_dropout_prob
				SCREAMING_SNAKE_CASE     						= attention_probs_dropout_prob
				SCREAMING_SNAKE_CASE     						= type_sequence_label_size
				SCREAMING_SNAKE_CASE     						= initializer_range
				SCREAMING_SNAKE_CASE     						= scope
				SCREAMING_SNAKE_CASE     						= backbone_featmap_shape

				# in ViT hybrid, the seq length equals the number of patches + 1 (we add 1 for the [CLS] token)
				# the number of patches is based on the feature map of the backbone, which by default uses an output stride
				# of 32, which means that the feature map has a spatial resolution of 1/32 of the input image size
				SCREAMING_SNAKE_CASE     						= (self.image_size // 3_2) ** 2
				SCREAMING_SNAKE_CASE     						= num_patches + 1







	def  snake_case__     (     self      :Dict			)		->      Any:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]			)

				SCREAMING_SNAKE_CASE     						= None
				if self.use_labels:
							SCREAMING_SNAKE_CASE     						= ids_tensor([self.batch_size]   ,     self.type_sequence_label_size			)

				SCREAMING_SNAKE_CASE     						= self.get_config()

				return config, pixel_values, labels







	def  snake_case__     (     self      :Union[str, Any]			)		->      List[str]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= {
				    '''global_padding''': '''same''',
				    '''layer_type''': '''bottleneck''',
				    '''depths''': [3, 4, 9],
				    '''out_features''': ['''stage1''', '''stage2''', '''stage3'''],
				    '''embedding_dynamic_padding''': True,
				    '''hidden_sizes''': [4, 8, 1_6, 3_2],
				    '''num_groups''': 2,
				}

				return ViTHybridConfig(
				    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=lowercase   ,     initializer_range=self.initializer_range   ,     backbone_featmap_shape=self.backbone_featmap_shape   ,     backbone_config=lowercase   ,     )







	def  snake_case__     (     self      :List[str]   ,     lowercase      :str   ,     lowercase      :str   ,     lowercase      :List[str]			)		->      Union[str, Any]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= ViTHybridModel(config=lowercase			)
				model.to(lowercase			)
				model.eval()
				SCREAMING_SNAKE_CASE     						= model(lowercase			)
				self.parent.assertEqual(result.last_hidden_state.shape   ,     (self.batch_size, self.seq_length, self.hidden_size)			)







	def  snake_case__     (     self      :Optional[Any]   ,     lowercase      :Dict   ,     lowercase      :List[str]   ,     lowercase      :int			)		->      List[str]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= self.type_sequence_label_size
				SCREAMING_SNAKE_CASE     						= ViTHybridForImageClassification(lowercase			)
				model.to(lowercase			)
				model.eval()
				SCREAMING_SNAKE_CASE     						= model(lowercase   ,     labels=lowercase			)
				self.parent.assertEqual(result.logits.shape   ,     (self.batch_size, self.type_sequence_label_size)			)







	def  snake_case__     (     self      :Union[str, Any]			)		->      Any:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= self.prepare_config_and_inputs()
				SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= config_and_inputs
				SCREAMING_SNAKE_CASE     						= {'''pixel_values''': pixel_values}
				return config, inputs_dict





@require_torch
class     lowerCamelCase      (       __lowerCamelCase ,		__lowerCamelCase ,		unittest.TestCase					):
	UpperCamelCase_  :					Any    		=	(ViTHybridModel, ViTHybridForImageClassification) if is_torch_available() else ()
	UpperCamelCase_  :					Any    		=	(
	    {'feature-extraction': ViTHybridModel, 'image-classification': ViTHybridForImageClassification}
	    if is_torch_available()
	    else {}
	)
	UpperCamelCase_  :					Optional[int]    		=	False
	UpperCamelCase_  :					List[Any]    		=	False
	UpperCamelCase_  :					Any    		=	False







	def  snake_case__     (     self      :Tuple			)		->      Dict:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= ViTHybridModelTester(self			)
				SCREAMING_SNAKE_CASE     						= ConfigTester(self   ,     config_class=lowercase   ,     has_text_modality=lowercase   ,     hidden_size=3_7			)







	def  snake_case__     (     self      :Optional[int]			)		->      str:







				"""simple docstring"""






				self.config_tester.run_common_tests()







	@unittest.skip(reason='''ViT does not use inputs_embeds'''			)
	def  snake_case__     (     self      :Tuple			)		->      Any:







				"""simple docstring"""






				pass







	def  snake_case__     (     self      :Union[str, Any]			)		->      Optional[int]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= self.model_tester.prepare_config_and_inputs_for_common()

				for model_class in self.all_model_classes:
							SCREAMING_SNAKE_CASE     						= model_class(lowercase			)
							self.assertIsInstance(model.get_input_embeddings()   ,     (nn.Module)			)
							SCREAMING_SNAKE_CASE     						= model.get_output_embeddings()
							self.assertTrue(x is None or isinstance(lowercase   ,     nn.Linear			)			)







	def  snake_case__     (     self      :Optional[int]			)		->      Tuple:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= self.model_tester.prepare_config_and_inputs_for_common()

				for model_class in self.all_model_classes:
							SCREAMING_SNAKE_CASE     						= model_class(lowercase			)
							SCREAMING_SNAKE_CASE     						= inspect.signature(model.forward			)
							# signature.parameters is an OrderedDict => so arg_names order is deterministic
							SCREAMING_SNAKE_CASE     						= [*signature.parameters.keys()]

							SCREAMING_SNAKE_CASE     						= ['''pixel_values''']
							self.assertListEqual(arg_names[:1]   ,     lowercase			)







	def  snake_case__     (     self      :str			)		->      List[Any]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_model(*lowercase			)







	def  snake_case__     (     self      :List[Any]			)		->      Optional[int]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= self.model_tester.prepare_config_and_inputs()
				self.model_tester.create_and_check_for_image_classification(*lowercase			)







	def  snake_case__     (     self      :Dict			)		->      List[Any]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= self.model_tester.prepare_config_and_inputs_for_common()

				SCREAMING_SNAKE_CASE     						= _config_zero_init(lowercase			)
				for model_class in self.all_model_classes:
							SCREAMING_SNAKE_CASE     						= model_class(config=lowercase			)
							# Skip the check for the backbone
							for name, module in model.named_modules():
										if module.__class__.__name__ == "ViTHybridPatchEmbeddings":
													SCREAMING_SNAKE_CASE     						= [f"""{name}.{key}""" for key in module.state_dict().keys()]
													break

							for name, param in model.named_parameters():
										if param.requires_grad:
													if name in backbone_params:
																continue
													self.assertIn(
													    ((param.data.mean() * 1e9).round() / 1e9).item()   ,     [0.0, 1.0]   ,     msg=f"""Parameter {name} of model {model_class} seems not properly initialized"""   ,     )







	@slow
	def  snake_case__     (     self      :Optional[Any]			)		->      Optional[Any]:







				"""simple docstring"""






				for model_name in VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
							SCREAMING_SNAKE_CASE     						= ViTHybridModel.from_pretrained(lowercase			)
							self.assertIsNotNone(lowercase			)



def    a      ( )     ->int:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''	)
			return image





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







	@cached_property
	def  snake_case__     (     self      :Dict			)		->      str:







				"""simple docstring"""






				return (
				    ViTHybridImageProcessor.from_pretrained(VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST[0]			)
				    if is_vision_available()
				    else None
				)







	@slow
	def  snake_case__     (     self      :Union[str, Any]			)		->      List[Any]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= ViTHybridForImageClassification.from_pretrained(VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST[0]			).to(
				    lowercase			)

				SCREAMING_SNAKE_CASE     						= self.default_image_processor
				SCREAMING_SNAKE_CASE     						= prepare_img()
				SCREAMING_SNAKE_CASE     						= image_processor(images=lowercase   ,     return_tensors='''pt'''			).to(lowercase			)

				# forward pass
				with torch.no_grad():
							SCREAMING_SNAKE_CASE     						= model(**lowercase			)

				# verify the logits
				SCREAMING_SNAKE_CASE     						= torch.Size((1, 1_0_0_0)			)
				self.assertEqual(outputs.logits.shape   ,     lowercase			)

				SCREAMING_SNAKE_CASE     						= torch.tensor([-1.90_90, -0.49_93, -0.23_89]			).to(lowercase			)

				self.assertTrue(torch.allclose(outputs.logits[0, :3]   ,     lowercase   ,     atol=1e-4			)			)







	@slow
	@require_accelerate
	def  snake_case__     (     self      :Union[str, Any]			)		->      Optional[int]:







				"""simple docstring"""






				SCREAMING_SNAKE_CASE     						= ViTHybridImageProcessor.from_pretrained('''google/vit-hybrid-base-bit-384'''			)
				SCREAMING_SNAKE_CASE     						= ViTHybridForImageClassification.from_pretrained('''google/vit-hybrid-base-bit-384'''   ,     device_map='''auto'''			)

				SCREAMING_SNAKE_CASE     						= prepare_img()

				SCREAMING_SNAKE_CASE     						= image_processor(images=lowercase   ,     return_tensors='''pt'''			)
				SCREAMING_SNAKE_CASE     						= model(**lowercase			)
				SCREAMING_SNAKE_CASE     						= outputs.logits
				# model predicts one of the 1000 ImageNet classes
				SCREAMING_SNAKE_CASE     						= logits.argmax(-1			).item()

				self.assertTrue(model.config.idalabel[predicted_class_idx]   ,     '''tabby, tabby cat'''			)

import argparse
import re
from pathlib import Path

import requests
import torch
from PIL import Image
from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor

from transformers import (
    EfficientFormerConfig,
    EfficientFormerForImageClassificationWithTeacher,
    EfficientFormerImageProcessor,
)
from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, PILImageResampling


def    a      ( a		,						a	)     ->Dict:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= old_name

			if "patch_embed" in old_name:
						SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE						,							SCREAMING_SNAKE_CASE     						= old_name.split('''.'''	)

						if layer == "0":
									SCREAMING_SNAKE_CASE     						= old_name.replace('''0'''		,						'''convolution1'''	)
						elif layer == "1":
									SCREAMING_SNAKE_CASE     						= old_name.replace('''1'''		,						'''batchnorm_before'''	)
						elif layer == "3":
									SCREAMING_SNAKE_CASE     						= old_name.replace('''3'''		,						'''convolution2'''	)
						else:
									SCREAMING_SNAKE_CASE     						= old_name.replace('''4'''		,						'''batchnorm_after'''	)

			if "network" in old_name and re.search(r'''\d\.\d'''		,						a	):
						SCREAMING_SNAKE_CASE     						= r'''\b\d{2}\b'''
						if bool(re.search(a		,						a	)	):
									SCREAMING_SNAKE_CASE     						= re.search(r'''\d\.\d\d.'''		,						a	).group()
						else:
									SCREAMING_SNAKE_CASE     						= re.search(r'''\d\.\d.'''		,						a	).group()
						if int(match[0]	) < 6:
									SCREAMING_SNAKE_CASE     						= old_name.replace(a		,						''''''	)
									SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''network'''		,						match[0] + '''.meta4D_layers.blocks.''' + match[2:-1]	)
									SCREAMING_SNAKE_CASE     						= '''intermediate_stages.''' + trimmed_name
						else:
									SCREAMING_SNAKE_CASE     						= old_name.replace(a		,						''''''	)
									if int(match[2]	) < num_meta4D_last_stage:
												SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''network'''		,						'''meta4D_layers.blocks.''' + match[2]	)
									else:
												SCREAMING_SNAKE_CASE     						= str(int(match[2]	) - num_meta4D_last_stage	)
												SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''network'''		,						'''meta3D_layers.blocks.''' + layer_index	)
												if "norm1" in old_name:
															SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''norm1'''		,						'''layernorm1'''	)
												elif "norm2" in old_name:
															SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''norm2'''		,						'''layernorm2'''	)
												elif "fc1" in old_name:
															SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''fc1'''		,						'''linear_in'''	)
												elif "fc2" in old_name:
															SCREAMING_SNAKE_CASE     						= trimmed_name.replace('''fc2'''		,						'''linear_out'''	)

									SCREAMING_SNAKE_CASE     						= '''last_stage.''' + trimmed_name

			elif "network" in old_name and re.search(r'''.\d.'''		,						a	):
						SCREAMING_SNAKE_CASE     						= old_name.replace('''network'''		,						'''intermediate_stages'''	)

			if "fc" in new_name:
						SCREAMING_SNAKE_CASE     						= new_name.replace('''fc'''		,						'''convolution'''	)
			elif ("norm1" in new_name) and ("layernorm1" not in new_name):
						SCREAMING_SNAKE_CASE     						= new_name.replace('''norm1'''		,						'''batchnorm_before'''	)
			elif ("norm2" in new_name) and ("layernorm2" not in new_name):
						SCREAMING_SNAKE_CASE     						= new_name.replace('''norm2'''		,						'''batchnorm_after'''	)
			if "proj" in new_name:
						SCREAMING_SNAKE_CASE     						= new_name.replace('''proj'''		,						'''projection'''	)
			if "dist_head" in new_name:
						SCREAMING_SNAKE_CASE     						= new_name.replace('''dist_head'''		,						'''distillation_classifier'''	)
			elif "head" in new_name:
						SCREAMING_SNAKE_CASE     						= new_name.replace('''head'''		,						'''classifier'''	)
			elif "patch_embed" in new_name:
						SCREAMING_SNAKE_CASE     						= '''efficientformer.''' + new_name
			elif new_name == "norm.weight" or new_name == "norm.bias":
						SCREAMING_SNAKE_CASE     						= new_name.replace('''norm'''		,						'''layernorm'''	)
						SCREAMING_SNAKE_CASE     						= '''efficientformer.''' + new_name
			else:
						SCREAMING_SNAKE_CASE     						= '''efficientformer.encoder.''' + new_name

			return new_name


def    a      ( a		,						a	)     ->Any:




			'''simple docstring'''


			for key in checkpoint.copy().keys():
						SCREAMING_SNAKE_CASE     						= checkpoint.pop(a	)
						SCREAMING_SNAKE_CASE     						= val

			return checkpoint


def    a      ( )     ->List[Any]:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= '''http://images.cocodataset.org/val2017/000000039769.jpg'''
			SCREAMING_SNAKE_CASE     						= Image.open(requests.get(a		,						stream=a	).raw	)

			return image


def    a      ( a		,						a		,						a		,						a	)     ->Tuple:




			'''simple docstring'''


			SCREAMING_SNAKE_CASE     						= torch.load(a		,						map_location='''cpu'''	)['''model''']
			SCREAMING_SNAKE_CASE     						= EfficientFormerConfig.from_json_file(a	)
			SCREAMING_SNAKE_CASE     						= EfficientFormerForImageClassificationWithTeacher(a	)
			SCREAMING_SNAKE_CASE     						= '''_'''.join(checkpoint_path.split('''/'''	)[-1].split('''.'''	)[0].split('''_'''	)[:-1]	)

			SCREAMING_SNAKE_CASE     						= config.depths[-1] - config.num_metaad_blocks + 1
			SCREAMING_SNAKE_CASE     						= convert_torch_checkpoint(a		,						a	)

			model.load_state_dict(a	)
			model.eval()

			SCREAMING_SNAKE_CASE     						= {
			    '''bilinear''': PILImageResampling.BILINEAR,
			    '''bicubic''': PILImageResampling.BICUBIC,
			    '''nearest''': PILImageResampling.NEAREST,
			}

			# prepare image
			SCREAMING_SNAKE_CASE     						= prepare_img()
			SCREAMING_SNAKE_CASE     						= 256
			SCREAMING_SNAKE_CASE     						= 224
			SCREAMING_SNAKE_CASE     						= EfficientFormerImageProcessor(
			    size={'''shortest_edge''': image_size}		,						crop_size={'''height''': crop_size, '''width''': crop_size}		,						resample=pillow_resamplings['''bicubic''']		,						)
			SCREAMING_SNAKE_CASE     						= processor(images=a		,						return_tensors='''pt'''	).pixel_values

			# original processing pipeline
			SCREAMING_SNAKE_CASE     						= Compose(
			    [
			        Resize(a		,						interpolation=pillow_resamplings['''bicubic''']	),
			        CenterCrop(a	),
			        ToTensor(),
			        Normalize(a		,						a	),
			    ]	)
			SCREAMING_SNAKE_CASE     						= image_transforms(a	).unsqueeze(0	)

			assert torch.allclose(a		,						a	)

			SCREAMING_SNAKE_CASE     						= model(a	)
			SCREAMING_SNAKE_CASE     						= outputs.logits

			SCREAMING_SNAKE_CASE     						= (1, 1000)

			if "l1" in model_name:
						SCREAMING_SNAKE_CASE     						= torch.Tensor(
						    [-0.13_12, 0.43_53, -1.04_99, -0.51_24, 0.41_83, -0.67_93, -1.37_77, -0.08_93, -0.73_58, -2.43_28]	)
						assert torch.allclose(logits[0, :10]		,						a		,						atol=1E-3	)
						assert logits.shape == expected_shape
			elif "l3" in model_name:
						SCREAMING_SNAKE_CASE     						= torch.Tensor(
						    [-1.31_50, -1.54_56, -1.25_56, -0.84_96, -0.71_27, -0.78_97, -0.97_28, -0.30_52, 0.37_51, -0.31_27]	)
						assert torch.allclose(logits[0, :10]		,						a		,						atol=1E-3	)
						assert logits.shape == expected_shape
			elif "l7" in model_name:
						SCREAMING_SNAKE_CASE     						= torch.Tensor(
						    [-1.02_83, -1.41_31, -0.56_44, -1.31_15, -0.57_85, -1.20_49, -0.75_28, 0.19_92, -0.38_22, -0.08_78]	)
						assert logits.shape == expected_shape
			else:
						raise ValueError(
						    F"""Unknown model checkpoint: {checkpoint_path}. Supported version of efficientformer are l1, l3 and l7"""	)

			# Save Checkpoints
			Path(a	).mkdir(exist_ok=a	)
			model.save_pretrained(a	)
			print(F"""Checkpoint successfuly converted. Model saved at {pytorch_dump_path}"""	)
			processor.save_pretrained(a	)
			print(F"""Processor successfuly saved at {pytorch_dump_path}"""	)

			if push_to_hub:
						print('''Pushing model to the hub...'''	)

						model.push_to_hub(
						    repo_id=F"""Bearnardd/{pytorch_dump_path}"""		,						commit_message='''Add model'''		,						use_temp_dir=a		,						)
						processor.push_to_hub(
						    repo_id=F"""Bearnardd/{pytorch_dump_path}"""		,						commit_message='''Add image processor'''		,						use_temp_dir=a		,						)


if __name__ == "__main__":
							__lowerCAmelCase					   =       argparse.ArgumentParser()
							# Required parameters
							parser.add_argument(
							    '--pytorch_model_path',
							    default=None,
							    type=str,
							    required=True,
							    help='Path to EfficientFormer pytorch checkpoint.',
							)
							parser.add_argument(
							    '--config_file',
							    default=None,
							    type=str,
							    required=True,
							    help='The json file for EfficientFormer model config.',
							)
							parser.add_argument(
							    '--pytorch_dump_path', default=None, type=str, required=True, help='Path to the output PyTorch model.'
							)

							parser.add_argument('--push_to_hub', action='store_true', help='Push model and image processor to the hub')
							parser.add_argument(
							    '--no-push_to_hub',
							    dest='push_to_hub',
							    action='store_false',
							    help='Do not push model and image processor to the hub',
							)
							parser.set_defaults(push_to_hub=True)

							__lowerCAmelCase					   =       parser.parse_args()
							convert_efficientformer_checkpoint(
							    checkpoint_path=args.pytorch_model_path,
							    efficientformer_config_file=args.config_file,
							    pytorch_dump_path=args.pytorch_dump_path,
							    push_to_hub=args.push_to_hub,
							)