
import argparse
import collections
import json
import os
import re
import string
import sys

import numpy as np


__magic_name__  							=	re.compile(r'''\b(a|an|the)\b''', re.UNICODE)

__magic_name__  							=	None





def 						SCREAMING_SNAKE_CASE__     (   ):
    snake_case__    =					argparse.ArgumentParser("Official evaluation script for SQuAD version 2.0."				)
    parser.add_argument("data_file"     ,		metavar="data.json"     ,		help="Input data JSON file."				)
    parser.add_argument("pred_file"     ,		metavar="pred.json"     ,		help="Model predictions."				)
    parser.add_argument(
        "--out-file"     ,		"-o"     ,		metavar="eval.json"     ,		help="Write accuracy metrics to file (default is stdout)."				)
    parser.add_argument(
        "--na-prob-file"     ,		"-n"     ,		metavar="na_prob.json"     ,		help="Model estimates of probability of no answer."				)
    parser.add_argument(
        "--na-prob-thresh"     ,		"-t"     ,		type=__lowerCAmelCase     ,		default=1.0     ,		help="Predict \"\" if no-answer probability exceeds this (default = 1.0)."     ,		)
    parser.add_argument(
        "--out-image-dir"     ,		"-p"     ,		metavar="out_images"     ,		default=__lowerCAmelCase     ,		help="Save precision-recall curves to directory."				)
    parser.add_argument("--verbose"     ,		"-v"     ,		action="store_true"				)
    if len(sys.argv				) == 1:
        parser.print_help()
        sys.exit(1				)
    return parser.parse_args()





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):
    snake_case__    =					{}
    for article in dataset:
        for p in article["paragraphs"]:
            for qa in p["qas"]:
                snake_case__    =					bool(qa["answers"]["text"]				)
    return qid_to_has_ans





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):

    def remove_articles(__lowerCAmelCase				):
        return ARTICLES_REGEX.sub(" "     ,		__lowerCAmelCase				)

    def white_space_fix(__lowerCAmelCase				):
        return " ".join(text.split()				)

    def remove_punc(__lowerCAmelCase				):
        snake_case__    =					set(string.punctuation				)
        return "".join(ch for ch in text if ch not in exclude				)

    def lower(__lowerCAmelCase				):
        return text.lower()

    return white_space_fix(remove_articles(remove_punc(lower(__lowerCAmelCase				)				)				)				)





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase				):
    if not s:
        return []
    return normalize_answer(__lowerCAmelCase				).split()





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase				):
    return int(normalize_answer(__lowerCAmelCase				) == normalize_answer(__lowerCAmelCase				)				)





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase				):
    snake_case__    =					get_tokens(__lowerCAmelCase				)
    snake_case__    =					get_tokens(__lowerCAmelCase				)
    snake_case__    =					collections.Counter(__lowerCAmelCase				) & collections.Counter(__lowerCAmelCase				)
    snake_case__    =					sum(common.values()				)
    if len(__lowerCAmelCase				) == 0 or len(__lowerCAmelCase				) == 0:
        # If either is no-answer, then F1 is 1 if they agree, 0 otherwise
        return int(gold_toks == pred_toks				)
    if num_same == 0:
        return 0
    snake_case__    =					1.0 * num_same / len(__lowerCAmelCase				)
    snake_case__    =					1.0 * num_same / len(__lowerCAmelCase				)
    snake_case__    =					(2 * precision * recall) / (precision + recall)
    return fa





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase				):
    snake_case__    =					{}
    snake_case__    =					{}
    for article in dataset:
        for p in article["paragraphs"]:
            for qa in p["qas"]:
                snake_case__    =					qa["id"]
                snake_case__    =					[t for t in qa["answers"]["text"] if normalize_answer(__lowerCAmelCase				)]
                if not gold_answers:
                    # For unanswerable questions, only correct answer is empty string
                    snake_case__    =					[""]
                if qid not in preds:
                    print(F"""Missing prediction for {qid}"""				)
                    continue
                snake_case__    =					preds[qid]
                # Take max over all gold answers
                snake_case__    =					max(compute_exact(__lowerCAmelCase     ,		__lowerCAmelCase				) for a in gold_answers				)
                snake_case__    =					max(compute_fa(__lowerCAmelCase     ,		__lowerCAmelCase				) for a in gold_answers				)
    return exact_scores, fa_scores





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    snake_case__    =					{}
    for qid, s in scores.items():
        snake_case__    =					na_probs[qid] > na_prob_thresh
        if pred_na:
            snake_case__    =					float(not qid_to_has_ans[qid]				)
        else:
            snake_case__    =					s
    return new_scores





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase=None				):
    if not qid_list:
        snake_case__    =					len(__lowerCAmelCase				)
        return collections.OrderedDict(
            [
                ("exact", 100.0 * sum(exact_scores.values()				) / total),
                ("f1", 100.0 * sum(fa_scores.values()				) / total),
                ("total", total),
            ]				)
    else:
        snake_case__    =					len(__lowerCAmelCase				)
        return collections.OrderedDict(
            [
                ("exact", 100.0 * sum(exact_scores[k] for k in qid_list				) / total),
                ("f1", 100.0 * sum(fa_scores[k] for k in qid_list				) / total),
                ("total", total),
            ]				)





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    for k in new_eval:
        snake_case__    =					new_eval[k]





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    plt.step(__lowerCAmelCase     ,		__lowerCAmelCase     ,		color="b"     ,		alpha=0.2     ,		where="post"				)
    plt.fill_between(__lowerCAmelCase     ,		__lowerCAmelCase     ,		step="post"     ,		alpha=0.2     ,		color="b"				)
    plt.xlabel("Recall"				)
    plt.ylabel("Precision"				)
    plt.xlim([0.0, 1.05]				)
    plt.ylim([0.0, 1.05]				)
    plt.title(__lowerCAmelCase				)
    plt.savefig(__lowerCAmelCase				)
    plt.clf()





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase=None     ,		__lowerCAmelCase=None				):
    snake_case__    =					sorted(__lowerCAmelCase     ,		key=lambda __lowerCAmelCase				: na_probs[k]				)
    snake_case__    =					0.0
    snake_case__    =					1.0
    snake_case__    =					0.0
    snake_case__    =					[1.0]
    snake_case__    =					[0.0]
    snake_case__    =					0.0
    for i, qid in enumerate(__lowerCAmelCase				):
        if qid_to_has_ans[qid]:
            true_pos += scores[qid]
        snake_case__    =					true_pos / float(i + 1				)
        snake_case__    =					true_pos / float(__lowerCAmelCase				)
        if i == len(__lowerCAmelCase				) - 1 or na_probs[qid] != na_probs[qid_list[i + 1]]:
            # i.e., if we can put a threshold after this point
            avg_prec += cur_p * (cur_r - recalls[-1])
            precisions.append(__lowerCAmelCase				)
            recalls.append(__lowerCAmelCase				)
    if out_image:
        plot_pr_curve(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				)
    return {"ap": 100.0 * avg_prec}





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    if out_image_dir and not os.path.exists(__lowerCAmelCase				):
        os.makedirs(__lowerCAmelCase				)
    snake_case__    =					sum(1 for v in qid_to_has_ans.values() if v				)
    if num_true_pos == 0:
        return
    snake_case__    =					make_precision_recall_eval(
        __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		out_image=os.path.join(__lowerCAmelCase     ,		"pr_exact.png"				)     ,		title="Precision-Recall curve for Exact Match score"     ,		)
    snake_case__    =					make_precision_recall_eval(
        __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		out_image=os.path.join(__lowerCAmelCase     ,		"pr_f1.png"				)     ,		title="Precision-Recall curve for F1 score"     ,		)
    snake_case__    =					{k: float(__lowerCAmelCase				) for k, v in qid_to_has_ans.items()}
    snake_case__    =					make_precision_recall_eval(
        __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		out_image=os.path.join(__lowerCAmelCase     ,		"pr_oracle.png"				)     ,		title="Oracle Precision-Recall curve (binary task of HasAns vs. NoAns)"     ,		)
    merge_eval(__lowerCAmelCase     ,		__lowerCAmelCase     ,		"pr_exact"				)
    merge_eval(__lowerCAmelCase     ,		__lowerCAmelCase     ,		"pr_f1"				)
    merge_eval(__lowerCAmelCase     ,		__lowerCAmelCase     ,		"pr_oracle"				)





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    if not qid_list:
        return
    snake_case__    =					[na_probs[k] for k in qid_list]
    snake_case__    =					np.ones_like(__lowerCAmelCase				) / float(len(__lowerCAmelCase				)				)
    plt.hist(__lowerCAmelCase     ,		weights=__lowerCAmelCase     ,		bins=20     ,		range=(0.0, 1.0)				)
    plt.xlabel("Model probability of no-answer"				)
    plt.ylabel("Proportion of dataset"				)
    plt.title(F"""Histogram of no-answer probability: {name}"""				)
    plt.savefig(os.path.join(__lowerCAmelCase     ,		F"""na_prob_hist_{name}.png"""				)				)
    plt.clf()





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    snake_case__    =					sum(1 for k in qid_to_has_ans if not qid_to_has_ans[k]				)
    snake_case__    =					num_no_ans
    snake_case__    =					cur_score
    snake_case__    =					0.0
    snake_case__    =					sorted(__lowerCAmelCase     ,		key=lambda __lowerCAmelCase				: na_probs[k]				)
    for i, qid in enumerate(__lowerCAmelCase				):
        if qid not in scores:
            continue
        if qid_to_has_ans[qid]:
            snake_case__    =					scores[qid]
        else:
            if preds[qid]:
                snake_case__    =					-1
            else:
                snake_case__    =					0
        cur_score += diff
        if cur_score > best_score:
            snake_case__    =					cur_score
            snake_case__    =					na_probs[qid]
    return 100.0 * best_score / len(__lowerCAmelCase				), best_thresh





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				):
    snake_case__    ,       snake_case__    =					find_best_thresh(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				)
    snake_case__    ,       snake_case__    =					find_best_thresh(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				)
    snake_case__    =					best_exact
    snake_case__    =					exact_thresh
    snake_case__    =					best_fa
    snake_case__    =					fa_thresh





def 						SCREAMING_SNAKE_CASE__     (   ):
    with open(OPTS.data_file				) as f:
        snake_case__    =					json.load(__lowerCAmelCase				)
        snake_case__    =					dataset_json["data"]
    with open(OPTS.pred_file				) as f:
        snake_case__    =					json.load(__lowerCAmelCase				)
    if OPTS.na_prob_file:
        with open(OPTS.na_prob_file				) as f:
            snake_case__    =					json.load(__lowerCAmelCase				)
    else:
        snake_case__    =					{k: 0.0 for k in preds}
    snake_case__    =					make_qid_to_has_ans(__lowerCAmelCase				)  # maps qid to True/False
    snake_case__    =					[k for k, v in qid_to_has_ans.items() if v]
    snake_case__    =					[k for k, v in qid_to_has_ans.items() if not v]
    snake_case__    ,       snake_case__    =					get_raw_scores(__lowerCAmelCase     ,		__lowerCAmelCase				)
    snake_case__    =					apply_no_ans_threshold(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		OPTS.na_prob_thresh				)
    snake_case__    =					apply_no_ans_threshold(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		OPTS.na_prob_thresh				)
    snake_case__    =					make_eval_dict(__lowerCAmelCase     ,		__lowerCAmelCase				)
    if has_ans_qids:
        snake_case__    =					make_eval_dict(__lowerCAmelCase     ,		__lowerCAmelCase     ,		qid_list=__lowerCAmelCase				)
        merge_eval(__lowerCAmelCase     ,		__lowerCAmelCase     ,		"HasAns"				)
    if no_ans_qids:
        snake_case__    =					make_eval_dict(__lowerCAmelCase     ,		__lowerCAmelCase     ,		qid_list=__lowerCAmelCase				)
        merge_eval(__lowerCAmelCase     ,		__lowerCAmelCase     ,		"NoAns"				)
    if OPTS.na_prob_file:
        find_all_best_thresh(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase				)
    if OPTS.na_prob_file and OPTS.out_image_dir:
        run_precision_recall_analysis(__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase     ,		OPTS.out_image_dir				)
        histogram_na_prob(__lowerCAmelCase     ,		__lowerCAmelCase     ,		OPTS.out_image_dir     ,		"hasAns"				)
        histogram_na_prob(__lowerCAmelCase     ,		__lowerCAmelCase     ,		OPTS.out_image_dir     ,		"noAns"				)
    if OPTS.out_file:
        with open(OPTS.out_file     ,		"w"				) as f:
            json.dump(__lowerCAmelCase     ,		__lowerCAmelCase				)
    else:
        print(json.dumps(__lowerCAmelCase     ,		indent=2				)				)


if __name__ == "__main__":
     __magic_name__  							=	parse_args()
     if OPTS.out_image_dir:
          import matplotlib

          matplotlib.use('''Agg''')
          import matplotlib.pyplot as plt
     main()





import argparse

import requests
import torch
from PIL import Image

from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel





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

    return name





def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase				):
    for key in orig_state_dict.copy().keys():
        snake_case__    =					orig_state_dict.pop(__lowerCAmelCase				)

        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
            snake_case__    =					key.split("."				)
            snake_case__    ,       snake_case__    =					int(key_split[2]				), int(key_split[4]				)
            snake_case__    =					config.vision_config.hidden_size
            if "weight" in key:
                snake_case__    =					val[:dim, :]
                snake_case__    =					val[dim : dim * 2, :]
                snake_case__    =					val[-dim:, :]
            else:
                snake_case__    =					val[:dim]
                snake_case__    =					val[dim : dim * 2]
                snake_case__    =					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
            snake_case__    =					key.split("."				)
            snake_case__    =					int(key_split[3]				)
            snake_case__    =					config.text_config.hidden_size
            if "weight" in key:
                snake_case__    =					val[:dim, :]
                snake_case__    =					val[
                    dim : dim * 2, :
                ]
                snake_case__    =					val[-dim:, :]
            else:
                snake_case__    =					val[:dim]
                snake_case__    =					val[dim : dim * 2]
                snake_case__    =					val[-dim:]
        else:
            snake_case__    =					rename_key(__lowerCAmelCase				)
            # 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
            ):
                snake_case__    =					val.squeeze_()
            else:
                snake_case__    =					val

    return orig_state_dict





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





@torch.no_grad()
def 						SCREAMING_SNAKE_CASE__     (   __lowerCAmelCase     ,		__lowerCAmelCase     ,		__lowerCAmelCase="groupvit-gcc-yfcc"     ,		__lowerCAmelCase=False				):
    snake_case__    =					GroupViTConfig()
    snake_case__    =					GroupViTModel(__lowerCAmelCase				).eval()

    snake_case__    =					torch.load(__lowerCAmelCase     ,		map_location="cpu"				)["model"]
    snake_case__    =					convert_state_dict(__lowerCAmelCase     ,		__lowerCAmelCase				)
    snake_case__    ,       snake_case__    =					model.load_state_dict(__lowerCAmelCase     ,		strict=__lowerCAmelCase				)
    assert missing_keys == ["text_model.embeddings.position_ids"]
    assert (unexpected_keys == ["multi_label_logit_scale"]) or (len(__lowerCAmelCase				) == 0)

    # verify result
    snake_case__    =					CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32"				)
    snake_case__    =					prepare_img()
    snake_case__    =					processor(text=["a photo of a cat", "a photo of a dog"]     ,		images=__lowerCAmelCase     ,		padding=__lowerCAmelCase     ,		return_tensors="pt"				)

    with torch.no_grad():
        snake_case__    =					model(**__lowerCAmelCase				)

    if model_name == "groupvit-gcc-yfcc":
        snake_case__    =					torch.tensor([[13.3_523, 6.3_629]]				)
    elif model_name == "groupvit-gcc-redcaps":
        snake_case__    =					torch.tensor([[16.1_873, 8.6_230]]				)
    else:
        raise ValueError(F"""Model name {model_name} not supported."""				)
    assert torch.allclose(outputs.logits_per_image     ,		__lowerCAmelCase     ,		atol=1E-3				)

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

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


if __name__ == "__main__":
     __magic_name__  							=	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`.''',
     )
     __magic_name__  							=	parser.parse_args()

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



