'''simple docstring'''

import os
import zipfile

import pytest

from datasets.utils.extract import (
    BzipaExtractor,
    Extractor,
    GzipExtractor,
    LzaExtractor,
    SevenZipExtractor,
    TarExtractor,
    XzExtractor,
    ZipExtractor,
    ZstdExtractor,
)

from .utils import require_lza, require_pyazr, require_zstandard
@pytest.mark.parametrize(
    '''compression_format, is_archive'''		,     [
        ('''7z''', True),
        ('''bz2''', False),
        ('''gzip''', False),
        ('''lz4''', False),
        ('''tar''', True),
        ('''xz''', False),
        ('''zip''', True),
        ('''zstd''', False),
    ]		,     )
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     ):
 lowercase__				:    Any  =					{
     """7z""": (seven_zip_file, SevenZipExtractor),
     """bz2""": (bza_file, BzipaExtractor),
     """gzip""": (gz_file, GzipExtractor),
     """lz4""": (lza_file, LzaExtractor),
     """tar""": (tar_file, TarExtractor),
     """xz""": (xz_file, XzExtractor),
     """zip""": (zip_file, ZipExtractor),
     """zstd""": (zstd_file, ZstdExtractor),
 }
 lowercase__				:    Any  =					input_paths_and_base_extractors[compression_format]
 if input_path is None:
  lowercase__				:    List[str]  =					F"""for \'{compression_format}\' compression_format, """
  if compression_format == "7z":
   reason += require_pyazr.kwargs["reason"]
  elif compression_format == "lz4":
   reason += require_lza.kwargs["reason"]
  elif compression_format == "zstd":
   reason += require_zstandard.kwargs["reason"]
  pytest.skip(lowerCamelCase__     )
 assert base_extractor.is_extractable(lowerCamelCase__     )
 lowercase__				:    Optional[int]  =					tmp_path / ("""extracted""" if is_archive else """extracted.txt""")
 base_extractor.extract(lowerCamelCase__		,     lowerCamelCase__     )
 if is_archive:
  assert output_path.is_dir()
  for file_path in output_path.iterdir():
   assert file_path.name == text_file.name
   lowercase__				:    List[str]  =					file_path.read_text(encoding='''utf-8'''     )
 else:
  lowercase__				:    Optional[int]  =					output_path.read_text(encoding='''utf-8'''     )
 lowercase__				:    int  =					text_file.read_text(encoding='''utf-8'''     )
 assert extracted_file_content == expected_file_content
@pytest.mark.parametrize(
    '''compression_format, is_archive'''		,     [
        ('''7z''', True),
        ('''bz2''', False),
        ('''gzip''', False),
        ('''lz4''', False),
        ('''tar''', True),
        ('''xz''', False),
        ('''zip''', True),
        ('''zstd''', False),
    ]		,     )
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     ):
 lowercase__				:    Any  =					{
     """7z""": seven_zip_file,
     """bz2""": bza_file,
     """gzip""": gz_file,
     """lz4""": lza_file,
     """tar""": tar_file,
     """xz""": xz_file,
     """zip""": zip_file,
     """zstd""": zstd_file,
 }
 lowercase__				:    List[Any]  =					input_paths[compression_format]
 if input_path is None:
  lowercase__				:    Dict  =					F"""for \'{compression_format}\' compression_format, """
  if compression_format == "7z":
   reason += require_pyazr.kwargs["reason"]
  elif compression_format == "lz4":
   reason += require_lza.kwargs["reason"]
  elif compression_format == "zstd":
   reason += require_zstandard.kwargs["reason"]
  pytest.skip(lowerCamelCase__     )
 lowercase__				:    Optional[Any]  =					Extractor.infer_extractor_format(lowerCamelCase__     )
 assert extractor_format is not None
 lowercase__				:    Tuple  =					tmp_path / ("""extracted""" if is_archive else """extracted.txt""")
 Extractor.extract(lowerCamelCase__		,     lowerCamelCase__		,     lowerCamelCase__     )
 if is_archive:
  assert output_path.is_dir()
  for file_path in output_path.iterdir():
   assert file_path.name == text_file.name
   lowercase__				:    Tuple  =					file_path.read_text(encoding='''utf-8'''     )
 else:
  lowercase__				:    int  =					output_path.read_text(encoding='''utf-8'''     )
 lowercase__				:    Union[str, Any]  =					text_file.read_text(encoding='''utf-8'''     )
 assert extracted_file_content == expected_file_content
@pytest.fixture
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase     ):
 import tarfile

 lowercase__				:    str  =					tmp_path / """data_dot_dot"""
 directory.mkdir()
 lowercase__				:    Any  =					directory / """tar_file_with_dot_dot.tar"""
 with tarfile.TarFile(lowerCamelCase__		,     '''w'''     ) as f:
  f.add(lowerCamelCase__		,     arcname=os.path.join('''..'''		,     text_file.name     )     )
 return path
@pytest.fixture
def 			__UpperCamelCase       (   UpperCAmelCase     ):
 import tarfile

 lowercase__				:    Any  =					tmp_path / """data_sym_link"""
 directory.mkdir()
 lowercase__				:    Union[str, Any]  =					directory / """tar_file_with_sym_link.tar"""
 os.symlink('''..'''		,     directory / '''subdir'''		,     target_is_directory=lowerCamelCase__     )
 with tarfile.TarFile(lowerCamelCase__		,     '''w'''     ) as f:
  f.add(str(directory / '''subdir'''     )		,     arcname='''subdir'''     )  # str required by os.readlink on Windows and Python < 3.8
 return path
@pytest.mark.parametrize(
    '''insecure_tar_file, error_log'''		,     [('''tar_file_with_dot_dot''', '''illegal path'''), ('''tar_file_with_sym_link''', '''Symlink''')]		,     )
def 			__UpperCamelCase       (   UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase		,     UpperCAmelCase     ):
 lowercase__				:    Tuple  =					{
     """tar_file_with_dot_dot""": tar_file_with_dot_dot,
     """tar_file_with_sym_link""": tar_file_with_sym_link,
 }
 lowercase__				:    Optional[int]  =					insecure_tar_files[insecure_tar_file]
 lowercase__				:    Optional[Any]  =					tmp_path / """extracted"""
 TarExtractor.extract(lowerCamelCase__		,     lowerCamelCase__     )
 assert caplog.text
 for record in caplog.records:
  assert record.levelname == "ERROR"
  assert error_log in record.msg





def 			__UpperCamelCase       (   UpperCAmelCase     ):
 lowercase__				:    Tuple  =					tmpdir / """not_a_zip_file"""
 # From: https://github.com/python/cpython/pull/5053
 lowercase__				:    Optional[Any]  =					(
     b"""\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00"""
     b"""\x00\x02\x08\x06\x00\x00\x00\x99\x81\xb6'\x00\x00\x00\x15I"""
     b"""DATx\x01\x01\n\x00\xf5\xff\x00PK\x05\x06\x00PK\x06\x06\x07"""
     b"""\xac\x01N\xc6|a\r\x00\x00\x00\x00IEND\xaeB`\x82"""
 )
 with not_a_zip_file.open('''wb'''     ) as f:
  f.write(lowerCamelCase__     )
 assert zipfile.is_zipfile(str(lowerCamelCase__     )     )  # is a false positive for `zipfile`
 assert not ZipExtractor.is_extractable(lowerCamelCase__     )  # but we're right






'''simple docstring'''




import argparse
import json

import gdown
import numpy as np
import torch
from huggingface_hub import hf_hub_download

from transformers import (
    VideoMAEConfig,
    VideoMAEForPreTraining,
    VideoMAEForVideoClassification,
    VideoMAEImageProcessor,
)



def 	a			( lowerCamelCase__    ):
			'''simple docstring'''





			A_	:						Optional[int]	=     VideoMAEConfig()

			set_architecture_configs(lowerCamelCase__						,      lowerCamelCase__    )

			if "finetuned" not in model_name:
						A_	:						Dict	=     False

			if "finetuned" in model_name:
						A_	:						List[Any]	=     """huggingface/label-files"""
						if "kinetics" in model_name:
									A_	:						Dict	=     4_00
									A_	:						List[str]	=     """kinetics400-id2label.json"""
						elif "ssv2" in model_name:
									A_	:						Tuple	=     1_74
									A_	:						str	=     """something-something-v2-id2label.json"""
						else:
									raise ValueError("""Model name should either contain 'kinetics' or 'ssv2' in case it's fine-tuned."""    )
						A_	:						Dict	=     json.load(open(hf_hub_download(lowerCamelCase__						,      lowerCamelCase__						,      repo_type="""dataset"""    )						,      """r"""    )    )
						A_	:						List[str]	=     {int(lowerCamelCase__    ): v for k, v in idalabel.items()}
						A_	:						Optional[Any]	=     idalabel
						A_	:						Union[str, Any]	=     {v: k for k, v in idalabel.items()}

			return config



def 	a			( lowerCamelCase__						,      lowerCamelCase__    ):
			'''simple docstring'''





			if "small" in model_name:
						A_	:						int	=     3_84
						A_	:						Union[str, Any]	=     15_36
						A_	:						List[str]	=     12
						A_	:						Optional[int]	=     16
						A_	:						Any	=     12
						A_	:						int	=     3
						A_	:						Optional[Any]	=     1_92
						A_	:						Union[str, Any]	=     7_68
			elif "large" in model_name:
						A_	:						List[Any]	=     10_24
						A_	:						Optional[Any]	=     40_96
						A_	:						Optional[Any]	=     24
						A_	:						List[str]	=     16
						A_	:						Any	=     12
						A_	:						str	=     8
						A_	:						str	=     5_12
						A_	:						int	=     20_48
			elif "huge" in model_name:
						A_	:						Optional[Any]	=     12_80
						A_	:						str	=     51_20
						A_	:						str	=     32
						A_	:						int	=     16
						A_	:						Any	=     12
						A_	:						Union[str, Any]	=     8
						A_	:						Dict	=     6_40
						A_	:						Optional[Any]	=     25_60
			elif "base" not in model_name:
						raise ValueError("""Model name should include either \"small\", \"base\", \"large\", or \"huge\""""    )



def 	a			( lowerCamelCase__    ):
			'''simple docstring'''





			if "encoder." in name:
						A_	:						List[Any]	=     name.replace("""encoder."""						,      """"""    )
			if "cls_token" in name:
						A_	:						List[str]	=     name.replace("""cls_token"""						,      """videomae.embeddings.cls_token"""    )
			if "decoder_pos_embed" in name:
						A_	:						Tuple	=     name.replace("""decoder_pos_embed"""						,      """decoder.decoder_pos_embed"""    )
			if "pos_embed" in name and "decoder" not in name:
						A_	:						int	=     name.replace("""pos_embed"""						,      """videomae.embeddings.position_embeddings"""    )
			if "patch_embed.proj" in name:
						A_	:						Optional[Any]	=     name.replace("""patch_embed.proj"""						,      """videomae.embeddings.patch_embeddings.projection"""    )
			if "patch_embed.norm" in name:
						A_	:						Dict	=     name.replace("""patch_embed.norm"""						,      """videomae.embeddings.norm"""    )
			if "decoder.blocks" in name:
						A_	:						List[str]	=     name.replace("""decoder.blocks"""						,      """decoder.decoder_layers"""    )
			if "blocks" in name:
						A_	:						List[str]	=     name.replace("""blocks"""						,      """videomae.encoder.layer"""    )
			if "attn.proj" in name:
						A_	:						str	=     name.replace("""attn.proj"""						,      """attention.output.dense"""    )
			if "attn" in name and "bias" not in name:
						A_	:						str	=     name.replace("""attn"""						,      """attention.self"""    )
			if "attn" in name:
						A_	:						Union[str, Any]	=     name.replace("""attn"""						,      """attention.attention"""    )
			if "norm1" in name:
						A_	:						Any	=     name.replace("""norm1"""						,      """layernorm_before"""    )
			if "norm2" in name:
						A_	:						List[str]	=     name.replace("""norm2"""						,      """layernorm_after"""    )
			if "mlp.fc1" in name:
						A_	:						Dict	=     name.replace("""mlp.fc1"""						,      """intermediate.dense"""    )
			if "mlp.fc2" in name:
						A_	:						List[str]	=     name.replace("""mlp.fc2"""						,      """output.dense"""    )
			if "decoder_embed" in name:
						A_	:						Optional[Any]	=     name.replace("""decoder_embed"""						,      """decoder.decoder_embed"""    )
			if "decoder_norm" in name:
						A_	:						Tuple	=     name.replace("""decoder_norm"""						,      """decoder.decoder_norm"""    )
			if "decoder_pred" in name:
						A_	:						Tuple	=     name.replace("""decoder_pred"""						,      """decoder.decoder_pred"""    )
			if "norm.weight" in name and "decoder" not in name and "fc" not in name:
						A_	:						Dict	=     name.replace("""norm.weight"""						,      """videomae.layernorm.weight"""    )
			if "norm.bias" in name and "decoder" not in name and "fc" not in name:
						A_	:						List[str]	=     name.replace("""norm.bias"""						,      """videomae.layernorm.bias"""    )
			if "head" in name and "decoder" not in name:
						A_	:						Optional[Any]	=     name.replace("""head"""						,      """classifier"""    )

			return name



def 	a			( lowerCamelCase__						,      lowerCamelCase__    ):
			'''simple docstring'''





			for key in orig_state_dict.copy().keys():
						A_	:						str	=     orig_state_dict.pop(lowerCamelCase__    )

						if key.startswith("""encoder."""    ):
									A_	:						Tuple	=     key.replace("""encoder."""						,      """"""    )

						if "qkv" in key:
									A_	:						Optional[int]	=     key.split("""."""    )
									if key.startswith("""decoder.blocks"""    ):
												A_	:						Union[str, Any]	=     config.decoder_hidden_size
												A_	:						Any	=     int(key_split[2]    )
												A_	:						int	=     """decoder.decoder_layers."""
												if "weight" in key:
															A_	:						Optional[Any]	=     val[:dim, :]
															A_	:						Any	=     val[dim : dim * 2, :]
															A_	:						Dict	=     val[-dim:, :]
									else:
												A_	:						List[Any]	=     config.hidden_size
												A_	:						List[Any]	=     int(key_split[1]    )
												A_	:						int	=     """videomae.encoder.layer."""
												if "weight" in key:
															A_	:						Any	=     val[:dim, :]
															A_	:						Union[str, Any]	=     val[dim : dim * 2, :]
															A_	:						List[str]	=     val[-dim:, :]
						else:
									A_	:						Union[str, Any]	=     val

			return orig_state_dict



def 	a			( ):
			'''simple docstring'''





			A_	:						List[Any]	=     hf_hub_download(
			    repo_id="""hf-internal-testing/spaghetti-video"""						,      filename="""eating_spaghetti.npy"""						,      repo_type="""dataset"""    )
			A_	:						Optional[Any]	=     np.load(lowerCamelCase__    )
			return list(lowerCamelCase__    )



def 	a			( lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__						,      lowerCamelCase__    ):
			'''simple docstring'''





			A_	:						Any	=     get_videomae_config(lowerCamelCase__    )

			if "finetuned" in model_name:
						A_	:						List[str]	=     VideoMAEForVideoClassification(lowerCamelCase__    )
			else:
						A_	:						Optional[Any]	=     VideoMAEForPreTraining(lowerCamelCase__    )

			# download original checkpoint, hosted on Google Drive
			A_	:						Optional[Any]	=     """pytorch_model.bin"""
			gdown.cached_download(lowerCamelCase__						,      lowerCamelCase__						,      quiet=lowerCamelCase__    )
			A_	:						Any	=     torch.load(lowerCamelCase__						,      map_location="""cpu"""    )
			if "model" in files:
						A_	:						Any	=     files["""model"""]
			else:
						A_	:						Dict	=     files["""module"""]
			A_	:						Any	=     convert_state_dict(lowerCamelCase__						,      lowerCamelCase__    )

			model.load_state_dict(lowerCamelCase__    )
			model.eval()

			# verify model on basic input
			A_	:						int	=     VideoMAEImageProcessor(image_mean=[0.5, 0.5, 0.5]						,      image_std=[0.5, 0.5, 0.5]    )
			A_	:						Union[str, Any]	=     prepare_video()
			A_	:						str	=     image_processor(lowerCamelCase__						,      return_tensors="""pt"""    )

			if "finetuned" not in model_name:
						A_	:						List[str]	=     hf_hub_download(repo_id="""hf-internal-testing/bool-masked-pos"""						,      filename="""bool_masked_pos.pt"""    )
						A_	:						Optional[Any]	=     torch.load(lowerCamelCase__    )

			A_	:						Dict	=     model(**lowerCamelCase__    )
			A_	:						List[Any]	=     outputs.logits

			A_	:						Any	=     [
			    """videomae-small-finetuned-kinetics""",
			    """videomae-small-finetuned-ssv2""",
			    # Kinetics-400 checkpoints (short = pretrained only for 800 epochs instead of 1600)
			    """videomae-base-short""",
			    """videomae-base-short-finetuned-kinetics""",
			    """videomae-base""",
			    """videomae-base-finetuned-kinetics""",
			    """videomae-large""",
			    """videomae-large-finetuned-kinetics""",
			    """videomae-huge-finetuned-kinetics""",
			    # Something-Something-v2 checkpoints (short = pretrained only for 800 epochs instead of 2400)
			    """videomae-base-short-ssv2""",
			    """videomae-base-short-finetuned-ssv2""",
			    """videomae-base-ssv2""",
			    """videomae-base-finetuned-ssv2""",
			]

			# NOTE: logits were tested with image_mean and image_std equal to [0.5, 0.5, 0.5] and [0.5, 0.5, 0.5]
			if model_name == "videomae-small-finetuned-kinetics":
						A_	:						str	=     torch.Size([1, 4_00]    )
						A_	:						Optional[Any]	=     torch.tensor([-0.9_291, -0.4_061, -0.9_307]    )
			elif model_name == "videomae-small-finetuned-ssv2":
						A_	:						str	=     torch.Size([1, 1_74]    )
						A_	:						Union[str, Any]	=     torch.tensor([0.2_671, -0.4_689, -0.8_235]    )
			elif model_name == "videomae-base":
						A_	:						Tuple	=     torch.Size([1, 14_08, 15_36]    )
						A_	:						List[str]	=     torch.tensor([[0.7_739, 0.7_968, 0.7_089], [0.6_701, 0.7_487, 0.6_209], [0.4_287, 0.5_158, 0.4_773]]    )
			elif model_name == "videomae-base-short":
						A_	:						Dict	=     torch.Size([1, 14_08, 15_36]    )
						A_	:						List[str]	=     torch.tensor([[0.7_994, 0.9_612, 0.8_508], [0.7_401, 0.8_958, 0.8_302], [0.5_862, 0.7_468, 0.7_325]]    )
						# we verified the loss both for normalized and unnormalized targets for this one
						A_	:						List[Any]	=     torch.tensor([0.5_142]    ) if config.norm_pix_loss else torch.tensor([0.6_469]    )
			elif model_name == "videomae-large":
						A_	:						str	=     torch.Size([1, 14_08, 15_36]    )
						A_	:						Dict	=     torch.tensor([[0.7_149, 0.7_997, 0.6_966], [0.6_768, 0.7_869, 0.6_948], [0.5_139, 0.6_221, 0.5_605]]    )
			elif model_name == "videomae-large-finetuned-kinetics":
						A_	:						int	=     torch.Size([1, 4_00]    )
						A_	:						Optional[Any]	=     torch.tensor([0.0_771, 0.0_011, -0.3_625]    )
			elif model_name == "videomae-huge-finetuned-kinetics":
						A_	:						Union[str, Any]	=     torch.Size([1, 4_00]    )
						A_	:						Optional[int]	=     torch.tensor([0.2_433, 0.1_632, -0.4_894]    )
			elif model_name == "videomae-base-short-finetuned-kinetics":
						A_	:						List[Any]	=     torch.Size([1, 4_00]    )
						A_	:						Optional[Any]	=     torch.tensor([0.6_588, 0.0_990, -0.2_493]    )
			elif model_name == "videomae-base-finetuned-kinetics":
						A_	:						Union[str, Any]	=     torch.Size([1, 4_00]    )
						A_	:						Tuple	=     torch.tensor([0.3_669, -0.0_688, -0.2_421]    )
			elif model_name == "videomae-base-short-ssv2":
						A_	:						Optional[Any]	=     torch.Size([1, 14_08, 15_36]    )
						A_	:						List[Any]	=     torch.tensor([[0.4_712, 0.5_296, 0.5_786], [0.2_278, 0.2_729, 0.4_026], [0.0_352, 0.0_730, 0.2_506]]    )
			elif model_name == "videomae-base-short-finetuned-ssv2":
						A_	:						Any	=     torch.Size([1, 1_74]    )
						A_	:						Any	=     torch.tensor([-0.0_537, -0.1_539, -0.3_266]    )
			elif model_name == "videomae-base-ssv2":
						A_	:						Dict	=     torch.Size([1, 14_08, 15_36]    )
						A_	:						Dict	=     torch.tensor([[0.8_131, 0.8_727, 0.8_546], [0.7_366, 0.9_377, 0.8_870], [0.5_935, 0.8_874, 0.8_564]]    )
			elif model_name == "videomae-base-finetuned-ssv2":
						A_	:						Any	=     torch.Size([1, 1_74]    )
						A_	:						str	=     torch.tensor([0.1_961, -0.8_337, -0.6_389]    )
			else:
						raise ValueError(f'Model name not supported. Should be one of {model_names}'    )

			# verify logits
			assert logits.shape == expected_shape
			if "finetuned" in model_name:
						assert torch.allclose(logits[0, :3]						,      lowerCamelCase__						,      atol=1E-4    )
			else:
						print("""Logits:"""						,      logits[0, :3, :3]    )
						assert torch.allclose(logits[0, :3, :3]						,      lowerCamelCase__						,      atol=1E-4    )
			print("""Logits ok!"""    )

			# verify loss, if applicable
			if model_name == "videomae-base-short":
						A_	:						Optional[int]	=     outputs.loss
						assert torch.allclose(lowerCamelCase__						,      lowerCamelCase__						,      atol=1E-4    )
						print("""Loss ok!"""    )

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

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


if __name__ == "__main__":
						lowerCamelCase							:Tuple				    =					argparse.ArgumentParser()
						# Required parameters
						parser.add_argument(
						    '''--checkpoint_url''',
						    default='''https://drive.google.com/u/1/uc?id=1tEhLyskjb755TJ65ptsrafUG2llSwQE1&amp;export=download&amp;confirm=t&amp;uuid=aa3276eb-fb7e-482a-adec-dc7171df14c4''',
						    type=str,
						    help=(
						        '''URL of the original PyTorch checkpoint (on Google Drive) you\'d like to convert. Should be a direct'''
						        ''' download link.'''
						    ),
						)
						parser.add_argument(
						    '''--pytorch_dump_folder_path''',
						    default='''/Users/nielsrogge/Documents/VideoMAE/Test''',
						    type=str,
						    help='''Path to the output PyTorch model directory.''',
						)
						parser.add_argument('''--model_name''', default='''videomae-base''', type=str, help='''Name of the model.''')
						parser.add_argument(
						    '''--push_to_hub''', action='''store_true''', help='''Whether or not to push the converted model to the 🤗 hub.'''
						)

						lowerCamelCase							:Union[str, Any]				    =					parser.parse_args()
						convert_videomae_checkpoint(args.checkpoint_url, args.pytorch_dump_folder_path, args.model_name, args.push_to_hub)