





import math
from typing import Any, Callable, List, Optional, Tuple, Union

import numpy as np
import torch

from ...models import TaFilmDecoder
from ...schedulers import DDPMScheduler
from ...utils import is_onnx_available, logging, randn_tensor


if is_onnx_available():
		from ..onnx_utils import OnnxRuntimeModel

from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
from .continous_encoder import SpectrogramContEncoder
from .notes_encoder import SpectrogramNotesEncoder


UpperCAmelCase_  							=				logging.get_logger(__name__)  # pylint: disable=invalid-name

UpperCAmelCase_  							=				256






class 					lowercase__ (			__lowerCamelCase       ):

			'''simple docstring'''


			a		:							str     	=	['melgan']




			def __init__(					self,	__magic_name__,	__magic_name__,	__magic_name__,	__magic_name__,	__magic_name__,	)				->   str:






							"""simple docstring"""
							super().__init__()

							# From MELGAN
							UpperCamelCase__							:       Any      =   math.log(1E-5							)  # Matches MelGAN training.
							UpperCamelCase__							:       Any      =   4.0  # Largest value for most examples
							UpperCamelCase__							:       Optional[Any]      =   128

							self.register_modules(
							    notes_encoder=UpperCamelCase_,	continuous_encoder=UpperCamelCase_,	decoder=UpperCamelCase_,	scheduler=UpperCamelCase_,	melgan=UpperCamelCase_,	)




			def    UpperCamelCase__						(					self,	__magic_name__,	__magic_name__=(-1.0, 1.0),	__magic_name__=False							)				->   Optional[Any]:






							"""simple docstring"""
							UpperCamelCase__     ,UpperCamelCase__							:       str      =   output_range
							if clip:
											UpperCamelCase__							:       Optional[int]      =   torch.clip(UpperCamelCase_,	self.min_value,	self.max_value							)
							# Scale to [0, 1].
							UpperCamelCase__							:       Dict      =   (features - self.min_value) / (self.max_value - self.min_value)
							# Scale to [min_out, max_out].
							return zero_one * (max_out - min_out) + min_out




			def    UpperCamelCase__						(					self,	__magic_name__,	__magic_name__=(-1.0, 1.0),	__magic_name__=False							)				->   Optional[int]:






							"""simple docstring"""
							UpperCamelCase__     ,UpperCamelCase__							:       List[Any]      =   input_range
							UpperCamelCase__							:       Dict      =   torch.clip(UpperCamelCase_,	UpperCamelCase_,	UpperCamelCase_							) if clip else outputs
							# Scale to [0, 1].
							UpperCamelCase__							:       Tuple      =   (outputs - min_out) / (max_out - min_out)
							# Scale to [self.min_value, self.max_value].
							return zero_one * (self.max_value - self.min_value) + self.min_value




			def    UpperCamelCase__						(					self,	__magic_name__,	__magic_name__,	__magic_name__							)				->   Optional[Any]:






							"""simple docstring"""
							UpperCamelCase__							:       int      =   input_tokens > 0
							UpperCamelCase__     ,UpperCamelCase__							:       Dict      =   self.notes_encoder(
							    encoder_input_tokens=UpperCamelCase_,	encoder_inputs_mask=UpperCamelCase_							)

							UpperCamelCase__     ,UpperCamelCase__							:       Dict      =   self.continuous_encoder(
							    encoder_inputs=UpperCamelCase_,	encoder_inputs_mask=UpperCamelCase_							)

							return [(tokens_encoded, tokens_mask), (continuous_encoded, continuous_mask)]




			def    UpperCamelCase__						(					self,	__magic_name__,	__magic_name__,	__magic_name__							)				->   Dict:






							"""simple docstring"""
							UpperCamelCase__							:       Dict      =   noise_time
							if not torch.is_tensor(UpperCamelCase_							):
											UpperCamelCase__							:       Union[str, Any]      =   torch.tensor([timesteps],	dtype=torch.long,	device=input_tokens.device							)
							elif torch.is_tensor(UpperCamelCase_							) and len(timesteps.shape							) == 0:
											UpperCamelCase__							:       Dict      =   timesteps[None].to(input_tokens.device							)

							# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
							UpperCamelCase__							:       List[Any]      =   timesteps * torch.ones(input_tokens.shape[0],	dtype=timesteps.dtype,	device=timesteps.device							)

							UpperCamelCase__							:       str      =   self.decoder(
							    encodings_and_masks=UpperCamelCase_,	decoder_input_tokens=UpperCamelCase_,	decoder_noise_time=UpperCamelCase_							)
							return logits




			@torch.no_grad()
			def __call__(					self,	__magic_name__,	__magic_name__ = None,	__magic_name__ = 100,	__magic_name__ = True,	__magic_name__ = "numpy",	__magic_name__ = None,	__magic_name__ = 1,	)				->   int:






							"""simple docstring"""
							if (callback_steps is None) or (
							    callback_steps is not None and (not isinstance(UpperCamelCase_,	UpperCamelCase_							) or callback_steps <= 0)
							):
											raise ValueError(
											    f"`callback_steps` has to be a positive integer but is {callback_steps} of type"
											    f" {type(UpperCamelCase_							)}."							)

							UpperCamelCase__							:       Optional[Any]      =   np.zeros([1, TARGET_FEATURE_LENGTH, self.n_dims],	dtype=np.floataa							)
							UpperCamelCase__							:       List[str]      =   np.zeros([1, 0, self.n_dims],	np.floataa							)
							UpperCamelCase__							:       Optional[Any]      =   torch.ones((1, TARGET_FEATURE_LENGTH),	dtype=UpperCamelCase_,	device=self.device							)

							for i, encoder_input_tokens in enumerate(UpperCamelCase_							):
											if i == 0:
															UpperCamelCase__							:       int      =   torch.from_numpy(pred_mel[:1].copy()							).to(
															    device=self.device,	dtype=self.decoder.dtype							)
															# The first chunk has no previous context.
															UpperCamelCase__							:       Optional[Any]      =   torch.zeros((1, TARGET_FEATURE_LENGTH),	dtype=UpperCamelCase_,	device=self.device							)
											else:
															# The full song pipeline does not feed in a context feature, so the mask
															# will be all 0s after the feature converter. Because we know we're
															# feeding in a full context chunk from the previous prediction, set it
															# to all 1s.
															UpperCamelCase__							:       Dict      =   ones

											UpperCamelCase__							:       Any      =   self.scale_features(
											    UpperCamelCase_,	output_range=[-1.0, 1.0],	clip=UpperCamelCase_							)

											UpperCamelCase__							:       Tuple      =   self.encode(
											    input_tokens=torch.IntTensor([encoder_input_tokens]							).to(device=self.device							),	continuous_inputs=UpperCamelCase_,	continuous_mask=UpperCamelCase_,	)

											# Sample encoder_continuous_inputs shaped gaussian noise to begin loop
											UpperCamelCase__							:       Optional[int]      =   randn_tensor(
											    shape=encoder_continuous_inputs.shape,	generator=UpperCamelCase_,	device=self.device,	dtype=self.decoder.dtype,	)

											# set step values
											self.scheduler.set_timesteps(UpperCamelCase_							)

											# Denoising diffusion loop
											for j, t in enumerate(self.progress_bar(self.scheduler.timesteps							)							):
															UpperCamelCase__							:       List[str]      =   self.decode(
															    encodings_and_masks=UpperCamelCase_,	input_tokens=UpperCamelCase_,	noise_time=t / self.scheduler.config.num_train_timesteps,	)

															# Compute previous output: x_t -> x_t-1
															UpperCamelCase__							:       Any      =   self.scheduler.step(UpperCamelCase_,	UpperCamelCase_,	UpperCamelCase_,	generator=UpperCamelCase_							).prev_sample

											UpperCamelCase__							:       List[str]      =   self.scale_to_features(UpperCamelCase_,	input_range=[-1.0, 1.0]							)
											UpperCamelCase__							:       Tuple      =   mel[:1]
											UpperCamelCase__							:       List[str]      =   mel.cpu().float().numpy()

											UpperCamelCase__							:       Any      =   np.concatenate([full_pred_mel, pred_mel[:1]],	axis=1							)

											# call the callback, if provided
											if callback is not None and i % callback_steps == 0:
															callback(UpperCamelCase_,	UpperCamelCase_							)

											logger.info('''Generated segment''',	UpperCamelCase_							)

							if output_type == "numpy" and not is_onnx_available():
											raise ValueError(
											    '''Cannot return output in \'np\' format if ONNX is not available. Make sure to have ONNX installed or set \'output_type\' to \'mel\'.'''							)
							elif output_type == "numpy" and self.melgan is None:
											raise ValueError(
											    '''Cannot return output in \'np\' format if melgan component is not defined. Make sure to define `self.melgan` or set \'output_type\' to \'mel\'.'''							)

							if output_type == "numpy":
											UpperCamelCase__							:       int      =   self.melgan(input_features=full_pred_mel.astype(np.floataa							)							)
							else:
											UpperCamelCase__							:       Optional[int]      =   full_pred_mel

							if not return_dict:
											return (output,)

							return AudioPipelineOutput(audios=UpperCamelCase_							)








import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image

from transformers import (
    BertTokenizer,
    ViltConfig,
    ViltForImageAndTextRetrieval,
    ViltForImagesAndTextClassification,
    ViltForMaskedLM,
    ViltForQuestionAnswering,
    ViltImageProcessor,
    ViltProcessor,
)
from transformers.utils import logging


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




def 	lowerCAmelCase_					(						__UpperCAmelCase:    List[Any]	,     __UpperCAmelCase:    List[str]=False	,     __UpperCAmelCase:    List[Any]=False	,     __UpperCAmelCase:    int=False   )   ->			Optional[Any]:
    UpperCamelCase__							:       Union[str, Any]      =   []
    for i in range(config.num_hidden_layers   ):
        # encoder layers: output projection, 2 feedforward neural networks and 2 layernorms
        rename_keys.append((f"transformer.blocks.{i}.norm1.weight", f"vilt.encoder.layer.{i}.layernorm_before.weight")   )
        rename_keys.append((f"transformer.blocks.{i}.norm1.bias", f"vilt.encoder.layer.{i}.layernorm_before.bias")   )
        rename_keys.append(
            (f"transformer.blocks.{i}.attn.proj.weight", f"vilt.encoder.layer.{i}.attention.output.dense.weight")   )
        rename_keys.append(
            (f"transformer.blocks.{i}.attn.proj.bias", f"vilt.encoder.layer.{i}.attention.output.dense.bias")   )
        rename_keys.append((f"transformer.blocks.{i}.norm2.weight", f"vilt.encoder.layer.{i}.layernorm_after.weight")   )
        rename_keys.append((f"transformer.blocks.{i}.norm2.bias", f"vilt.encoder.layer.{i}.layernorm_after.bias")   )
        rename_keys.append(
            (f"transformer.blocks.{i}.mlp.fc1.weight", f"vilt.encoder.layer.{i}.intermediate.dense.weight")   )
        rename_keys.append((f"transformer.blocks.{i}.mlp.fc1.bias", f"vilt.encoder.layer.{i}.intermediate.dense.bias")   )
        rename_keys.append((f"transformer.blocks.{i}.mlp.fc2.weight", f"vilt.encoder.layer.{i}.output.dense.weight")   )
        rename_keys.append((f"transformer.blocks.{i}.mlp.fc2.bias", f"vilt.encoder.layer.{i}.output.dense.bias")   )

    # embeddings
    rename_keys.extend(
        [
            # text embeddings
            ('''text_embeddings.word_embeddings.weight''', '''vilt.embeddings.text_embeddings.word_embeddings.weight'''),
            (
                '''text_embeddings.position_embeddings.weight''',
                '''vilt.embeddings.text_embeddings.position_embeddings.weight''',
            ),
            ('''text_embeddings.position_ids''', '''vilt.embeddings.text_embeddings.position_ids'''),
            (
                '''text_embeddings.token_type_embeddings.weight''',
                '''vilt.embeddings.text_embeddings.token_type_embeddings.weight''',
            ),
            ('''text_embeddings.LayerNorm.weight''', '''vilt.embeddings.text_embeddings.LayerNorm.weight'''),
            ('''text_embeddings.LayerNorm.bias''', '''vilt.embeddings.text_embeddings.LayerNorm.bias'''),
            # patch embeddings
            ('''transformer.cls_token''', '''vilt.embeddings.cls_token'''),
            ('''transformer.patch_embed.proj.weight''', '''vilt.embeddings.patch_embeddings.projection.weight'''),
            ('''transformer.patch_embed.proj.bias''', '''vilt.embeddings.patch_embeddings.projection.bias'''),
            ('''transformer.pos_embed''', '''vilt.embeddings.position_embeddings'''),
            # token type embeddings
            ('''token_type_embeddings.weight''', '''vilt.embeddings.token_type_embeddings.weight'''),
        ]   )

    # final layernorm + pooler
    rename_keys.extend(
        [
            ('''transformer.norm.weight''', '''vilt.layernorm.weight'''),
            ('''transformer.norm.bias''', '''vilt.layernorm.bias'''),
            ('''pooler.dense.weight''', '''vilt.pooler.dense.weight'''),
            ('''pooler.dense.bias''', '''vilt.pooler.dense.bias'''),
        ]   )

    # classifier head(s)
    if vqa_model:
        # classification head
        rename_keys.extend(
            [
                ('''vqa_classifier.0.weight''', '''classifier.0.weight'''),
                ('''vqa_classifier.0.bias''', '''classifier.0.bias'''),
                ('''vqa_classifier.1.weight''', '''classifier.1.weight'''),
                ('''vqa_classifier.1.bias''', '''classifier.1.bias'''),
                ('''vqa_classifier.3.weight''', '''classifier.3.weight'''),
                ('''vqa_classifier.3.bias''', '''classifier.3.bias'''),
            ]   )
    elif nlvr_model:
        # classification head
        rename_keys.extend(
            [
                ('''nlvr2_classifier.0.weight''', '''classifier.0.weight'''),
                ('''nlvr2_classifier.0.bias''', '''classifier.0.bias'''),
                ('''nlvr2_classifier.1.weight''', '''classifier.1.weight'''),
                ('''nlvr2_classifier.1.bias''', '''classifier.1.bias'''),
                ('''nlvr2_classifier.3.weight''', '''classifier.3.weight'''),
                ('''nlvr2_classifier.3.bias''', '''classifier.3.bias'''),
            ]   )
    else:
        pass

    return rename_keys




def 	lowerCAmelCase_					(						__UpperCAmelCase:    List[Any]	,     __UpperCAmelCase:    List[Any]   )   ->			Optional[int]:
    for i in range(config.num_hidden_layers   ):
        UpperCamelCase__							:       Tuple      =   '''vilt.'''
        # read in weights + bias of input projection layer (in timm, this is a single matrix + bias)
        UpperCamelCase__							:       Dict      =   state_dict.pop(f"transformer.blocks.{i}.attn.qkv.weight"   )
        UpperCamelCase__							:       Tuple      =   state_dict.pop(f"transformer.blocks.{i}.attn.qkv.bias"   )
        # next, add query, keys and values (in that order) to the state dict
        UpperCamelCase__							:       Union[str, Any]      =   in_proj_weight[
            : config.hidden_size, :
        ]
        UpperCamelCase__							:       Optional[Any]      =   in_proj_bias[: config.hidden_size]
        UpperCamelCase__							:       Tuple      =   in_proj_weight[
            config.hidden_size : config.hidden_size * 2, :
        ]
        UpperCamelCase__							:       Any      =   in_proj_bias[
            config.hidden_size : config.hidden_size * 2
        ]
        UpperCamelCase__							:       List[Any]      =   in_proj_weight[
            -config.hidden_size :, :
        ]
        UpperCamelCase__							:       List[Any]      =   in_proj_bias[-config.hidden_size :]




def 	lowerCAmelCase_					(						__UpperCAmelCase:    List[Any]   )   ->			Any:
    UpperCamelCase__							:       int      =   ['''head.weight''', '''head.bias''']
    for k in ignore_keys:
        state_dict.pop(__UpperCAmelCase	,     __UpperCAmelCase   )




def 	lowerCAmelCase_					(						__UpperCAmelCase:    Any	,     __UpperCAmelCase:    Dict	,     __UpperCAmelCase:    int   )   ->			List[str]:
    UpperCamelCase__							:       str      =   dct.pop(__UpperCAmelCase   )
    UpperCamelCase__							:       Optional[int]      =   val




@torch.no_grad()
def 	lowerCAmelCase_					(						__UpperCAmelCase:    List[Any]	,     __UpperCAmelCase:    Union[str, Any]   )   ->			int:
    UpperCamelCase__							:       Any      =   ViltConfig(image_size=384	,     patch_size=32	,     tie_word_embeddings=__UpperCAmelCase   )
    UpperCamelCase__							:       Any      =   False
    UpperCamelCase__							:       Optional[int]      =   False
    UpperCamelCase__							:       List[Any]      =   False
    UpperCamelCase__							:       int      =   False
    if "vqa" in checkpoint_url:
        UpperCamelCase__							:       Any      =   True
        UpperCamelCase__							:       Optional[int]      =   3129
        UpperCamelCase__							:       Dict      =   '''huggingface/label-files'''
        UpperCamelCase__							:       Optional[Any]      =   '''vqa2-id2label.json'''
        UpperCamelCase__							:       Optional[int]      =   json.load(open(hf_hub_download(__UpperCAmelCase	,     __UpperCAmelCase	,     repo_type='''dataset'''   )	,     '''r'''   )   )
        UpperCamelCase__							:       List[str]      =   {int(__UpperCAmelCase   ): v for k, v in idalabel.items()}
        UpperCamelCase__							:       str      =   idalabel
        UpperCamelCase__							:       List[Any]      =   {v: k for k, v in idalabel.items()}
        UpperCamelCase__							:       Tuple      =   ViltForQuestionAnswering(__UpperCAmelCase   )
    elif "nlvr" in checkpoint_url:
        UpperCamelCase__							:       Optional[Any]      =   True
        UpperCamelCase__							:       Union[str, Any]      =   2
        UpperCamelCase__							:       int      =   {0: '''False''', 1: '''True'''}
        UpperCamelCase__							:       Optional[Any]      =   {v: k for k, v in config.idalabel.items()}
        UpperCamelCase__							:       Tuple      =   3
        UpperCamelCase__							:       Optional[Any]      =   ViltForImagesAndTextClassification(__UpperCAmelCase   )
    elif "irtr" in checkpoint_url:
        UpperCamelCase__							:       List[str]      =   True
        UpperCamelCase__							:       Any      =   ViltForImageAndTextRetrieval(__UpperCAmelCase   )
    elif "mlm_itm" in checkpoint_url:
        UpperCamelCase__							:       Any      =   True
        UpperCamelCase__							:       int      =   ViltForMaskedLM(__UpperCAmelCase   )
    else:
        raise ValueError('''Unknown model type'''   )

    # load state_dict of original model, remove and rename some keys
    UpperCamelCase__							:       int      =   torch.hub.load_state_dict_from_url(__UpperCAmelCase	,     map_location='''cpu'''   )['''state_dict''']
    UpperCamelCase__							:       Dict      =   create_rename_keys(__UpperCAmelCase	,     __UpperCAmelCase	,     __UpperCAmelCase	,     __UpperCAmelCase   )
    for src, dest in rename_keys:
        rename_key(__UpperCAmelCase	,     __UpperCAmelCase	,     __UpperCAmelCase   )
    read_in_q_k_v(__UpperCAmelCase	,     __UpperCAmelCase   )
    if mlm_model or irtr_model:
        UpperCamelCase__							:       str      =   ['''itm_score.fc.weight''', '''itm_score.fc.bias''']
        for k in ignore_keys:
            state_dict.pop(__UpperCAmelCase	,     __UpperCAmelCase   )

    # load state dict into HuggingFace model
    model.eval()
    if mlm_model:
        UpperCamelCase__     ,UpperCamelCase__							:       Optional[Any]      =   model.load_state_dict(__UpperCAmelCase	,     strict=__UpperCAmelCase   )
        assert missing_keys == ["mlm_score.decoder.bias"]
    else:
        model.load_state_dict(__UpperCAmelCase   )

    # Define processor
    UpperCamelCase__							:       Union[str, Any]      =   ViltImageProcessor(size=384   )
    UpperCamelCase__							:       List[str]      =   BertTokenizer.from_pretrained('''bert-base-uncased'''   )
    UpperCamelCase__							:       Optional[int]      =   ViltProcessor(__UpperCAmelCase	,     __UpperCAmelCase   )

    # Forward pass on example inputs (image + text)
    if nlvr_model:
        UpperCamelCase__							:       Optional[int]      =   Image.open(requests.get('''https://lil.nlp.cornell.edu/nlvr/exs/ex0_0.jpg'''	,     stream=__UpperCAmelCase   ).raw   )
        UpperCamelCase__							:       Union[str, Any]      =   Image.open(requests.get('''https://lil.nlp.cornell.edu/nlvr/exs/ex0_0.jpg'''	,     stream=__UpperCAmelCase   ).raw   )
        UpperCamelCase__							:       Dict      =   (
            '''The left image contains twice the number of dogs as the right image, and at least two dogs in total are'''
            ''' standing.'''
        )
        UpperCamelCase__							:       str      =   processor(__UpperCAmelCase	,     __UpperCAmelCase	,     return_tensors='''pt'''   )
        UpperCamelCase__							:       Optional[Any]      =   processor(__UpperCAmelCase	,     __UpperCAmelCase	,     return_tensors='''pt'''   )
        UpperCamelCase__							:       Union[str, Any]      =   model(
            input_ids=encoding_a.input_ids	,     pixel_values=encoding_a.pixel_values	,     pixel_values_a=encoding_a.pixel_values	,     )
    else:
        UpperCamelCase__							:       Union[str, Any]      =   Image.open(requests.get('''http://images.cocodataset.org/val2017/000000039769.jpg'''	,     stream=__UpperCAmelCase   ).raw   )
        if mlm_model:
            UpperCamelCase__							:       int      =   '''a bunch of [MASK] laying on a [MASK].'''
        else:
            UpperCamelCase__							:       Optional[Any]      =   '''How many cats are there?'''
        UpperCamelCase__							:       List[Any]      =   processor(__UpperCAmelCase	,     __UpperCAmelCase	,     return_tensors='''pt'''   )
        UpperCamelCase__							:       Union[str, Any]      =   model(**__UpperCAmelCase   )

    # Verify outputs
    if mlm_model:
        UpperCamelCase__							:       str      =   torch.Size([1, 11, 3_0522]   )
        UpperCamelCase__							:       Optional[Any]      =   torch.tensor([-12.5061, -12.5123, -12.5174]   )
        assert outputs.logits.shape == expected_shape
        assert torch.allclose(outputs.logits[0, 0, :3]	,     __UpperCAmelCase	,     atol=1e-4   )

        # verify masked token prediction equals "cats"
        UpperCamelCase__							:       Optional[Any]      =   outputs.logits[0, 4, :].argmax(-1   ).item()
        assert tokenizer.decode([predicted_id]   ) == "cats"
    elif vqa_model:
        UpperCamelCase__							:       List[Any]      =   torch.Size([1, 3129]   )
        UpperCamelCase__							:       Tuple      =   torch.tensor([-15.9495, -18.1472, -10.3041]   )
        assert torch.allclose(outputs.logits[0, :3]	,     __UpperCAmelCase	,     atol=1e-4   )
        assert outputs.logits.shape == expected_shape
        assert torch.allclose(outputs.logits[0, 0, :3]	,     __UpperCAmelCase	,     atol=1e-4   )

        # verify vqa prediction equals "2"
        UpperCamelCase__							:       Any      =   outputs.logits.argmax(-1   ).item()
        assert model.config.idalabel[predicted_idx] == "2"
    elif nlvr_model:
        UpperCamelCase__							:       Dict      =   torch.Size([1, 2]   )
        UpperCamelCase__							:       str      =   torch.tensor([-2.8721, 2.1291]   )
        assert torch.allclose(outputs.logits[0, :3]	,     __UpperCAmelCase	,     atol=1e-4   )
        assert outputs.logits.shape == expected_shape

    Path(__UpperCAmelCase   ).mkdir(exist_ok=__UpperCAmelCase   )
    print(f"Saving model and processor to {pytorch_dump_folder_path}"   )
    model.save_pretrained(__UpperCAmelCase   )
    processor.save_pretrained(__UpperCAmelCase   )


if __name__ == "__main__":
  UpperCAmelCase_  							=				argparse.ArgumentParser()
  # Required parameters
  parser.add_argument(
      '--checkpoint_url',
      default='https://github.com/dandelin/ViLT/releases/download/200k/vilt_200k_mlm_itm.ckpt',
      type=str,
      help='URL of the checkpoint you\'d like to convert.',
  )
  parser.add_argument(
      '--pytorch_dump_folder_path', default=None, type=str, help='Path to the output PyTorch model directory.'
  )

  UpperCAmelCase_  							=				parser.parse_args()
  convert_vilt_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path)

