



import inspect
import unittest

from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

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_MAPPING,
							    SegformerForImageClassification,
							    SegformerForSemanticSegmentation,
							    SegformerModel,
							)
							from transformers.models.segformer.modeling_segformer import SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
							from PIL import Image

							from transformers import SegformerImageProcessor
class 			_snake_case     (   lowercase__):




				def 							A__ (  self   :  Union[str, Any]  ):
							lowercase__   					=			self.config_class(**self.inputs_dict  )
							self.parent.assertTrue(hasattr(__lowercase,   "hidden_sizes"  )  )
							self.parent.assertTrue(hasattr(__lowercase,   "num_attention_heads"  )  )
							self.parent.assertTrue(hasattr(__lowercase,   "num_encoder_blocks"  )  )
class 			_snake_case     :




				def __init__(  self   :  Optional[int],   __lowercase   :  Any,   __lowercase   :  Union[str, Any]=13,   __lowercase   :  List[str]=64,   __lowercase   :  Any=3,   __lowercase   :  Any=4,   __lowercase   :  Dict=[2, 2, 2, 2],   __lowercase   :  Tuple=[8, 4, 2, 1],   __lowercase   :  List[Any]=[16, 32, 64, 128],   __lowercase   :  Optional[int]=[1, 4, 8, 16],   __lowercase   :  List[Any]=[1, 2, 4, 8],   __lowercase   :  int=True,   __lowercase   :  Dict=True,   __lowercase   :  Union[str, Any]="gelu",   __lowercase   :  List[Any]=0.1,   __lowercase   :  Tuple=0.1,   __lowercase   :  Any=0.02,   __lowercase   :  str=3,   __lowercase   :  List[Any]=None,   ):
							lowercase__   					=			parent
							lowercase__   					=			batch_size
							lowercase__   					=			image_size
							lowercase__   					=			num_channels
							lowercase__   					=			num_encoder_blocks
							lowercase__   					=			sr_ratios
							lowercase__   					=			depths
							lowercase__   					=			hidden_sizes
							lowercase__   					=			downsampling_rates
							lowercase__   					=			num_attention_heads
							lowercase__   					=			is_training
							lowercase__   					=			use_labels
							lowercase__   					=			hidden_act
							lowercase__   					=			hidden_dropout_prob
							lowercase__   					=			attention_probs_dropout_prob
							lowercase__   					=			initializer_range
							lowercase__   					=			num_labels
							lowercase__   					=			scope




				def 							A__ (  self   :  int  ):
							lowercase__   					=			floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]  )

							lowercase__   					=			None
							if self.use_labels:
										lowercase__   					=			ids_tensor([self.batch_size, self.image_size, self.image_size],   self.num_labels  )

							lowercase__   					=			self.get_config()
							return config, pixel_values, labels




				def 							A__ (  self   :  Any  ):
							return SegformerConfig(
							    image_size=self.image_size,   num_channels=self.num_channels,   num_encoder_blocks=self.num_encoder_blocks,   depths=self.depths,   hidden_sizes=self.hidden_sizes,   num_attention_heads=self.num_attention_heads,   hidden_act=self.hidden_act,   hidden_dropout_prob=self.hidden_dropout_prob,   attention_probs_dropout_prob=self.attention_probs_dropout_prob,   initializer_range=self.initializer_range,   )




				def 							A__ (  self   :  Optional[Any],   __lowercase   :  Optional[Any],   __lowercase   :  Any,   __lowercase   :  Dict  ):
							lowercase__   					=			SegformerModel(config=__lowercase  )
							model.to(__lowercase  )
							model.eval()
							lowercase__   					=			model(__lowercase  )
							lowercase__   					=			lowercase__   					=			self.image_size // (self.downsampling_rates[-1] * 2)
							self.parent.assertEqual(
							    result.last_hidden_state.shape,   (self.batch_size, self.hidden_sizes[-1], expected_height, expected_width)  )




				def 							A__ (  self   :  Any,   __lowercase   :  Dict,   __lowercase   :  List[str],   __lowercase   :  Union[str, Any]  ):
							lowercase__   					=			self.num_labels
							lowercase__   					=			SegformerForSemanticSegmentation(__lowercase  )
							model.to(__lowercase  )
							model.eval()
							lowercase__   					=			model(__lowercase  )
							self.parent.assertEqual(
							    result.logits.shape,   (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)  )
							lowercase__   					=			model(__lowercase,   labels=__lowercase  )
							self.parent.assertEqual(
							    result.logits.shape,   (self.batch_size, self.num_labels, self.image_size // 4, self.image_size // 4)  )
							self.parent.assertGreater(result.loss,   0.0  )




				def 							A__ (  self   :  Optional[int],   __lowercase   :  List[Any],   __lowercase   :  int,   __lowercase   :  List[str]  ):
							lowercase__   					=			1
							lowercase__   					=			SegformerForSemanticSegmentation(config=__lowercase  )
							model.to(__lowercase  )
							model.eval()
							lowercase__   					=			torch.randint(0,   1,   (self.batch_size, self.image_size, self.image_size)  ).to(__lowercase  )
							lowercase__   					=			model(__lowercase,   labels=__lowercase  )
							self.parent.assertGreater(result.loss,   0.0  )




				def 							A__ (  self   :  List[str]  ):
							lowercase__   					=			self.prepare_config_and_inputs()
							lowercase__					,    lowercase__					,    lowercase__   					=			config_and_inputs
							lowercase__   					=			{"pixel_values": pixel_values}
							return config, inputs_dict
@require_torch
class 			_snake_case     (   lowercase__      ,		lowercase__      ,		unittest.TestCase):
				UpperCamelCase__			:   Union[str, Any]       						=(
				    (
				        SegformerModel,
				        SegformerForSemanticSegmentation,
				        SegformerForImageClassification,
				    )
				    if is_torch_available()
				    else ()
				)
				UpperCamelCase__			:   str       						=(
				    {
				        """feature-extraction""": SegformerModel,
				        """image-classification""": SegformerForImageClassification,
				        """image-segmentation""": SegformerForSemanticSegmentation,
				    }
				    if is_torch_available()
				    else {}
				)

				UpperCamelCase__			:   Optional[int]       						=True
				UpperCamelCase__			:   Optional[int]       						=False
				UpperCamelCase__			:   Tuple       						=False
				UpperCamelCase__			:   Union[str, Any]       						=False




				def 							A__ (  self   :  str  ):
							lowercase__   					=			SegformerModelTester(self  )
							lowercase__   					=			SegformerConfigTester(self,   config_class=__lowercase  )




				def 							A__ (  self   :  Tuple  ):
							self.config_tester.run_common_tests()




				def 							A__ (  self   :  Union[str, Any]  ):
							lowercase__   					=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*__lowercase  )




				def 							A__ (  self   :  Optional[Any]  ):
							lowercase__   					=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_binary_image_segmentation(*__lowercase  )




				def 							A__ (  self   :  Optional[Any]  ):
							lowercase__   					=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_image_segmentation(*__lowercase  )




				@unittest.skip("SegFormer does not use inputs_embeds"  )
				def 							A__ (  self   :  Union[str, Any]  ):
							pass




				@unittest.skip("SegFormer does not have get_input_embeddings method and get_output_embeddings methods"  )
				def 							A__ (  self   :  str  ):
							pass




				def 							A__ (  self   :  List[str]  ):
							lowercase__					,    lowercase__   					=			self.model_tester.prepare_config_and_inputs_for_common()

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

										lowercase__   					=			["pixel_values"]
										self.assertListEqual(arg_names[:1],   __lowercase  )




				def 							A__ (  self   :  Tuple  ):
							lowercase__					,    lowercase__   					=			self.model_tester.prepare_config_and_inputs_for_common()
							lowercase__   					=			True

							for model_class in self.all_model_classes:
										lowercase__   					=			True
										lowercase__   					=			False
										lowercase__   					=			True
										lowercase__   					=			model_class(__lowercase  )
										model.to(__lowercase  )
										model.eval()
										with torch.no_grad():
													lowercase__   					=			model(**self._prepare_for_class(__lowercase,   __lowercase  )  )
										lowercase__   					=			outputs.attentions

										lowercase__   					=			sum(self.model_tester.depths  )
										self.assertEqual(len(__lowercase  ),   __lowercase  )

										# check that output_attentions also work using config
										del inputs_dict["output_attentions"]
										lowercase__   					=			True
										lowercase__   					=			model_class(__lowercase  )
										model.to(__lowercase  )
										model.eval()
										with torch.no_grad():
													lowercase__   					=			model(**self._prepare_for_class(__lowercase,   __lowercase  )  )
										lowercase__   					=			outputs.attentions

										self.assertEqual(len(__lowercase  ),   __lowercase  )

										# verify the first attentions (first block, first layer)
										lowercase__   					=			(self.model_tester.image_size // 4) ** 2
										lowercase__   					=			(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
										self.assertListEqual(
										    list(attentions[0].shape[-3:]  ),   [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len],   )

										# verify the last attentions (last block, last layer)
										lowercase__   					=			(self.model_tester.image_size // 32) ** 2
										lowercase__   					=			(self.model_tester.image_size // (32 * self.model_tester.sr_ratios[-1])) ** 2
										self.assertListEqual(
										    list(attentions[-1].shape[-3:]  ),   [self.model_tester.num_attention_heads[-1], expected_seq_len, expected_reduced_seq_len],   )
										lowercase__   					=			len(__lowercase  )

										# Check attention is always last and order is fine
										lowercase__   					=			True
										lowercase__   					=			True
										lowercase__   					=			model_class(__lowercase  )
										model.to(__lowercase  )
										model.eval()
										with torch.no_grad():
													lowercase__   					=			model(**self._prepare_for_class(__lowercase,   __lowercase  )  )

										self.assertEqual(out_len + 1,   len(__lowercase  )  )

										lowercase__   					=			outputs.attentions

										self.assertEqual(len(__lowercase  ),   __lowercase  )
										# verify the first attentions (first block, first layer)
										lowercase__   					=			(self.model_tester.image_size // 4) ** 2
										lowercase__   					=			(self.model_tester.image_size // (4 * self.model_tester.sr_ratios[0])) ** 2
										self.assertListEqual(
										    list(self_attentions[0].shape[-3:]  ),   [self.model_tester.num_attention_heads[0], expected_seq_len, expected_reduced_seq_len],   )




				def 							A__ (  self   :  List[Any]  ):
							def check_hidden_states_output(__lowercase   :  Any,   __lowercase   :  Tuple,   __lowercase   :  Optional[int]  ):
										lowercase__   					=			model_class(__lowercase  )
										model.to(__lowercase  )
										model.eval()

										with torch.no_grad():
													lowercase__   					=			model(**self._prepare_for_class(__lowercase,   __lowercase  )  )

										lowercase__   					=			outputs.hidden_states

										lowercase__   					=			self.model_tester.num_encoder_blocks
										self.assertEqual(len(__lowercase  ),   __lowercase  )

										# verify the first hidden states (first block)
										self.assertListEqual(
										    list(hidden_states[0].shape[-3:]  ),   [
										        self.model_tester.hidden_sizes[0],
										        self.model_tester.image_size // 4,
										        self.model_tester.image_size // 4,
										    ],   )

							lowercase__					,    lowercase__   					=			self.model_tester.prepare_config_and_inputs_for_common()

							for model_class in self.all_model_classes:
										lowercase__   					=			True
										check_hidden_states_output(__lowercase,   __lowercase,   __lowercase  )

										# check that output_hidden_states also work using config
										del inputs_dict["output_hidden_states"]
										lowercase__   					=			True

										check_hidden_states_output(__lowercase,   __lowercase,   __lowercase  )




				def 							A__ (  self   :  List[str]  ):
							if not self.model_tester.is_training:
										return

							lowercase__					,    lowercase__   					=			self.model_tester.prepare_config_and_inputs_for_common()
							lowercase__   					=			True

							for model_class in self.all_model_classes:
										if model_class in get_values(__lowercase  ):
													continue

										lowercase__   					=			model_class(__lowercase  )
										model.to(__lowercase  )
										model.train()
										lowercase__   					=			self._prepare_for_class(__lowercase,   __lowercase,   return_labels=__lowercase  )
										lowercase__   					=			model(**__lowercase  ).loss
										loss.backward()




				@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."  )
				def 							A__ (  self   :  str  ):
							pass




				@slow
				def 							A__ (  self   :  List[Any]  ):
							for model_name in SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										lowercase__   					=			SegformerModel.from_pretrained(__lowercase  )
										self.assertIsNotNone(__lowercase  )



def __lowerCAmelCase	(       ):
			lowercase__   					=			Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"					)
			return image




@require_torch
class 			_snake_case     (   unittest.TestCase):




				@slow
				def 							A__ (  self   :  str  ):
							# only resize + normalize
							lowercase__   					=			SegformerImageProcessor(
							    image_scale=(512, 512),   keep_ratio=__lowercase,   align=__lowercase,   do_random_crop=__lowercase  )
							lowercase__   					=			SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512"  ).to(
							    __lowercase  )

							lowercase__   					=			prepare_img()
							lowercase__   					=			image_processor(images=__lowercase,   return_tensors="pt"  )
							lowercase__   					=			encoded_inputs.pixel_values.to(__lowercase  )

							with torch.no_grad():
										lowercase__   					=			model(__lowercase  )

							lowercase__   					=			torch.Size((1, model.config.num_labels, 128, 128)  )
							self.assertEqual(outputs.logits.shape,   __lowercase  )

							lowercase__   					=			torch.tensor(
							    [
							        [[-4.6310, -5.5232, -6.2356], [-5.1921, -6.1444, -6.5996], [-5.4424, -6.2790, -6.7574]],
							        [[-12.1391, -13.3122, -13.9554], [-12.8732, -13.9352, -14.3563], [-12.9438, -13.8226, -14.2513]],
							        [[-12.5134, -13.4686, -14.4915], [-12.8669, -14.4343, -14.7758], [-13.2523, -14.5819, -15.0694]],
							    ]  ).to(__lowercase  )
							self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3],   __lowercase,   atol=1e-4  )  )




				@slow
				def 							A__ (  self   :  Optional[int]  ):
							# only resize + normalize
							lowercase__   					=			SegformerImageProcessor(
							    image_scale=(512, 512),   keep_ratio=__lowercase,   align=__lowercase,   do_random_crop=__lowercase  )
							lowercase__   					=			SegformerForSemanticSegmentation.from_pretrained(
							    "nvidia/segformer-b1-finetuned-cityscapes-1024-1024"  ).to(__lowercase  )

							lowercase__   					=			prepare_img()
							lowercase__   					=			image_processor(images=__lowercase,   return_tensors="pt"  )
							lowercase__   					=			encoded_inputs.pixel_values.to(__lowercase  )

							with torch.no_grad():
										lowercase__   					=			model(__lowercase  )

							lowercase__   					=			torch.Size((1, model.config.num_labels, 128, 128)  )
							self.assertEqual(outputs.logits.shape,   __lowercase  )

							lowercase__   					=			torch.tensor(
							    [
							        [[-13.5748, -13.9111, -12.6500], [-14.3500, -15.3683, -14.2328], [-14.7532, -16.0424, -15.6087]],
							        [[-17.1651, -15.8725, -12.9653], [-17.2580, -17.3718, -14.8223], [-16.6058, -16.8783, -16.7452]],
							        [[-3.6456, -3.0209, -1.4203], [-3.0797, -3.1959, -2.0000], [-1.8757, -1.9217, -1.6997]],
							    ]  ).to(__lowercase  )
							self.assertTrue(torch.allclose(outputs.logits[0, :3, :3, :3],   __lowercase,   atol=1e-1  )  )




				@slow
				def 							A__ (  self   :  Any  ):
							# only resize + normalize
							lowercase__   					=			SegformerImageProcessor(
							    image_scale=(512, 512),   keep_ratio=__lowercase,   align=__lowercase,   do_random_crop=__lowercase  )
							lowercase__   					=			SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512"  ).to(
							    __lowercase  )

							lowercase__   					=			prepare_img()
							lowercase__   					=			image_processor(images=__lowercase,   return_tensors="pt"  )
							lowercase__   					=			encoded_inputs.pixel_values.to(__lowercase  )

							with torch.no_grad():
										lowercase__   					=			model(__lowercase  )

							lowercase__   					=			outputs.logits.detach().cpu()

							lowercase__   					=			image_processor.post_process_semantic_segmentation(outputs=__lowercase,   target_sizes=[(500, 300)]  )
							lowercase__   					=			torch.Size((500, 300)  )
							self.assertEqual(segmentation[0].shape,   __lowercase  )

							lowercase__   					=			image_processor.post_process_semantic_segmentation(outputs=__lowercase  )
							lowercase__   					=			torch.Size((128, 128)  )
							self.assertEqual(segmentation[0].shape,   __lowercase  )









import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from timm import create_model
from timm.data import resolve_data_config
from timm.data.transforms_factory import create_transform

from transformers import BitConfig, BitForImageClassification, BitImageProcessor
from transformers.image_utils import PILImageResampling
from transformers.utils import logging


logging.set_verbosity_info()
lowercase_						=       logging.get_logger(__name__)



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			lowercase__   					=			"huggingface/label-files"
			lowercase__   					=			"imagenet-1k-id2label.json"
			lowercase__   					=			json.load(open(hf_hub_download(SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_  ,					repo_type="dataset"					)  ,					"r"					)					)
			lowercase__   					=			{int(SCREAMING_SNAKE_CASE_					): v for k, v in idalabel.items()}
			lowercase__   					=			{v: k for k, v in idalabel.items()}

			lowercase__   					=			"std_conv" if "bit" in model_name else False

			# note that when using BiT as backbone for ViT-hybrid checkpoints,
			# one needs to additionally set config.layer_type = "bottleneck", config.stem_type = "same",
			# config.conv_layer = "std_conv_same"
			lowercase__   					=			BitConfig(
			    conv_layer=SCREAMING_SNAKE_CASE_  ,					num_labels=1000  ,					idalabel=SCREAMING_SNAKE_CASE_  ,					labelaid=SCREAMING_SNAKE_CASE_  ,					)

			return config



def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_					):
			if "stem.conv" in name:
						lowercase__   					=			name.replace("stem.conv"  ,					"bit.embedder.convolution"					)
			if "blocks" in name:
						lowercase__   					=			name.replace("blocks"  ,					"layers"					)
			if "head.fc" in name:
						lowercase__   					=			name.replace("head.fc"  ,					"classifier.1"					)
			if name.startswith("norm"					):
						lowercase__   					=			"bit." + name
			if "bit" not in name and "classifier" not in name:
						lowercase__   					=			"bit.encoder." + name

			return name



def __lowerCAmelCase	(       ):
			lowercase__   					=			"http://images.cocodataset.org/val2017/000000039769.jpg"
			lowercase__   					=			Image.open(requests.get(SCREAMING_SNAKE_CASE_  ,					stream=SCREAMING_SNAKE_CASE_					).raw					)
			return im



@torch.no_grad()
def __lowerCAmelCase	(       SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_=False					):
			lowercase__   					=			get_config(SCREAMING_SNAKE_CASE_					)

			# load original model from timm
			lowercase__   					=			create_model(SCREAMING_SNAKE_CASE_  ,					pretrained=SCREAMING_SNAKE_CASE_					)
			timm_model.eval()

			# load state_dict of original model
			lowercase__   					=			timm_model.state_dict()
			for key in state_dict.copy().keys():
						lowercase__   					=			state_dict.pop(SCREAMING_SNAKE_CASE_					)
						lowercase__   					=			val.squeeze() if "head" in key else val

			# load HuggingFace model
			lowercase__   					=			BitForImageClassification(SCREAMING_SNAKE_CASE_					)
			model.eval()
			model.load_state_dict(SCREAMING_SNAKE_CASE_					)

			# create image processor
			lowercase__   					=			create_transform(**resolve_data_config({}  ,					model=SCREAMING_SNAKE_CASE_					)					)
			lowercase__   					=			transform.transforms

			lowercase__   					=			{
			    "bilinear": PILImageResampling.BILINEAR,
			    "bicubic": PILImageResampling.BICUBIC,
			    "nearest": PILImageResampling.NEAREST,
			}

			lowercase__   					=			BitImageProcessor(
			    do_resize=SCREAMING_SNAKE_CASE_  ,					size={"shortest_edge": timm_transforms[0].size}  ,					resample=pillow_resamplings[timm_transforms[0].interpolation.value]  ,					do_center_crop=SCREAMING_SNAKE_CASE_  ,					crop_size={"height": timm_transforms[1].size[0], "width": timm_transforms[1].size[1]}  ,					do_normalize=SCREAMING_SNAKE_CASE_  ,					image_mean=timm_transforms[-1].mean.tolist()  ,					image_std=timm_transforms[-1].std.tolist()  ,					)

			lowercase__   					=			prepare_img()
			lowercase__   					=			transform(SCREAMING_SNAKE_CASE_					).unsqueeze(0					)
			lowercase__   					=			processor(SCREAMING_SNAKE_CASE_  ,					return_tensors="pt"					).pixel_values

			# verify pixel values
			assert torch.allclose(SCREAMING_SNAKE_CASE_  ,					SCREAMING_SNAKE_CASE_					)

			# verify logits
			with torch.no_grad():
						lowercase__   					=			model(SCREAMING_SNAKE_CASE_					)
						lowercase__   					=			outputs.logits

			print("Logits:"  ,					logits[0, :3]					)
			print("Predicted class:"  ,					model.config.idalabel[logits.argmax(-1					).item()]					)
			lowercase__   					=			timm_model(SCREAMING_SNAKE_CASE_					)
			assert timm_logits.shape == outputs.logits.shape
			assert torch.allclose(SCREAMING_SNAKE_CASE_  ,					outputs.logits  ,					atol=1e-3					)
			print("Looks ok!"					)

			if pytorch_dump_folder_path is not None:
						Path(SCREAMING_SNAKE_CASE_					).mkdir(exist_ok=SCREAMING_SNAKE_CASE_					)
						print(f'''Saving model {model_name} and processor to {pytorch_dump_folder_path}'''					)
						model.save_pretrained(SCREAMING_SNAKE_CASE_					)
						processor.save_pretrained(SCREAMING_SNAKE_CASE_					)

			if push_to_hub:
						print(f'''Pushing model {model_name} and processor to the hub'''					)
						model.push_to_hub(f'''ybelkada/{model_name}'''					)
						processor.push_to_hub(f'''ybelkada/{model_name}'''					)


if __name__ == "__main__":
							lowercase_						=       argparse.ArgumentParser()
							# Required parameters
							parser.add_argument(
							    """--model_name""",
							    default="""resnetv2_50x1_bitm""",
							    type=str,
							    help="""Name of the BiT timm model you'd like to convert.""",
							)
							parser.add_argument(
							    """--pytorch_dump_folder_path""", default=None, type=str, help="""Path to the output PyTorch model directory."""
							)
							parser.add_argument(
							    """--push_to_hub""",
							    action="""store_true""",
							    help="""Whether to push the model to the hub.""",
							)

							lowercase_						=       parser.parse_args()
							convert_bit_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)




