
import json
import os
import re
import shutil
import tempfile
import unittest
from typing import Tuple

from transformers import AddedToken, BatchEncoding, PerceiverTokenizer
from transformers.utils import cached_property, is_tf_available, is_torch_available

from ...test_tokenization_common import TokenizerTesterMixin


if is_torch_available():
  lowercase  : str						   =							"""pt"""
elif is_tf_available():
  lowercase  : Any						   =							"""tf"""
else:
  lowercase  : Tuple						   =							"""jax"""

class __snake_case		(				lowerCAmelCase ,     unittest.TestCase					):
    _a		:						str=    PerceiverTokenizer
    _a		:						str=    False
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           super().setUp()
           lowercase							:					Tuple	     =				PerceiverTokenizer()
           tokenizer.save_pretrained(self.tmpdirname				)
    @cached_property
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           return PerceiverTokenizer.from_pretrained("""deepmind/language-perceiver"""				)
    def 				_SCREAMING_SNAKE_CASE	(  self		,**snake_case				):



           '''simple docstring'''







           return self.tokenizer_class.from_pretrained(self.tmpdirname		,**snake_case				)
    def 				_SCREAMING_SNAKE_CASE	(  self		,snake_case		,snake_case=False		,snake_case=20		,snake_case=5				):



           '''simple docstring'''







           lowercase							:					Any	     =				[]
           for i in range(len(snake_case				)				):
                  try:
                         lowercase							:					List[str]	     =				tokenizer.decode([i]		,clean_up_tokenization_spaces=snake_case				)
                  except UnicodeDecodeError:
                         pass
                  toks.append((i, tok)				)

           lowercase							:					Optional[Any]	     =				list(filter(lambda snake_case				: re.match(r"""^[ a-zA-Z]+$"""		,t[1]				)		,snake_case				)				)
           lowercase							:					str	     =				list(filter(lambda snake_case				: [t[0]] == tokenizer.encode(t[1]		,add_special_tokens=snake_case				)		,snake_case				)				)
           if max_length is not None and len(snake_case				) > max_length:
                  lowercase							:					Tuple	     =				toks[:max_length]
           if min_length is not None and len(snake_case				) < min_length and len(snake_case				) > 0:
                  while len(snake_case				) < min_length:
                         lowercase							:					Tuple	     =				toks + toks
        # toks_str = [t[1] for t in toks]
           lowercase							:					List[str]	     =				[t[0] for t in toks]

           # Ensure consistency
           lowercase							:					Any	     =				tokenizer.decode(snake_case		,clean_up_tokenization_spaces=snake_case				)
           if " " not in output_txt and len(snake_case				) > 1:
                  lowercase							:					int	     =				(
                      tokenizer.decode([toks_ids[0]]		,clean_up_tokenization_spaces=snake_case				)
                      + """ """
                      + tokenizer.decode(toks_ids[1:]		,clean_up_tokenization_spaces=snake_case				)
                  )
           if with_prefix_space:
                  lowercase							:					Optional[int]	     =				""" """ + output_txt
           lowercase							:					Any	     =				tokenizer.encode(snake_case		,add_special_tokens=snake_case				)
           return output_txt, output_ids
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Tuple	     =				self.perceiver_tokenizer
           lowercase							:					int	     =				"""Unicode €."""
           lowercase							:					Any	     =				tokenizer(snake_case				)
           lowercase							:					Dict	     =				[4, 91, 116, 111, 105, 117, 106, 107, 38, 232, 136, 178, 52, 5]
           self.assertEqual(encoded["""input_ids"""]		,snake_case				)

           # decoding
           lowercase							:					Any	     =				tokenizer.decode(snake_case				)
           self.assertEqual(snake_case		,"""[CLS]Unicode €.[SEP]"""				)

           lowercase							:					Any	     =				tokenizer("""e è é ê ë"""				)
           lowercase							:					int	     =				[4, 107, 38, 201, 174, 38, 201, 175, 38, 201, 176, 38, 201, 177, 5]
           self.assertEqual(encoded["""input_ids"""]		,snake_case				)
           # decoding
           lowercase							:					Tuple	     =				tokenizer.decode(snake_case				)
           self.assertEqual(snake_case		,"""[CLS]e è é ê ë[SEP]"""				)

           # encode/decode, but with `encode` instead of `__call__`
           self.assertEqual(tokenizer.decode(tokenizer.encode("""e è é ê ë"""				)				)		,"""[CLS]e è é ê ë[SEP]"""				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Tuple	     =				self.perceiver_tokenizer
           lowercase							:					Optional[int]	     =				["""A long paragraph for summarization.""", """Another paragraph for summarization."""]
           # fmt: off
           lowercase							:					Tuple	     =				[4, 71, 38, 114, 117, 116, 109, 38, 118, 103, 120, 103, 109, 120, 103, 118, 110, 38, 108, 117, 120, 38, 121, 123, 115, 115, 103, 120, 111, 128, 103, 122, 111, 117, 116, 52, 5, 0]
           # fmt: on
           lowercase							:					Tuple	     =				tokenizer(snake_case		,padding=snake_case		,return_tensors=snake_case				)
           self.assertIsInstance(snake_case		,snake_case				)

           if FRAMEWORK != "jax":
                  lowercase							:					List[Any]	     =				list(batch.input_ids.numpy()[0]				)
           else:
                  lowercase							:					int	     =				list(batch.input_ids.tolist()[0]				)

           self.assertListEqual(snake_case		,snake_case				)

           self.assertEqual((2, 38)		,batch.input_ids.shape				)
           self.assertEqual((2, 38)		,batch.attention_mask.shape				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Optional[Any]	     =				self.perceiver_tokenizer
           lowercase							:					List[str]	     =				["""A long paragraph for summarization.""", """Another paragraph for summarization."""]
           lowercase							:					Union[str, Any]	     =				tokenizer(snake_case		,padding=snake_case		,return_tensors=snake_case				)
           # check if input_ids are returned and no decoder_input_ids
           self.assertIn("""input_ids"""		,snake_case				)
           self.assertIn("""attention_mask"""		,snake_case				)
           self.assertNotIn("""decoder_input_ids"""		,snake_case				)
           self.assertNotIn("""decoder_attention_mask"""		,snake_case				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Optional[Any]	     =				self.perceiver_tokenizer
           lowercase							:					int	     =				[
               """Summary of the text.""",
               """Another summary.""",
           ]
           lowercase							:					Any	     =				tokenizer(
               text_target=snake_case		,max_length=32		,padding="""max_length"""		,truncation=snake_case		,return_tensors=snake_case				)
           self.assertEqual(32		,targets["""input_ids"""].shape[1]				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					str	     =				self.get_tokenizers()
           for tokenizer in tokenizers:
                  with self.subTest(f"{tokenizer.__class__.__name__}"				):
                         self.assertNotEqual(tokenizer.model_max_length		,42				)

        # Now let's start the test
           lowercase							:					str	     =				self.get_tokenizers()
           for tokenizer in tokenizers:
                  with self.subTest(f"{tokenizer.__class__.__name__}"				):
                         # Isolate this from the other tests because we save additional tokens/etc
                         lowercase							:					Any	     =				tempfile.mkdtemp()

                         lowercase							:					Any	     =				""" He is very happy, UNwant\u00E9d,running"""
                         lowercase							:					Tuple	     =				tokenizer.encode(snake_case		,add_special_tokens=snake_case				)
                         tokenizer.save_pretrained(snake_case				)

                         lowercase							:					Tuple	     =				tokenizer.__class__.from_pretrained(snake_case				)
                         lowercase							:					Tuple	     =				after_tokenizer.encode(snake_case		,add_special_tokens=snake_case				)
                         self.assertListEqual(snake_case		,snake_case				)

                         shutil.rmtree(snake_case				)

           lowercase							:					Tuple	     =				self.get_tokenizers(model_max_length=42				)
           for tokenizer in tokenizers:
                  with self.subTest(f"{tokenizer.__class__.__name__}"				):
                         # Isolate this from the other tests because we save additional tokens/etc
                         lowercase							:					Tuple	     =				tempfile.mkdtemp()

                         lowercase							:					Optional[int]	     =				""" He is very happy, UNwant\u00E9d,running"""
                         tokenizer.add_tokens(["""bim""", """bambam"""]				)
                         lowercase							:					Any	     =				tokenizer.additional_special_tokens
                         additional_special_tokens.append("""new_additional_special_token"""				)
                         tokenizer.add_special_tokens({"""additional_special_tokens""": additional_special_tokens}				)
                         lowercase							:					Any	     =				tokenizer.encode(snake_case		,add_special_tokens=snake_case				)
                         tokenizer.save_pretrained(snake_case				)

                         lowercase							:					List[str]	     =				tokenizer.__class__.from_pretrained(snake_case				)
                         lowercase							:					Tuple	     =				after_tokenizer.encode(snake_case		,add_special_tokens=snake_case				)
                         self.assertListEqual(snake_case		,snake_case				)
                         self.assertIn("""new_additional_special_token"""		,after_tokenizer.additional_special_tokens				)
                         self.assertEqual(after_tokenizer.model_max_length		,42				)

                         lowercase							:					List[str]	     =				tokenizer.__class__.from_pretrained(snake_case		,model_max_length=43				)
                         self.assertEqual(tokenizer.model_max_length		,43				)

                         shutil.rmtree(snake_case				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Any	     =				[]
           if self.test_slow_tokenizer:
                  tokenizer_list.append((self.tokenizer_class, self.get_tokenizer())				)

           if self.test_rust_tokenizer:
                  tokenizer_list.append((self.rust_tokenizer_class, self.get_rust_tokenizer())				)

           for tokenizer_class, tokenizer_utils in tokenizer_list:
                  with tempfile.TemporaryDirectory() as tmp_dir:
                         tokenizer_utils.save_pretrained(snake_case				)

                         with open(os.path.join(snake_case		,"""special_tokens_map.json"""				)		,encoding="""utf-8"""				) as json_file:
                                lowercase							:					Dict	     =				json.load(snake_case				)

                         with open(os.path.join(snake_case		,"""tokenizer_config.json"""				)		,encoding="""utf-8"""				) as json_file:
                                lowercase							:					Tuple	     =				json.load(snake_case				)

                         lowercase							:					Dict	     =				[f"<extra_id_{i}>" for i in range(125				)]

                         lowercase							:					int	     =				added_tokens_extra_ids + [
                             """an_additional_special_token"""
                         ]
                         lowercase							:					List[str]	     =				added_tokens_extra_ids + [
                             """an_additional_special_token"""
                         ]

                         with open(os.path.join(snake_case		,"""special_tokens_map.json"""				)		,"""w"""		,encoding="""utf-8"""				) as outfile:
                                json.dump(snake_case		,snake_case				)
                         with open(os.path.join(snake_case		,"""tokenizer_config.json"""				)		,"""w"""		,encoding="""utf-8"""				) as outfile:
                                json.dump(snake_case		,snake_case				)

                         # the following checks allow us to verify that our test works as expected, i.e. that the tokenizer takes
                         # into account the new value of additional_special_tokens given in the "tokenizer_config.json" and
                         # "special_tokens_map.json" files
                         lowercase							:					Optional[int]	     =				tokenizer_class.from_pretrained(
                             snake_case		,)
                         self.assertIn(
                             """an_additional_special_token"""		,tokenizer_without_change_in_init.additional_special_tokens				)
                         self.assertEqual(
                             ["""an_additional_special_token"""]		,tokenizer_without_change_in_init.convert_ids_to_tokens(
                                 tokenizer_without_change_in_init.convert_tokens_to_ids(["""an_additional_special_token"""]				)				)		,)

                         # Now we test that we can change the value of additional_special_tokens in the from_pretrained
                         lowercase							:					str	     =				added_tokens_extra_ids + [AddedToken("""a_new_additional_special_token"""		,lstrip=snake_case				)]
                         lowercase							:					Optional[int]	     =				tokenizer_class.from_pretrained(
                             snake_case		,additional_special_tokens=snake_case		,)

                         self.assertIn("""a_new_additional_special_token"""		,tokenizer.additional_special_tokens				)
                         self.assertEqual(
                             ["""a_new_additional_special_token"""]		,tokenizer.convert_ids_to_tokens(
                                 tokenizer.convert_tokens_to_ids(["""a_new_additional_special_token"""]				)				)		,)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					List[Any]	     =				self.perceiver_tokenizer
           self.assertEqual(tokenizer.decode([178]				)		,"""�"""				)
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           pass
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           pass
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           pass
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           pass
    def 				_SCREAMING_SNAKE_CASE	(  self				):



           '''simple docstring'''







           lowercase							:					Union[str, Any]	     =				self.get_tokenizers(fast=snake_case		,do_lower_case=snake_case				)
           for tokenizer in tokenizers:
                  with self.subTest(f"{tokenizer.__class__.__name__}"				):
                         lowercase							:					Dict	     =				["""[CLS]""", """t""", """h""", """i""", """s""", """ """, """i""", """s""", """ """, """a""", """ """, """t""", """e""", """s""", """t""", """[SEP]"""]
                         lowercase							:					Any	     =				tokenizer.convert_tokens_to_string(snake_case				)

                         self.assertIsInstance(snake_case		,snake_case				)


import argparse

import requests
import torch
from PIL import Image

from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel







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

       return name







def 						_snake_case(  SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__    )			->   List[str]:
       for key in orig_state_dict.copy().keys():
              lowercase							:					List[Any]	     =				orig_state_dict.pop(SCREAMING_SNAKE_CASE__    )

              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
                     lowercase							:					Dict	     =				key.split("""."""    )
                     lowercase     ,      lowercase							:					Optional[Any]	     =				int(key_split[2]    ), int(key_split[4]    )
                     lowercase							:					List[Any]	     =				config.vision_config.hidden_size
                     if "weight" in key:
                            lowercase							:					str	     =				val[:dim, :]
                            lowercase							:					List[str]	     =				val[dim : dim * 2, :]
                            lowercase							:					Optional[int]	     =				val[-dim:, :]
                     else:
                            lowercase							:					Dict	     =				val[:dim]
                            lowercase							:					Dict	     =				val[dim : dim * 2]
                            lowercase							:					Dict	     =				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
                     lowercase							:					int	     =				key.split("""."""    )
                     lowercase							:					Tuple	     =				int(key_split[3]    )
                     lowercase							:					str	     =				config.text_config.hidden_size
                     if "weight" in key:
                            lowercase							:					Optional[int]	     =				val[:dim, :]
                            lowercase							:					Optional[Any]	     =				val[
                                dim : dim * 2, :
                            ]
                            lowercase							:					Optional[int]	     =				val[-dim:, :]
                     else:
                            lowercase							:					Optional[int]	     =				val[:dim]
                            lowercase							:					Dict	     =				val[dim : dim * 2]
                            lowercase							:					List[str]	     =				val[-dim:]
              else:
                     lowercase							:					Tuple	     =				rename_key(SCREAMING_SNAKE_CASE__    )
                     # 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
                     ):
                            lowercase							:					str	     =				val.squeeze_()
                     else:
                            lowercase							:					Any	     =				val

       return orig_state_dict







def 						_snake_case(  )			->   List[Any]:
       lowercase							:					Tuple	     =				"""http://images.cocodataset.org/val2017/000000039769.jpg"""
       lowercase							:					Any	     =				Image.open(requests.get(SCREAMING_SNAKE_CASE__ ,     stream=SCREAMING_SNAKE_CASE__    ).raw    )
       return im







@torch.no_grad()
def 						_snake_case(  SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__ ,     SCREAMING_SNAKE_CASE__="groupvit-gcc-yfcc" ,     SCREAMING_SNAKE_CASE__=False    )			->   str:
       lowercase							:					Dict	     =				GroupViTConfig()
       lowercase							:					Tuple	     =				GroupViTModel(SCREAMING_SNAKE_CASE__    ).eval()

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

       # verify result
       lowercase							:					Tuple	     =				CLIPProcessor.from_pretrained("""openai/clip-vit-base-patch32"""    )
       lowercase							:					Optional[Any]	     =				prepare_img()
       lowercase							:					List[Any]	     =				processor(text=["""a photo of a cat""", """a photo of a dog"""] ,     images=SCREAMING_SNAKE_CASE__ ,     padding=SCREAMING_SNAKE_CASE__ ,     return_tensors="""pt"""    )

       with torch.no_grad():
              lowercase							:					Optional[Any]	     =				model(**SCREAMING_SNAKE_CASE__    )

       if model_name == "groupvit-gcc-yfcc":
              lowercase							:					Optional[int]	     =				torch.tensor([[13.3523, 6.3629]]    )
       elif model_name == "groupvit-gcc-redcaps":
              lowercase							:					int	     =				torch.tensor([[16.1873, 8.6230]]    )
       else:
              raise ValueError(f"Model name {model_name} not supported."    )
       assert torch.allclose(outputs.logits_per_image ,     SCREAMING_SNAKE_CASE__ ,     atol=1e-3    )

       processor.save_pretrained(SCREAMING_SNAKE_CASE__    )
       model.save_pretrained(SCREAMING_SNAKE_CASE__    )
       print("""Successfully saved processor and model to""" ,     SCREAMING_SNAKE_CASE__    )

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


if __name__ == "__main__":
  lowercase  : List[Any]						   =							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`.""",
  )
  lowercase  : Union[str, Any]						   =							parser.parse_args()

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