





import inspect
import unittest

from transformers import DPTConfig
from transformers.file_utils import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

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 MODEL_MAPPING, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTModel
       from transformers.models.dpt.modeling_dpt import DPT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
       from PIL import Image

       from transformers import DPTImageProcessor







class       __A							:




      """simple docstring"""







      def __init__(		self   ,				a__   ,				a__=2   ,				a__=32   ,				a__=16   ,				a__=3   ,				a__=True   ,				a__=True   ,				a__=32   ,				a__=4   ,				a__=[0, 1, 2, 3]   ,				a__=4   ,				a__=37   ,				a__="gelu"   ,				a__=0.1   ,				a__=0.1   ,				a__=0.02   ,				a__=3   ,				a__=[1, 384, 24, 24]   ,				a__=True   ,				a__=None   ,				):



             """simple docstring"""





             _lowerCamelCase				:  Tuple						=		parent
             _lowerCamelCase				:  Optional[Any]						=		batch_size
             _lowerCamelCase				:  Optional[int]						=		image_size
             _lowerCamelCase				:  Optional[int]						=		patch_size
             _lowerCamelCase				:  Optional[int]						=		num_channels
             _lowerCamelCase				:  Any						=		is_training
             _lowerCamelCase				:  Tuple						=		use_labels
             _lowerCamelCase				:  int						=		hidden_size
             _lowerCamelCase				:  Optional[Any]						=		num_hidden_layers
             _lowerCamelCase				:  Optional[int]						=		backbone_out_indices
             _lowerCamelCase				:  List[str]						=		num_attention_heads
             _lowerCamelCase				:  Union[str, Any]						=		intermediate_size
             _lowerCamelCase				:  Optional[int]						=		hidden_act
             _lowerCamelCase				:  Tuple						=		hidden_dropout_prob
             _lowerCamelCase				:  Optional[int]						=		attention_probs_dropout_prob
             _lowerCamelCase				:  List[str]						=		initializer_range
             _lowerCamelCase				:  Optional[int]						=		num_labels
             _lowerCamelCase				:  List[str]						=		backbone_featmap_shape
             _lowerCamelCase				:  int						=		scope
             _lowerCamelCase				:  str						=		is_hybrid
             # sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
             _lowerCamelCase				:  Dict						=		(image_size // patch_size) ** 2
             _lowerCamelCase				:  Optional[int]						=		num_patches + 1


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Union[str, Any]						=		floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])

             _lowerCamelCase				:  str						=		None
             if self.use_labels:
                    _lowerCamelCase				:  Optional[int]						=		ids_tensor([self.batch_size, self.image_size, self.image_size]   ,				self.num_labels)

             _lowerCamelCase				:  List[Any]						=		self.get_config()

             return config, pixel_values, labels


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  List[str]						=		{
                 '''global_padding''': '''same''',
                 '''layer_type''': '''bottleneck''',
                 '''depths''': [3, 4, 9],
                 '''out_features''': ['''stage1''', '''stage2''', '''stage3'''],
                 '''embedding_dynamic_padding''': True,
                 '''hidden_sizes''': [96, 192, 384, 768],
                 '''num_groups''': 2,
             }

             return DPTConfig(
                 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   ,				backbone_out_indices=self.backbone_out_indices   ,				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   ,				is_hybrid=self.is_hybrid   ,				backbone_config=a__   ,				backbone_featmap_shape=self.backbone_featmap_shape   ,				)


      def 					__snake_case      (		self   ,				a__   ,				a__   ,				a__):



             """simple docstring"""





             _lowerCamelCase				:  Union[str, Any]						=		DPTModel(config=a__)
             model.to(a__)
             model.eval()
             _lowerCamelCase				:  Optional[Any]						=		model(a__)
             self.parent.assertEqual(result.last_hidden_state.shape   ,				(self.batch_size, self.seq_length, self.hidden_size))


      def 					__snake_case      (		self   ,				a__   ,				a__   ,				a__):



             """simple docstring"""





             _lowerCamelCase				:  Optional[int]						=		self.num_labels
             _lowerCamelCase				:  List[Any]						=		DPTForDepthEstimation(a__)
             model.to(a__)
             model.eval()
             _lowerCamelCase				:  str						=		model(a__)
             self.parent.assertEqual(result.predicted_depth.shape   ,				(self.batch_size, self.image_size, self.image_size))


      def 					__snake_case      (		self   ,				a__   ,				a__   ,				a__):



             """simple docstring"""





             _lowerCamelCase				:  List[Any]						=		self.num_labels
             _lowerCamelCase				:  Optional[int]						=		DPTForSemanticSegmentation(a__)
             model.to(a__)
             model.eval()
             _lowerCamelCase				:  List[Any]						=		model(a__   ,				labels=a__)
             self.parent.assertEqual(
                 result.logits.shape   ,				(self.batch_size, self.num_labels, self.image_size, self.image_size))



      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Tuple						=		self.prepare_config_and_inputs()
             _lowerCamelCase,	_lowerCamelCase,	_lowerCamelCase				:  Optional[Any]						=		config_and_inputs
             _lowerCamelCase				:  Tuple						=		{'''pixel_values''': pixel_values}
             return config, inputs_dict







@require_torch
class       __A							(   lowerCamelCase__			,lowerCamelCase__			,unittest.TestCase	):




      """simple docstring"""







      UpperCAmelCase__							=   (DPTModel, DPTForDepthEstimation, DPTForSemanticSegmentation) if is_torch_available() else ()
      UpperCAmelCase__							=   (
          {
              """depth-estimation""": DPTForDepthEstimation,
              """feature-extraction""": DPTModel,
              """image-segmentation""": DPTForSemanticSegmentation,
          }
          if is_torch_available()
          else {}
      )

      UpperCAmelCase__							=   False
      UpperCAmelCase__							=   False
      UpperCAmelCase__							=   False


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Optional[int]						=		DPTModelTester(self)
             _lowerCamelCase				:  Tuple						=		ConfigTester(self   ,				config_class=a__   ,				has_text_modality=a__   ,				hidden_size=37)


      def 					__snake_case      (		self):



             """simple docstring"""





             self.config_tester.run_common_tests()


      @unittest.skip(reason='''DPT does not use inputs_embeds''')
      def 					__snake_case      (		self):



             """simple docstring"""





             pass


      def 					__snake_case      (		self):



             """simple docstring"""





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

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


      def 					__snake_case      (		self):



             """simple docstring"""





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

             for model_class in self.all_model_classes:
                    _lowerCamelCase				:  List[str]						=		model_class(a__)
                    _lowerCamelCase				:  Optional[Any]						=		inspect.signature(model.forward)
                    # signature.parameters is an OrderedDict => so arg_names order is deterministic
                    _lowerCamelCase				:  Union[str, Any]						=		[*signature.parameters.keys()]

                    _lowerCamelCase				:  Tuple						=		['''pixel_values''']
                    self.assertListEqual(arg_names[:1]   ,				a__)


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Tuple						=		self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_model(*a__)


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  List[str]						=		self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_depth_estimation(*a__)


      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  Optional[Any]						=		self.model_tester.prepare_config_and_inputs()
             self.model_tester.create_and_check_for_semantic_segmentation(*a__)


      def 					__snake_case      (		self):



             """simple docstring"""





             for model_class in self.all_model_classes:
                    if model_class.__name__ == "DPTForDepthEstimation":
                           continue

                    _lowerCamelCase,	_lowerCamelCase				:  int						=		self.model_tester.prepare_config_and_inputs_for_common()
                    _lowerCamelCase				:  Any						=		True

                    if model_class in get_values(a__):
                           continue

                    _lowerCamelCase				:  Optional[int]						=		model_class(a__)
                    model.to(a__)
                    model.train()
                    _lowerCamelCase				:  Optional[Any]						=		self._prepare_for_class(a__   ,				a__   ,				return_labels=a__)
                    _lowerCamelCase				:  List[Any]						=		model(**a__).loss
                    loss.backward()


      def 					__snake_case      (		self):



             """simple docstring"""





             for model_class in self.all_model_classes:
                    if model_class.__name__ == "DPTForDepthEstimation":
                           continue

                    _lowerCamelCase,	_lowerCamelCase				:  Union[str, Any]						=		self.model_tester.prepare_config_and_inputs_for_common()
                    _lowerCamelCase				:  Tuple						=		False
                    _lowerCamelCase				:  str						=		True

                    if model_class in get_values(a__) or not model_class.supports_gradient_checkpointing:
                           continue
                    _lowerCamelCase				:  Any						=		model_class(a__)
                    model.to(a__)
                    model.gradient_checkpointing_enable()
                    model.train()
                    _lowerCamelCase				:  List[Any]						=		self._prepare_for_class(a__   ,				a__   ,				return_labels=a__)
                    _lowerCamelCase				:  Optional[int]						=		model(**a__).loss
                    loss.backward()


      def 					__snake_case      (		self):



             """simple docstring"""





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

             _lowerCamelCase				:  Any						=		_config_zero_init(a__)
             for model_class in self.all_model_classes:
                    _lowerCamelCase				:  Union[str, Any]						=		model_class(config=a__)
                    # Skip the check for the backbone
                    _lowerCamelCase				:  Union[str, Any]						=		[]
                    for name, module in model.named_modules():
                           if module.__class__.__name__ == "DPTViTHybridEmbeddings":
                                  _lowerCamelCase				:  List[Any]						=		[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"""   ,				)


      @unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.''')
      def 					__snake_case      (		self):



             """simple docstring"""





             pass


      @slow
      def 					__snake_case      (		self):



             """simple docstring"""





             for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[1:]:
                    _lowerCamelCase				:  List[Any]						=		DPTModel.from_pretrained(a__)
                    self.assertIsNotNone(a__)



      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase,	_lowerCamelCase				:  str						=		self.model_tester.prepare_config_and_inputs_for_common()
             _lowerCamelCase				:  Dict						=		'''add'''
             with self.assertRaises(a__):
                    _lowerCamelCase				:  List[Any]						=		DPTForDepthEstimation(a__)




def  __UpperCAmelCase(   ):
       _lowerCamelCase				:  Tuple						=		Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''   )
       return image







@require_torch
@require_vision
@slow
class       __A							(   unittest.TestCase	):




      """simple docstring"""







      def 					__snake_case      (		self):



             """simple docstring"""





             _lowerCamelCase				:  str						=		DPTImageProcessor.from_pretrained('''Intel/dpt-hybrid-midas''')
             _lowerCamelCase				:  List[str]						=		DPTForDepthEstimation.from_pretrained('''Intel/dpt-hybrid-midas''').to(a__)

             _lowerCamelCase				:  Any						=		prepare_img()
             _lowerCamelCase				:  str						=		image_processor(images=a__   ,				return_tensors='''pt''').to(a__)

             # forward pass
             with torch.no_grad():
                    _lowerCamelCase				:  Tuple						=		model(**a__)
                    _lowerCamelCase				:  List[Any]						=		outputs.predicted_depth

             # verify the predicted depth
             _lowerCamelCase				:  Any						=		torch.Size((1, 384, 384))
             self.assertEqual(predicted_depth.shape   ,				a__)

             _lowerCamelCase				:  List[str]						=		torch.tensor(
                 [[[5.6437, 5.6146, 5.6511], [5.4371, 5.5649, 5.5958], [5.5215, 5.5184, 5.5293]]]).to(a__)

             self.assertTrue(torch.allclose(outputs.predicted_depth[:3, :3, :3] / 100   ,				a__   ,				atol=1e-4))








import argparse

import requests
import torch
from PIL import Image

from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel




def  __UpperCAmelCase(   lowercase_   ):
       # vision encoder
       if "img_encoder.pos_embed" in name:
              _lowerCamelCase				:  Tuple						=		name.replace('''img_encoder.pos_embed'''			,     '''vision_model.embeddings.position_embeddings'''   )
       if "img_encoder.patch_embed.proj" in name:
              _lowerCamelCase				:  List[str]						=		name.replace('''img_encoder.patch_embed.proj'''			,     '''vision_model.embeddings.patch_embeddings.projection'''   )
       if "img_encoder.patch_embed.norm" in name:
              _lowerCamelCase				:  Dict						=		name.replace('''img_encoder.patch_embed.norm'''			,     '''vision_model.embeddings.layernorm'''   )
       if "img_encoder.layers" in name:
              _lowerCamelCase				:  Dict						=		name.replace('''img_encoder.layers'''			,     '''vision_model.encoder.stages'''   )
       if "blocks" in name and "res" not in name:
              _lowerCamelCase				:  Optional[Any]						=		name.replace('''blocks'''			,     '''layers'''   )
       if "attn" in name and "pre_assign" not in name:
              _lowerCamelCase				:  Tuple						=		name.replace('''attn'''			,     '''self_attn'''   )
       if "proj" in name and "self_attn" in name and "text" not in name:
              _lowerCamelCase				:  Optional[int]						=		name.replace('''proj'''			,     '''out_proj'''   )
       if "pre_assign_attn.attn.proj" in name:
              _lowerCamelCase				:  List[Any]						=		name.replace('''pre_assign_attn.attn.proj'''			,     '''pre_assign_attn.attn.out_proj'''   )
       if "norm1" in name:
              _lowerCamelCase				:  int						=		name.replace('''norm1'''			,     '''layer_norm1'''   )
       if "norm2" in name and "pre_assign" not in name:
              _lowerCamelCase				:  Optional[int]						=		name.replace('''norm2'''			,     '''layer_norm2'''   )
       if "img_encoder.norm" in name:
              _lowerCamelCase				:  Dict						=		name.replace('''img_encoder.norm'''			,     '''vision_model.layernorm'''   )
       # text encoder
       if "text_encoder.token_embedding" in name:
              _lowerCamelCase				:  List[Any]						=		name.replace('''text_encoder.token_embedding'''			,     '''text_model.embeddings.token_embedding'''   )
       if "text_encoder.positional_embedding" in name:
              _lowerCamelCase				:  Optional[Any]						=		name.replace('''text_encoder.positional_embedding'''			,     '''text_model.embeddings.position_embedding.weight'''   )
       if "text_encoder.transformer.resblocks." in name:
              _lowerCamelCase				:  Dict						=		name.replace('''text_encoder.transformer.resblocks.'''			,     '''text_model.encoder.layers.'''   )
       if "ln_1" in name:
              _lowerCamelCase				:  Tuple						=		name.replace('''ln_1'''			,     '''layer_norm1'''   )
       if "ln_2" in name:
              _lowerCamelCase				:  List[str]						=		name.replace('''ln_2'''			,     '''layer_norm2'''   )
       if "c_fc" in name:
              _lowerCamelCase				:  List[str]						=		name.replace('''c_fc'''			,     '''fc1'''   )
       if "c_proj" in name:
              _lowerCamelCase				:  str						=		name.replace('''c_proj'''			,     '''fc2'''   )
       if "text_encoder" in name:
              _lowerCamelCase				:  Tuple						=		name.replace('''text_encoder'''			,     '''text_model'''   )
       if "ln_final" in name:
              _lowerCamelCase				:  str						=		name.replace('''ln_final'''			,     '''final_layer_norm'''   )
       # projection layers
       if "img_projector.linear_hidden." in name:
              _lowerCamelCase				:  str						=		name.replace('''img_projector.linear_hidden.'''			,     '''visual_projection.'''   )
       if "img_projector.linear_out." in name:
              _lowerCamelCase				:  Union[str, Any]						=		name.replace('''img_projector.linear_out.'''			,     '''visual_projection.3.'''   )
       if "text_projector.linear_hidden" in name:
              _lowerCamelCase				:  List[str]						=		name.replace('''text_projector.linear_hidden'''			,     '''text_projection'''   )
       if "text_projector.linear_out" in name:
              _lowerCamelCase				:  Any						=		name.replace('''text_projector.linear_out'''			,     '''text_projection.3'''   )

       return name




def  __UpperCAmelCase(   lowercase_			,     lowercase_   ):
       for key in orig_state_dict.copy().keys():
              _lowerCamelCase				:  Optional[int]						=		orig_state_dict.pop(lowercase_   )

              if "qkv" in key:
                     # weights and biases of the key, value and query projections of vision encoder's attention layers require special treatment:
                     # we need to split them up into separate matrices/vectors
                     _lowerCamelCase				:  Tuple						=		key.split('''.'''   )
                     _lowerCamelCase,	_lowerCamelCase				:  Dict						=		int(key_split[2]   ), int(key_split[4]   )
                     _lowerCamelCase				:  Optional[int]						=		config.vision_config.hidden_size
                     if "weight" in key:
                            _lowerCamelCase				:  List[Any]						=		val[:dim, :]
                            _lowerCamelCase				:  List[Any]						=		val[dim : dim * 2, :]
                            _lowerCamelCase				:  Optional[Any]						=		val[-dim:, :]
                     else:
                            _lowerCamelCase				:  Union[str, Any]						=		val[:dim]
                            _lowerCamelCase				:  Optional[Any]						=		val[dim : dim * 2]
                            _lowerCamelCase				:  Any						=		val[-dim:]
              elif "in_proj" in key:
                     # weights and biases of the key, value and query projections of text encoder's attention layers require special treatment:
                     # we need to split them up into separate matrices/vectors
                     _lowerCamelCase				:  Optional[int]						=		key.split('''.'''   )
                     _lowerCamelCase				:  Optional[Any]						=		int(key_split[3]   )
                     _lowerCamelCase				:  Union[str, Any]						=		config.text_config.hidden_size
                     if "weight" in key:
                            _lowerCamelCase				:  Any						=		val[:dim, :]
                            _lowerCamelCase				:  Optional[Any]						=		val[
                                dim : dim * 2, :
                            ]
                            _lowerCamelCase				:  Dict						=		val[-dim:, :]
                     else:
                            _lowerCamelCase				:  List[Any]						=		val[:dim]
                            _lowerCamelCase				:  Tuple						=		val[dim : dim * 2]
                            _lowerCamelCase				:  str						=		val[-dim:]
              else:
                     _lowerCamelCase				:  Optional[Any]						=		rename_key(lowercase_   )
                     # squeeze if necessary
                     if (
                         "text_projection.0" in new_name
                         or "text_projection.3" in new_name
                         or "visual_projection.0" in new_name
                         or "visual_projection.3" in new_name
                     ):
                            _lowerCamelCase				:  List[str]						=		val.squeeze_()
                     else:
                            _lowerCamelCase				:  Tuple						=		val

       return orig_state_dict




def  __UpperCAmelCase(   ):
       _lowerCamelCase				:  Union[str, Any]						=		'''http://images.cocodataset.org/val2017/000000039769.jpg'''
       _lowerCamelCase				:  Any						=		Image.open(requests.get(lowercase_			,     stream=lowercase_   ).raw   )
       return im




@torch.no_grad()
def  __UpperCAmelCase(   lowercase_			,     lowercase_			,     lowercase_="groupvit-gcc-yfcc"			,     lowercase_=False   ):
       _lowerCamelCase				:  Optional[Any]						=		GroupViTConfig()
       _lowerCamelCase				:  Any						=		GroupViTModel(lowercase_   ).eval()

       _lowerCamelCase				:  Optional[Any]						=		torch.load(lowercase_			,     map_location='''cpu'''   )['''model''']
       _lowerCamelCase				:  List[str]						=		convert_state_dict(lowercase_			,     lowercase_   )
       _lowerCamelCase,	_lowerCamelCase				:  List[str]						=		model.load_state_dict(lowercase_			,     strict=lowercase_   )
       assert missing_keys == ["text_model.embeddings.position_ids"]
       assert (unexpected_keys == ["multi_label_logit_scale"]) or (len(lowercase_   ) == 0)

       # verify result
       _lowerCamelCase				:  Optional[Any]						=		CLIPProcessor.from_pretrained('''openai/clip-vit-base-patch32'''   )
       _lowerCamelCase				:  Dict						=		prepare_img()
       _lowerCamelCase				:  str						=		processor(text=['''a photo of a cat''', '''a photo of a dog''']			,     images=lowercase_			,     padding=lowercase_			,     return_tensors='''pt'''   )

       with torch.no_grad():
              _lowerCamelCase				:  Optional[int]						=		model(**lowercase_   )

       if model_name == "groupvit-gcc-yfcc":
              _lowerCamelCase				:  Dict						=		torch.tensor([[1_3.3_5_2_3, 6.3_6_2_9]]   )
       elif model_name == "groupvit-gcc-redcaps":
              _lowerCamelCase				:  Tuple						=		torch.tensor([[1_6.1_8_7_3, 8.6_2_3_0]]   )
       else:
              raise ValueError(F"""Model name {model_name} not supported."""   )
       assert torch.allclose(outputs.logits_per_image			,     lowercase_			,     atol=1e-3   )

       processor.save_pretrained(lowercase_   )
       model.save_pretrained(lowercase_   )
       print('''Successfully saved processor and model to'''			,     lowercase_   )

       if push_to_hub:
              print('''Pushing to the hub...'''   )
              processor.push_to_hub(lowercase_			,     organization='''nielsr'''   )
              model.push_to_hub(lowercase_			,     organization='''nielsr'''   )


if __name__ == "__main__":
       _lowerCamelCase      							=   argparse.ArgumentParser()
       parser.add_argument(
           '--pytorch_dump_folder_path', default=None, type=str, help='Path to dump the processor and PyTorch model.'
       )
       parser.add_argument('--checkpoint_path', default=None, type=str, help='Path to GroupViT checkpoint')
       parser.add_argument(
           '--model_name',
           default='groupvit-gccy-fcc',
           type=str,
           help='Name of the model. Expecting either \'groupvit-gcc-yfcc\' or \'groupvit-gcc-redcaps\'',
       )
       parser.add_argument(
           '--push_to_hub',
           action='store_true',
           help='Whether or not to push the converted model and processor to the 🤗 hub using the provided `model_name`.',
       )
       _lowerCamelCase      							=   parser.parse_args()

       convert_groupvit_checkpoint(args.checkpoint_path, args.pytorch_dump_folder_path, args.model_name, args.push_to_hub)

