


import gc
import unittest

import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer

from diffusers import (
    AutoencoderKL,
    DDIMScheduler,
    PNDMScheduler,
    StableDiffusionLDMaDPipeline,
    UNetaDConditionModel,
)
from diffusers.utils import nightly, slow, torch_device
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu

from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS


enable_full_determinism()






class      UpperCamelCase(	unittest.TestCase ):
					snake_case_		:					Optional[Any]    					=						StableDiffusionLDMaDPipeline
					snake_case_		:					List[str]    					=						TEXT_TO_IMAGE_PARAMS
					snake_case_		:					str    					=						TEXT_TO_IMAGE_BATCH_PARAMS
					snake_case_		:					Dict    					=						TEXT_TO_IMAGE_IMAGE_PARAMS


					def 				SCREAMING_SNAKE_CASE_	(    self						:		int    )      ->						Dict:




											'''simple docstring'''

											torch.manual_seed(0    )
											__snake_case				=		UNetaDConditionModel(
											    block_out_channels=(3_2, 6_4)  ,     layers_per_block=2  ,     sample_size=3_2  ,     in_channels=4  ,     out_channels=4  ,     down_block_types=("DownBlock2D", "CrossAttnDownBlock2D")  ,     up_block_types=("CrossAttnUpBlock2D", "UpBlock2D")  ,     cross_attention_dim=3_2  ,     )
											__snake_case				=		DDIMScheduler(
											    beta_start=0.00085  ,     beta_end=0.012  ,     beta_schedule="scaled_linear"  ,     clip_sample=SCREAMING_SNAKE_CASE  ,     set_alpha_to_one=SCREAMING_SNAKE_CASE  ,     )
											torch.manual_seed(0    )
											__snake_case				=		AutoencoderKL(
											    block_out_channels=[3_2, 6_4]  ,     in_channels=6  ,     out_channels=6  ,     down_block_types=["DownEncoderBlock2D", "DownEncoderBlock2D"]  ,     up_block_types=["UpDecoderBlock2D", "UpDecoderBlock2D"]  ,     latent_channels=4  ,     )
											torch.manual_seed(0    )
											__snake_case				=		CLIPTextConfig(
											    bos_token_id=0  ,     eos_token_id=2  ,     hidden_size=3_2  ,     intermediate_size=3_7  ,     layer_norm_eps=1e-0_5  ,     num_attention_heads=4  ,     num_hidden_layers=5  ,     pad_token_id=1  ,     vocab_size=1_0_0_0  ,     )
											__snake_case				=		CLIPTextModel(SCREAMING_SNAKE_CASE    )
											__snake_case				=		CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip"    )

											__snake_case				=		{
											    "unet": unet,
											    "scheduler": scheduler,
											    "vae": vae,
											    "text_encoder": text_encoder,
											    "tokenizer": tokenizer,
											    "safety_checker": None,
											    "feature_extractor": None,
											}
											return components


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]  ,     SCREAMING_SNAKE_CASE						:		Any  ,     SCREAMING_SNAKE_CASE						:		Any=0    )      ->						List[Any]:




											'''simple docstring'''

											if str(SCREAMING_SNAKE_CASE    ).startswith("mps"    ):
																	__snake_case				=		torch.manual_seed(SCREAMING_SNAKE_CASE    )
											else:
																	__snake_case				=		torch.Generator(device=SCREAMING_SNAKE_CASE    ).manual_seed(SCREAMING_SNAKE_CASE    )
											__snake_case				=		{
											    "prompt": "A painting of a squirrel eating a burger",
											    "generator": generator,
											    "num_inference_steps": 2,
											    "guidance_scale": 6.0,
											    "output_type": "numpy",
											}
											return inputs


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		"cpu"  # ensure determinism for the device-dependent torch.Generator

											__snake_case				=		self.get_dummy_components()
											__snake_case				=		StableDiffusionLDMaDPipeline(**SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe.to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_dummy_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth

											__snake_case				=		rgb[0, -3:, -3:, -1]
											__snake_case				=		depth[0, -3:, -1]

											assert rgb.shape == (1, 6_4, 6_4, 3)
											assert depth.shape == (1, 6_4, 6_4)

											__snake_case				=		np.array(
											    [0.37338176, 0.70247, 0.74203193, 0.51643604, 0.58256793, 0.60932136, 0.4181095, 0.48355877, 0.46535262]    )
											__snake_case				=		np.array([103.46727, 85.812004, 87.849236]    )

											assert np.abs(image_slice_rgb.flatten() - expected_slice_rgb    ).max() < 1e-2
											assert np.abs(image_slice_depth.flatten() - expected_slice_depth    ).max() < 1e-2


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]    )      ->						Optional[Any]:




											'''simple docstring'''

											__snake_case				=		self.get_dummy_components()
											__snake_case				=		StableDiffusionLDMaDPipeline(**SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe.to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_dummy_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		3 * [inputs["prompt"]]

											# forward
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth
											__snake_case				=		rgb_slice_a[0, -3:, -3:, -1]
											__snake_case				=		depth_slice_a[0, -3:, -1]

											__snake_case				=		self.get_dummy_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		3 * [inputs.pop("prompt"    )]

											__snake_case				=		ldmad_pipe.tokenizer(
											    SCREAMING_SNAKE_CASE  ,     padding="max_length"  ,     max_length=ldmad_pipe.tokenizer.model_max_length  ,     truncation=SCREAMING_SNAKE_CASE  ,     return_tensors="pt"  ,     )
											__snake_case				=		text_inputs["input_ids"].to(SCREAMING_SNAKE_CASE    )

											__snake_case				=		ldmad_pipe.text_encoder(SCREAMING_SNAKE_CASE    )[0]

											__snake_case				=		prompt_embeds

											# forward
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth
											__snake_case				=		rgb_slice_a[0, -3:, -3:, -1]
											__snake_case				=		depth_slice_a[0, -3:, -1]

											assert np.abs(rgb_slice_a.flatten() - rgb_slice_a.flatten()    ).max() < 1e-4
											assert np.abs(depth_slice_a.flatten() - depth_slice_a.flatten()    ).max() < 1e-4






					def 				SCREAMING_SNAKE_CASE_	(    self						:		Union[str, Any]    )      ->						Optional[Any]:




											'''simple docstring'''

											__snake_case				=		"cpu"  # ensure determinism for the device-dependent torch.Generator
											__snake_case				=		self.get_dummy_components()
											__snake_case				=		PNDMScheduler(skip_prk_steps=SCREAMING_SNAKE_CASE    )
											__snake_case				=		StableDiffusionLDMaDPipeline(**SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe.to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_dummy_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		"french fries"
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE  ,     negative_prompt=SCREAMING_SNAKE_CASE    )

											__snake_case		,       __snake_case				=		output.rgb, output.depth
											__snake_case				=		rgb[0, -3:, -3:, -1]
											__snake_case				=		depth[0, -3:, -1]

											assert rgb.shape == (1, 6_4, 6_4, 3)
											assert depth.shape == (1, 6_4, 6_4)

											__snake_case				=		np.array(
											    [0.37044, 0.71811503, 0.7223251, 0.48603675, 0.5638391, 0.6364948, 0.42833704, 0.4901315, 0.47926217]    )
											__snake_case				=		np.array([107.84738, 84.62802, 89.962135]    )
											assert np.abs(rgb_slice.flatten() - expected_slice_rgb    ).max() < 1e-2
											assert np.abs(depth_slice.flatten() - expected_slice_depth    ).max() < 1e-2






@slow
@require_torch_gpu
class      UpperCamelCase(	unittest.TestCase ):


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]    )      ->						Union[str, Any]:




											'''simple docstring'''

											super().tearDown()
											gc.collect()
											torch.cuda.empty_cache()


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]  ,     SCREAMING_SNAKE_CASE						:		int  ,     SCREAMING_SNAKE_CASE						:		Optional[int]="cpu"  ,     SCREAMING_SNAKE_CASE						:		Optional[Any]=torch.floataa  ,     SCREAMING_SNAKE_CASE						:		str=0    )      ->						Dict:




											'''simple docstring'''

											__snake_case				=		torch.Generator(device=SCREAMING_SNAKE_CASE    ).manual_seed(SCREAMING_SNAKE_CASE    )
											__snake_case				=		np.random.RandomState(SCREAMING_SNAKE_CASE    ).standard_normal((1, 4, 6_4, 6_4)    )
											__snake_case				=		torch.from_numpy(SCREAMING_SNAKE_CASE    ).to(device=SCREAMING_SNAKE_CASE  ,     dtype=SCREAMING_SNAKE_CASE    )
											__snake_case				=		{
											    "prompt": "a photograph of an astronaut riding a horse",
											    "latents": latents,
											    "generator": generator,
											    "num_inference_steps": 3,
											    "guidance_scale": 7.5,
											    "output_type": "numpy",
											}
											return inputs






					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[int]    )      ->						Dict:




											'''simple docstring'''

											__snake_case				=		StableDiffusionLDMaDPipeline.from_pretrained("Intel/ldm3d"    )
											__snake_case				=		ldmad_pipe.to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth
											__snake_case				=		rgb[0, -3:, -3:, -1].flatten()
											__snake_case				=		rgb[0, -3:, -1].flatten()

											assert rgb.shape == (1, 5_1_2, 5_1_2, 3)
											assert depth.shape == (1, 5_1_2, 5_1_2)

											__snake_case				=		np.array(
											    [0.53805465, 0.56707305, 0.5486515, 0.57012236, 0.5814511, 0.56253487, 0.54843014, 0.55092263, 0.6459706]    )
											__snake_case				=		np.array(
											    [0.9263781, 0.6678672, 0.5486515, 0.92202145, 0.67831135, 0.56253487, 0.9241694, 0.7551478, 0.6459706]    )
											assert np.abs(rgb_slice - expected_slice_rgb    ).max() < 3e-3
											assert np.abs(depth_slice - expected_slice_depth    ).max() < 3e-3






@nightly
@require_torch_gpu
class      UpperCamelCase(	unittest.TestCase ):


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Any    )      ->						Tuple:




											'''simple docstring'''

											super().tearDown()
											gc.collect()
											torch.cuda.empty_cache()


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Dict  ,     SCREAMING_SNAKE_CASE						:		Optional[Any]  ,     SCREAMING_SNAKE_CASE						:		Any="cpu"  ,     SCREAMING_SNAKE_CASE						:		Optional[int]=torch.floataa  ,     SCREAMING_SNAKE_CASE						:		Any=0    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		torch.Generator(device=SCREAMING_SNAKE_CASE    ).manual_seed(SCREAMING_SNAKE_CASE    )
											__snake_case				=		np.random.RandomState(SCREAMING_SNAKE_CASE    ).standard_normal((1, 4, 6_4, 6_4)    )
											__snake_case				=		torch.from_numpy(SCREAMING_SNAKE_CASE    ).to(device=SCREAMING_SNAKE_CASE  ,     dtype=SCREAMING_SNAKE_CASE    )
											__snake_case				=		{
											    "prompt": "a photograph of an astronaut riding a horse",
											    "latents": latents,
											    "generator": generator,
											    "num_inference_steps": 5_0,
											    "guidance_scale": 7.5,
											    "output_type": "numpy",
											}
											return inputs


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Tuple    )      ->						List[Any]:




											'''simple docstring'''

											__snake_case				=		StableDiffusionLDMaDPipeline.from_pretrained("Intel/ldm3d"    ).to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth

											__snake_case				=		0.495586
											__snake_case				=		0.33795515
											__snake_case				=		112.48518
											__snake_case				=		98.489746
											assert np.abs(expected_rgb_mean - rgb.mean()    ) < 1e-3
											assert np.abs(expected_rgb_std - rgb.std()    ) < 1e-3
											assert np.abs(expected_depth_mean - depth.mean()    ) < 1e-3
											assert np.abs(expected_depth_std - depth.std()    ) < 1e-3






					def 				SCREAMING_SNAKE_CASE_	(    self						:		List[str]    )      ->						Any:




											'''simple docstring'''

											__snake_case				=		StableDiffusionLDMaDPipeline.from_pretrained("Intel/ldm3d-4c"    ).to(SCREAMING_SNAKE_CASE    )
											ldmad_pipe.set_progress_bar_config(disable=SCREAMING_SNAKE_CASE    )

											__snake_case				=		self.get_inputs(SCREAMING_SNAKE_CASE    )
											__snake_case				=		ldmad_pipe(**SCREAMING_SNAKE_CASE    )
											__snake_case		,       __snake_case				=		output.rgb, output.depth

											__snake_case				=		0.4194127
											__snake_case				=		0.35375586
											__snake_case				=		0.5638502
											__snake_case				=		0.34686103

											assert rgb.shape == (1, 5_1_2, 5_1_2, 3)
											assert depth.shape == (1, 5_1_2, 5_1_2, 1)
											assert np.abs(expected_rgb_mean - rgb.mean()    ) < 1e-3
											assert np.abs(expected_rgb_std - rgb.std()    ) < 1e-3
											assert np.abs(expected_depth_mean - depth.mean()    ) < 1e-3
											assert np.abs(expected_depth_std - depth.std()    ) < 1e-3









import argparse
import json
from dataclasses import dataclass, field
from functools import partial
from pathlib import Path
from typing import List

import timm
import torch
import torch.nn as nn
from huggingface_hub import hf_hub_download
from torch import Tensor

from transformers import AutoImageProcessor, ResNetConfig, ResNetForImageClassification
from transformers.utils import logging


logging.set_verbosity_info()
A				:       int      =  logging.get_logger()






@dataclass
class      UpperCamelCase:
					snake_case_		:					nn.Module
					snake_case_		:					List[nn.Module]    					=						field(default_factory=_a )
					snake_case_		:					list    					=						field(default_factory=_a )


					def 				SCREAMING_SNAKE_CASE_	(    self						:		Optional[Any]  ,     SCREAMING_SNAKE_CASE						:		str  ,     SCREAMING_SNAKE_CASE						:		Tensor  ,     SCREAMING_SNAKE_CASE						:		Tensor    )      ->						Tuple:




											'''simple docstring'''

											__snake_case				=		len(list(m.modules()    )    ) == 1 or isinstance(SCREAMING_SNAKE_CASE  ,     nn.Convad    ) or isinstance(SCREAMING_SNAKE_CASE  ,     nn.BatchNormad    )
											if has_not_submodules:
																	self.traced.append(SCREAMING_SNAKE_CASE    )


					def __call__(    self						:		int  ,     SCREAMING_SNAKE_CASE						:		Tensor    )      ->						List[str]:




											'''simple docstring'''

											for m in self.module.modules():
																	self.handles.append(m.register_forward_hook(self._forward_hook    )    )
											self.module(SCREAMING_SNAKE_CASE    )
											[x.remove() for x in self.handles]
											return self






					@property
					def 				SCREAMING_SNAKE_CASE_	(    self						:		Any    )      ->						Dict:




											'''simple docstring'''

											return list(filter(lambda SCREAMING_SNAKE_CASE    : len(list(x.state_dict().keys()    )    ) > 0  ,     self.traced    )    )






@dataclass
class      UpperCamelCase:
					snake_case_		:					nn.Module
					snake_case_		:					nn.Module
					snake_case_		:					int    					=						0
					snake_case_		:					List    					=						field(default_factory=_a )
					snake_case_		:					List    					=						field(default_factory=_a )


					def __call__(    self						:		List[Any]  ,     SCREAMING_SNAKE_CASE						:		Tensor    )      ->						Dict:




											'''simple docstring'''

											__snake_case				=		Tracker(self.dest    )(SCREAMING_SNAKE_CASE    ).parametrized
											__snake_case				=		Tracker(self.src    )(SCREAMING_SNAKE_CASE    ).parametrized

											__snake_case				=		list(filter(lambda SCREAMING_SNAKE_CASE    : type(SCREAMING_SNAKE_CASE    ) not in self.src_skip  ,     SCREAMING_SNAKE_CASE    )    )
											__snake_case				=		list(filter(lambda SCREAMING_SNAKE_CASE    : type(SCREAMING_SNAKE_CASE    ) not in self.dest_skip  ,     SCREAMING_SNAKE_CASE    )    )

											if len(SCREAMING_SNAKE_CASE    ) != len(SCREAMING_SNAKE_CASE    ):
																	raise Exception(
																	    f'''Numbers of operations are different. Source module has {len(SCREAMING_SNAKE_CASE    )} operations while'''
																	    f''' destination module has {len(SCREAMING_SNAKE_CASE    )}.'''    )

											for dest_m, src_m in zip(SCREAMING_SNAKE_CASE  ,     SCREAMING_SNAKE_CASE    ):
																	dest_m.load_state_dict(src_m.state_dict()    )
																	if self.verbose == 1:
																							print(f'''Transfered from={src_m} to={dest_m}'''    )





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase = True			)    ->						Dict:


						'''simple docstring'''






						print(F'''Converting {name}...'''			)
						with torch.no_grad():
												__snake_case				=		timm.create_model(_lowerCAmelCase   ,						pretrained=_lowerCAmelCase			).eval()
												__snake_case				=		ResNetForImageClassification(_lowerCAmelCase			).eval()
												__snake_case				=		ModuleTransfer(src=_lowerCAmelCase   ,						dest=_lowerCAmelCase			)
												__snake_case				=		torch.randn((1, 3, 224, 224)			)
												module_transfer(_lowerCAmelCase			)

						assert torch.allclose(from_model(_lowerCAmelCase			)   ,						our_model(_lowerCAmelCase			).logits			), "The model logits don't match the original one."

						__snake_case				=		F'''resnet{'-'.join(name.split('resnet'			)			)}'''
						print(_lowerCAmelCase			)

						if push_to_hub:
												our_model.push_to_hub(
												    repo_path_or_name=save_directory / checkpoint_name   ,						commit_message="Add model"   ,						use_temp_dir=_lowerCAmelCase   ,						)

												# we can use the convnext one
												__snake_case				=		AutoImageProcessor.from_pretrained("facebook/convnext-base-224-22k-1k"			)
												image_processor.push_to_hub(
												    repo_path_or_name=save_directory / checkpoint_name   ,						commit_message="Add image processor"   ,						use_temp_dir=_lowerCAmelCase   ,						)

												print(F'''Pushed {checkpoint_name}'''			)





def 						_lowerCAmelCase							(     _lowerCAmelCase   ,						_lowerCAmelCase = None   ,						_lowerCAmelCase = True			)    ->						Dict:


						'''simple docstring'''






						__snake_case				=		"imagenet-1k-id2label.json"
						__snake_case				=		1000
						__snake_case				=		(1, num_labels)

						__snake_case				=		"huggingface/label-files"
						__snake_case				=		num_labels
						__snake_case				=		json.load(open(hf_hub_download(_lowerCAmelCase   ,						_lowerCAmelCase   ,						repo_type="dataset"			)   ,						"r"			)			)
						__snake_case				=		{int(_lowerCAmelCase			): v for k, v in idalabel.items()}

						__snake_case				=		idalabel
						__snake_case				=		{v: k for k, v in idalabel.items()}

						__snake_case				=		partial(_lowerCAmelCase   ,						num_labels=_lowerCAmelCase   ,						idalabel=_lowerCAmelCase   ,						labelaid=_lowerCAmelCase			)

						__snake_case				=		{
						    "resnet18": ImageNetPreTrainedConfig(
						        depths=[2, 2, 2, 2]   ,						hidden_sizes=[64, 128, 256, 512]   ,						layer_type="basic"			),
						    "resnet26": ImageNetPreTrainedConfig(
						        depths=[2, 2, 2, 2]   ,						hidden_sizes=[256, 512, 1024, 2048]   ,						layer_type="bottleneck"			),
						    "resnet34": ImageNetPreTrainedConfig(
						        depths=[3, 4, 6, 3]   ,						hidden_sizes=[64, 128, 256, 512]   ,						layer_type="basic"			),
						    "resnet50": ImageNetPreTrainedConfig(
						        depths=[3, 4, 6, 3]   ,						hidden_sizes=[256, 512, 1024, 2048]   ,						layer_type="bottleneck"			),
						    "resnet101": ImageNetPreTrainedConfig(
						        depths=[3, 4, 23, 3]   ,						hidden_sizes=[256, 512, 1024, 2048]   ,						layer_type="bottleneck"			),
						    "resnet152": ImageNetPreTrainedConfig(
						        depths=[3, 8, 36, 3]   ,						hidden_sizes=[256, 512, 1024, 2048]   ,						layer_type="bottleneck"			),
						}

						if model_name:
												convert_weight_and_push(_lowerCAmelCase   ,						names_to_config[model_name]   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
						else:
												for model_name, config in names_to_config.items():
																		convert_weight_and_push(_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase   ,						_lowerCAmelCase			)
						return config, expected_shape


if __name__ == "__main__":
	A				:       Optional[Any]      =  argparse.ArgumentParser()
	# Required parameters
	parser.add_argument(
	    '--model_name',
	    default=None,
	    type=str,
	    help=(
	        'The name of the model you wish to convert, it must be one of the supported resnet* architecture,'
	        ' currently: resnet18,26,34,50,101,152. If `None`, all of them will the converted.'
	    ),
	)
	parser.add_argument(
	    '--pytorch_dump_folder_path',
	    default=None,
	    type=Path,
	    required=True,
	    help='Path to the output PyTorch model directory.',
	)
	parser.add_argument(
	    '--push_to_hub',
	    default=True,
	    type=bool,
	    required=False,
	    help='If True, push model and image processor to the hub.',
	)

	A				:       Union[str, Any]      =  parser.parse_args()
	A				:       Path      =  args.pytorch_dump_folder_path
	pytorch_dump_folder_path.mkdir(exist_ok=True, parents=True)
	convert_weights_and_push(pytorch_dump_folder_path, args.model_name, args.push_to_hub)





