

from typing import Optional

import torch
import torch.utils.checkpoint
from torch import Tensor, nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_outputs import (
    BaseModelOutputWithNoAttention,
    BaseModelOutputWithPoolingAndNoAttention,
    ImageClassifierOutputWithNoAttention,
)
from ...modeling_utils import PreTrainedModel
from ...utils import logging
from .configuration_regnet import RegNetConfig


snake_case_			  = logging.get_logger(__name__)

# General docstring
snake_case_			  = "RegNetConfig"

# Base docstring
snake_case_			  = "facebook/regnet-y-040"
snake_case_			  = [1, 1_088, 7, 7]

# Image classification docstring
snake_case_			  = "facebook/regnet-y-040"
snake_case_			  = "tabby, tabby cat"

snake_case_			  = [
    "facebook/regnet-y-040",
    # See all regnet models at https://huggingface.co/models?filter=regnet
]


class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a						,   a = 3						,   a = 1						,   a = 1						,   a = "relu"						,   ):
         super().__init__()
         lowercase__    :   Dict      =       nn.Convad(
             lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=lowerCamelCase_						,   stride=lowerCamelCase_						,   padding=kernel_size // 2						,   groups=lowerCamelCase_						,   bias=lowerCamelCase_						,   )
         lowercase__    :   List[Any]      =       nn.BatchNormad(lowerCamelCase_)
         lowercase__    :   int      =       ACTaFN[activation] if activation is not None else nn.Identity()





    def       snake_case_				(      self						,   a):
         lowercase__    :   Dict      =       self.convolution(lowerCamelCase_)
         lowercase__    :   Optional[int]      =       self.normalization(lowerCamelCase_)
         lowercase__    :   Any      =       self.activation(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a):
         super().__init__()
         lowercase__    :   Tuple      =       RegNetConvLayer(
             config.num_channels						,   config.embedding_size						,   kernel_size=3						,   stride=2						,   activation=config.hidden_act)
         lowercase__    :   List[Any]      =       config.num_channels





    def       snake_case_				(      self						,   a):
         lowercase__    :   Optional[int]      =       pixel_values.shape[1]
         if num_channels != self.num_channels:
              raise ValueError(
                  'Make sure that the channel dimension of the pixel values match with the one set in the configuration.')
         lowercase__    :   Any      =       self.embedder(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a						,   a = 2):
         super().__init__()
         lowercase__    :   str      =       nn.Convad(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1						,   stride=lowerCamelCase_						,   bias=lowerCamelCase_)
         lowercase__    :   Any      =       nn.BatchNormad(lowerCamelCase_)





    def       snake_case_				(      self						,   a):
         lowercase__    :   Union[str, Any]      =       self.convolution(lowerCamelCase_)
         lowercase__    :   int      =       self.normalization(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a):
         super().__init__()

         lowercase__    :   int      =       nn.AdaptiveAvgPoolad((1, 1))
         lowercase__    :   List[str]      =       nn.Sequential(
             nn.Convad(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1)						,   nn.ReLU()						,   nn.Convad(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1)						,   nn.Sigmoid()						,   )





    def       snake_case_				(      self						,   a):
         lowercase__    :   Dict      =       self.pooler(lowerCamelCase_)
         lowercase__    :   Union[str, Any]      =       self.attention(lowerCamelCase_)
         lowercase__    :   Optional[int]      =       hidden_state * attention
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a						,   a						,   a = 1):
         super().__init__()
         lowercase__    :   Tuple      =       in_channels != out_channels or stride != 1
         lowercase__    :   int      =       max(1						,   out_channels // config.groups_width)
         lowercase__    :   Any      =       (
             RegNetShortCut(lowerCamelCase_						,   lowerCamelCase_						,   stride=lowerCamelCase_) if should_apply_shortcut else nn.Identity()
         )
         lowercase__    :   Optional[int]      =       nn.Sequential(
             RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1						,   activation=config.hidden_act)						,   RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   stride=lowerCamelCase_						,   groups=lowerCamelCase_						,   activation=config.hidden_act)						,   RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1						,   activation=lowerCamelCase_)						,   )
         lowercase__    :   Dict      =       ACTaFN[config.hidden_act]





    def       snake_case_				(      self						,   a):
         lowercase__    :   List[Any]      =       hidden_state
         lowercase__    :   Optional[int]      =       self.layer(lowerCamelCase_)
         lowercase__    :   List[str]      =       self.shortcut(lowerCamelCase_)
         hidden_state += residual
         lowercase__    :   Tuple      =       self.activation(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a						,   a						,   a = 1):
         super().__init__()
         lowercase__    :   Optional[int]      =       in_channels != out_channels or stride != 1
         lowercase__    :   int      =       max(1						,   out_channels // config.groups_width)
         lowercase__    :   str      =       (
             RegNetShortCut(lowerCamelCase_						,   lowerCamelCase_						,   stride=lowerCamelCase_) if should_apply_shortcut else nn.Identity()
         )
         lowercase__    :   List[Any]      =       nn.Sequential(
             RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1						,   activation=config.hidden_act)						,   RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   stride=lowerCamelCase_						,   groups=lowerCamelCase_						,   activation=config.hidden_act)						,   RegNetSELayer(lowerCamelCase_						,   reduced_channels=int(round(in_channels / 4)))						,   RegNetConvLayer(lowerCamelCase_						,   lowerCamelCase_						,   kernel_size=1						,   activation=lowerCamelCase_)						,   )
         lowercase__    :   Tuple      =       ACTaFN[config.hidden_act]





    def       snake_case_				(      self						,   a):
         lowercase__    :   str      =       hidden_state
         lowercase__    :   List[str]      =       self.layer(lowerCamelCase_)
         lowercase__    :   Optional[int]      =       self.shortcut(lowerCamelCase_)
         hidden_state += residual
         lowercase__    :   Optional[int]      =       self.activation(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a						,   a						,   a						,   a = 2						,   a = 2						,   ):
         super().__init__()

         lowercase__    :   str      =       RegNetXLayer if config.layer_type == 'x' else RegNetYLayer

         lowercase__    :   Dict      =       nn.Sequential(
             # downsampling is done in the first layer with stride of 2
             layer(
                 lowerCamelCase_						,   lowerCamelCase_						,   lowerCamelCase_						,   stride=lowerCamelCase_						,   )						,   *[layer(lowerCamelCase_						,   lowerCamelCase_						,   lowerCamelCase_) for _ in range(depth - 1)]						,   )





    def       snake_case_				(      self						,   a):
         lowercase__    :   Optional[Any]      =       self.layers(lowerCamelCase_)
         return hidden_state



class       SCREAMING_SNAKE_CASE__					(nn.Module     ):





    def __init__(      self						,   a):
         super().__init__()
         lowercase__    :   Union[str, Any]      =       nn.ModuleList([])
         # based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
         self.stages.append(
             RegNetStage(
                 lowerCamelCase_						,   config.embedding_size						,   config.hidden_sizes[0]						,   stride=2 if config.downsample_in_first_stage else 1						,   depth=config.depths[0]						,   ))
         lowercase__    :   List[str]      =       zip(config.hidden_sizes						,   config.hidden_sizes[1:])
         for (in_channels, out_channels), depth in zip(lowerCamelCase_						,   config.depths[1:]):
              self.stages.append(RegNetStage(lowerCamelCase_						,   lowerCamelCase_						,   lowerCamelCase_						,   depth=lowerCamelCase_))





    def       snake_case_				(      self						,   a						,   a = False						,   a = True):
         lowercase__    :   Any      =       () if output_hidden_states else None

         for stage_module in self.stages:
              if output_hidden_states:
                   lowercase__    :   Dict      =       hidden_states + (hidden_state,)

              lowercase__    :   List[Any]      =       stage_module(lowerCamelCase_)

         if output_hidden_states:
              lowercase__    :   List[str]      =       hidden_states + (hidden_state,)

         if not return_dict:
              return tuple(v for v in [hidden_state, hidden_states] if v is not None)

         return BaseModelOutputWithNoAttention(last_hidden_state=lowerCamelCase_						,   hidden_states=lowerCamelCase_)



class       SCREAMING_SNAKE_CASE__					(__snake_case     ):
    __lowerCamelCase						:       Tuple														=     RegNetConfig
    __lowerCamelCase						:       List[Any]														=     """regnet"""
    __lowerCamelCase						:       List[Any]														=     """pixel_values"""
    __lowerCamelCase						:       Optional[int]														=     True





    def       snake_case_				(      self						,   a):

         if isinstance(lowerCamelCase_						,   nn.Convad):
              nn.init.kaiming_normal_(module.weight						,   mode='fan_out'						,   nonlinearity='relu')
         elif isinstance(lowerCamelCase_						,   (nn.BatchNormad, nn.GroupNorm)):
              nn.init.constant_(module.weight						,   1)
              nn.init.constant_(module.bias						,   0)





    def       snake_case_				(      self						,   a						,   a=False):

         if isinstance(lowerCamelCase_						,   lowerCamelCase_):
              lowercase__    :   str      =       value



snake_case_			  = r"\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it\n    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n\n    Parameters:\n        config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n"

snake_case_			  = r"\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`ConvNextImageProcessor.__call__`] for details.\n\n        output_hidden_states (`bool`, *optional*):\n            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for\n            more detail.\n        return_dict (`bool`, *optional*):\n            Whether or not to return a [`~file_utils.ModelOutput`] instead of a plain tuple.\n"


@add_start_docstrings(
    """The bare RegNet model outputting raw features without any specific head on top."""		,       __snake_case		,       )
# Copied from transformers.models.resnet.modeling_resnet.ResNetModel with RESNET->REGNET,ResNet->RegNet
class       SCREAMING_SNAKE_CASE__					(__snake_case     ):





    def __init__(      self						,   a):
         super().__init__(lowerCamelCase_)
         lowercase__    :   Optional[int]      =       config
         lowercase__    :   Optional[int]      =       RegNetEmbeddings(lowerCamelCase_)
         lowercase__    :   Optional[Any]      =       RegNetEncoder(lowerCamelCase_)
         lowercase__    :   List[str]      =       nn.AdaptiveAvgPoolad((1, 1))
         # Initialize weights and apply final processing
         self.post_init()





    @add_start_docstrings_to_model_forward(lowerCamelCase_)
    @add_code_sample_docstrings(
        checkpoint=_CHECKPOINT_FOR_DOC						,   output_type=lowerCamelCase_						,   config_class=_CONFIG_FOR_DOC						,   modality='vision'						,   expected_output=_EXPECTED_OUTPUT_SHAPE						,   )
    def       snake_case_				(      self						,   a						,   a = None						,   a = None):
         lowercase__    :   List[str]      =       (
             output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
         )
         lowercase__    :   List[Any]      =       return_dict if return_dict is not None else self.config.use_return_dict

         lowercase__    :   Tuple      =       self.embedder(lowerCamelCase_)

         lowercase__    :   str      =       self.encoder(
             lowerCamelCase_						,   output_hidden_states=lowerCamelCase_						,   return_dict=lowerCamelCase_)

         lowercase__    :   str      =       encoder_outputs[0]

         lowercase__    :   Any      =       self.pooler(lowerCamelCase_)

         if not return_dict:
              return (last_hidden_state, pooled_output) + encoder_outputs[1:]

         return BaseModelOutputWithPoolingAndNoAttention(
             last_hidden_state=lowerCamelCase_						,   pooler_output=lowerCamelCase_						,   hidden_states=encoder_outputs.hidden_states						,   )



@add_start_docstrings(
    """\n    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    """		,       __snake_case		,       )
# Copied from transformers.models.resnet.modeling_resnet.ResNetForImageClassification with RESNET->REGNET,ResNet->RegNet,resnet->regnet
class       SCREAMING_SNAKE_CASE__					(__snake_case     ):





    def __init__(      self						,   a):
         super().__init__(lowerCamelCase_)
         lowercase__    :   Optional[Any]      =       config.num_labels
         lowercase__    :   List[str]      =       RegNetModel(lowerCamelCase_)
         # classification head
         lowercase__    :   Union[str, Any]      =       nn.Sequential(
             nn.Flatten()						,   nn.Linear(config.hidden_sizes[-1]						,   config.num_labels) if config.num_labels > 0 else nn.Identity()						,   )
         # initialize weights and apply final processing
         self.post_init()





    @add_start_docstrings_to_model_forward(lowerCamelCase_)
    @add_code_sample_docstrings(
        checkpoint=_IMAGE_CLASS_CHECKPOINT						,   output_type=lowerCamelCase_						,   config_class=_CONFIG_FOR_DOC						,   expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT						,   )
    def       snake_case_				(      self						,   a = None						,   a = None						,   a = None						,   a = None						,   ):
         lowercase__    :   List[Any]      =       return_dict if return_dict is not None else self.config.use_return_dict

         lowercase__    :   List[str]      =       self.regnet(lowerCamelCase_						,   output_hidden_states=lowerCamelCase_						,   return_dict=lowerCamelCase_)

         lowercase__    :   List[str]      =       outputs.pooler_output if return_dict else outputs[1]

         lowercase__    :   List[Any]      =       self.classifier(lowerCamelCase_)

         lowercase__    :   List[Any]      =       None

         if labels is not None:
              if self.config.problem_type is None:
                   if self.num_labels == 1:
                        lowercase__    :   str      =       'regression'
                   elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
                        lowercase__    :   Union[str, Any]      =       'single_label_classification'
                   else:
                        lowercase__    :   Any      =       'multi_label_classification'
              if self.config.problem_type == "regression":
                   lowercase__    :   List[Any]      =       MSELoss()
                   if self.num_labels == 1:
                        lowercase__    :   int      =       loss_fct(logits.squeeze()						,   labels.squeeze())
                   else:
                        lowercase__    :   str      =       loss_fct(lowerCamelCase_						,   lowerCamelCase_)
              elif self.config.problem_type == "single_label_classification":
                   lowercase__    :   int      =       CrossEntropyLoss()
                   lowercase__    :   Tuple      =       loss_fct(logits.view(-1						,   self.num_labels)						,   labels.view(-1))
              elif self.config.problem_type == "multi_label_classification":
                   lowercase__    :   Optional[int]      =       BCEWithLogitsLoss()
                   lowercase__    :   List[Any]      =       loss_fct(lowerCamelCase_						,   lowerCamelCase_)

         if not return_dict:
              lowercase__    :   Dict      =       (logits,) + outputs[2:]
              return (loss,) + output if loss is not None else output

         return ImageClassifierOutputWithNoAttention(loss=lowerCamelCase_						,   logits=lowerCamelCase_						,   hidden_states=outputs.hidden_states)






import argparse

import torch
from datasets import load_dataset
from donut import DonutModel

from transformers import (
    DonutImageProcessor,
    DonutProcessor,
    DonutSwinConfig,
    DonutSwinModel,
    MBartConfig,
    MBartForCausalLM,
    VisionEncoderDecoderModel,
    XLMRobertaTokenizerFast,
)






def     a(      A       :    Tuple       )		->       Optional[Any]:
					"""simple docstring"""





					a					     =   model.config

					a					     =   DonutSwinConfig(
					    image_size=original_config.input_size ,     patch_size=4 ,     depths=original_config.encoder_layer ,     num_heads=[4, 8, 16, 32] ,     window_size=original_config.window_size ,     embed_dim=128 ,     )
					a					     =   MBartConfig(
					    is_decoder=A ,     is_encoder_decoder=A ,     add_cross_attention=A ,     decoder_layers=original_config.decoder_layer ,     max_position_embeddings=original_config.max_position_embeddings ,     vocab_size=len(
					        model.decoder.tokenizer       ) ,     scale_embedding=A ,     add_final_layer_norm=A ,     )

					return encoder_config, decoder_config






def     a(      A       :    List[Any]       )		->       Union[str, Any]:
					"""simple docstring"""





					if "encoder.model" in name:
										a					     =   name.replace("encoder.model" ,     "encoder"       )
					if "decoder.model" in name:
										a					     =   name.replace("decoder.model" ,     "decoder"       )
					if "patch_embed.proj" in name:
										a					     =   name.replace("patch_embed.proj" ,     "embeddings.patch_embeddings.projection"       )
					if "patch_embed.norm" in name:
										a					     =   name.replace("patch_embed.norm" ,     "embeddings.norm"       )
					if name.startswith("encoder"       ):
										if "layers" in name:
															a					     =   "encoder." + name
										if "attn.proj" in name:
															a					     =   name.replace("attn.proj" ,     "attention.output.dense"       )
										if "attn" in name and "mask" not in name:
															a					     =   name.replace("attn" ,     "attention.self"       )
										if "norm1" in name:
															a					     =   name.replace("norm1" ,     "layernorm_before"       )
										if "norm2" in name:
															a					     =   name.replace("norm2" ,     "layernorm_after"       )
										if "mlp.fc1" in name:
															a					     =   name.replace("mlp.fc1" ,     "intermediate.dense"       )
										if "mlp.fc2" in name:
															a					     =   name.replace("mlp.fc2" ,     "output.dense"       )

										if name == "encoder.norm.weight":
															a					     =   "encoder.layernorm.weight"
										if name == "encoder.norm.bias":
															a					     =   "encoder.layernorm.bias"

					return name






def     a(      A       :    Union[str, Any] ,     A       :    Tuple       )		->       List[Any]:
					"""simple docstring"""





					for key in orig_state_dict.copy().keys():
										a					     =   orig_state_dict.pop(A       )

										if "qkv" in key:
															a					     =   key.split("."       )
															a					     =   int(key_split[3]       )
															a					     =   int(key_split[5]       )
															a					     =   model.encoder.encoder.layers[layer_num].blocks[block_num].attention.self.all_head_size

															if "weight" in key:
																				a					     =   val[:dim, :]
																				a					     =   val[dim : dim * 2, :]
																				a					     =   val[-dim:, :]
															else:
																				a					     =   val[:dim]
																				a					     =   val[dim : dim * 2]
																				a					     =   val[-dim:]
										elif "attn_mask" in key or key in ["encoder.model.norm.weight", "encoder.model.norm.bias"]:
															# HuggingFace implementation doesn't use attn_mask buffer
															# and model doesn't use final LayerNorms for the encoder
															pass
										else:
															a					     =   val

					return orig_state_dict






def     a(      A       :    List[Any] ,     A       :    Tuple=None ,     A       :    List[Any]=False       )		->       Optional[int]:
					"""simple docstring"""





					a					     =   DonutModel.from_pretrained(A       ).eval()

					# load HuggingFace model
					a     ,				a					     =   get_configs(A       )
					a					     =   DonutSwinModel(A       )
					a					     =   MBartForCausalLM(A       )
					a					     =   VisionEncoderDecoderModel(encoder=A ,     decoder=A       )
					model.eval()

					a					     =   original_model.state_dict()
					a					     =   convert_state_dict(A ,     A       )
					model.load_state_dict(A       )

					# verify results on scanned document
					a					     =   load_dataset("hf-internal-testing/example-documents"       )
					a					     =   dataset["test"][0]["image"].convert("RGB"       )

					a					     =   XLMRobertaTokenizerFast.from_pretrained(A ,     from_slow=A       )
					a					     =   DonutImageProcessor(
					    do_align_long_axis=original_model.config.align_long_axis ,     size=original_model.config.input_size[::-1]       )
					a					     =   DonutProcessor(A ,     A       )
					a					     =   processor(A ,     return_tensors="pt"       ).pixel_values

					if model_name == "naver-clova-ix/donut-base-finetuned-docvqa":
										a					     =   "<s_docvqa><s_question>{user_input}</s_question><s_answer>"
										a					     =   "When is the coffee break?"
										a					     =   task_prompt.replace("{user_input}" ,     A       )
					elif model_name == "naver-clova-ix/donut-base-finetuned-rvlcdip":
										a					     =   "<s_rvlcdip>"
					elif model_name in [
					    "naver-clova-ix/donut-base-finetuned-cord-v1",
					    "naver-clova-ix/donut-base-finetuned-cord-v1-2560",
					]:
										a					     =   "<s_cord>"
					elif model_name == "naver-clova-ix/donut-base-finetuned-cord-v2":
										a					     =   "s_cord-v2>"
					elif model_name == "naver-clova-ix/donut-base-finetuned-zhtrainticket":
										a					     =   "<s_zhtrainticket>"
					elif model_name in ["naver-clova-ix/donut-proto", "naver-clova-ix/donut-base"]:
										# use a random prompt
										a					     =   "hello world"
					else:
										raise ValueError("Model name not supported"       )
					a					     =   original_model.decoder.tokenizer(A ,     add_special_tokens=A ,     return_tensors="pt"       )[
					    "input_ids"
					]

					a					     =   original_model.encoder.model.patch_embed(A       )
					a     ,				a					     =   model.encoder.embeddings(A       )
					assert torch.allclose(A ,     A ,     atol=1e-3       )

					# verify encoder hidden states
					a					     =   original_model.encoder(A       )
					a					     =   model.encoder(A       ).last_hidden_state
					assert torch.allclose(A ,     A ,     atol=1e-2       )

					# verify decoder hidden states
					a					     =   original_model(A ,     A ,     A       ).logits
					a					     =   model(A ,     decoder_input_ids=A       ).logits
					assert torch.allclose(A ,     A ,     atol=1e-3       )
					print("Looks ok!"       )

					if pytorch_dump_folder_path is not None:
										print(f'''Saving model and processor to {pytorch_dump_folder_path}'''       )
										model.save_pretrained(A       )
										processor.save_pretrained(A       )

					if push_to_hub:
										model.push_to_hub("nielsr/" + model_name.split("/"       )[-1] ,     commit_message="Update model"       )
										processor.push_to_hub("nielsr/" + model_name.split("/"       )[-1] ,     commit_message="Update model"       )


if __name__ == "__main__":
				_lowercase: Tuple      			=		argparse.ArgumentParser()
				# Required parameters
				parser.add_argument(
				    "--model_name",
				    default="naver-clova-ix/donut-base-finetuned-docvqa",
				    required=False,
				    type=str,
				    help="Name of the original model you'd like to convert.",
				)
				parser.add_argument(
				    "--pytorch_dump_folder_path",
				    default=None,
				    required=False,
				    type=str,
				    help="Path to the output PyTorch model directory.",
				)
				parser.add_argument(
				    "--push_to_hub",
				    action="store_true",
				    help="Whether or not to push the converted model and processor to the 🤗 hub.",
				)

				_lowercase: Optional[Any]      			=		parser.parse_args()
				convert_donut_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)
