
import argparse

import torch

from transformers import (
    SpeechTaConfig,
    SpeechTaFeatureExtractor,
    SpeechTaForSpeechToSpeech,
    SpeechTaForSpeechToText,
    SpeechTaForTextToSpeech,
    SpeechTaProcessor,
    SpeechTaTokenizer,
    logging,
)
from transformers.tokenization_utils import AddedToken


logging.set_verbosity_info()
_lowercase							   =				logging.get_logger('''transformers.models.speecht5''')

_lowercase							   =				{
    '''speech_encoder_prenet.layer_norm''': '''speecht5.encoder.prenet.feature_projection.layer_norm''',
    '''speech_encoder_prenet.post_extract_proj''': '''speecht5.encoder.prenet.feature_projection.projection''',
    '''speech_encoder_prenet.pos_conv.0''': '''speecht5.encoder.prenet.pos_conv_embed.conv''',
    '''speech_encoder_prenet.mask_emb''': '''speecht5.encoder.prenet.masked_spec_embed''',
}
_lowercase							   =				{
    '''text_encoder_prenet.encoder_prenet.0''': '''speecht5.encoder.prenet.embed_tokens''',
    '''text_encoder_prenet.encoder_prenet.1.alpha''': '''speecht5.encoder.prenet.encode_positions.alpha''',
}
_lowercase							   =				{
    '''speech_decoder_prenet.decoder_prenet.0.0.prenet.0.0''': '''speecht5.decoder.prenet.layers.0''',
    '''speech_decoder_prenet.decoder_prenet.0.0.prenet.1.0''': '''speecht5.decoder.prenet.layers.1''',
    '''speech_decoder_prenet.decoder_prenet.0.1''': '''speecht5.decoder.prenet.final_layer''',
    '''speech_decoder_prenet.decoder_prenet.1.alpha''': '''speecht5.decoder.prenet.encode_positions.alpha''',
    '''speech_decoder_prenet.spkembs_layer.0''': '''speecht5.decoder.prenet.speaker_embeds_layer''',
}
_lowercase							   =				{
    '''speech_decoder_postnet.feat_out''': '''speech_decoder_postnet.feat_out''',
    '''speech_decoder_postnet.prob_out''': '''speech_decoder_postnet.prob_out''',
    '''speech_decoder_postnet.postnet.postnet.0.0''': '''speech_decoder_postnet.layers.0.conv''',
    '''speech_decoder_postnet.postnet.postnet.0.1''': '''speech_decoder_postnet.layers.0.batch_norm''',
    '''speech_decoder_postnet.postnet.postnet.1.0''': '''speech_decoder_postnet.layers.1.conv''',
    '''speech_decoder_postnet.postnet.postnet.1.1''': '''speech_decoder_postnet.layers.1.batch_norm''',
    '''speech_decoder_postnet.postnet.postnet.2.0''': '''speech_decoder_postnet.layers.2.conv''',
    '''speech_decoder_postnet.postnet.postnet.2.1''': '''speech_decoder_postnet.layers.2.batch_norm''',
    '''speech_decoder_postnet.postnet.postnet.3.0''': '''speech_decoder_postnet.layers.3.conv''',
    '''speech_decoder_postnet.postnet.postnet.3.1''': '''speech_decoder_postnet.layers.3.batch_norm''',
    '''speech_decoder_postnet.postnet.postnet.4.0''': '''speech_decoder_postnet.layers.4.conv''',
    '''speech_decoder_postnet.postnet.postnet.4.1''': '''speech_decoder_postnet.layers.4.batch_norm''',
}
_lowercase							   =				{
    '''text_decoder_prenet.embed_tokens''': '''speecht5.decoder.prenet.embed_tokens''',
}
_lowercase							   =				{
    '''text_decoder_postnet.output_projection''': '''text_decoder_postnet.lm_head''',
}
_lowercase							   =				{
    '''encoder.layers.*.self_attn.k_proj''': '''speecht5.encoder.wrapped_encoder.layers.*.attention.k_proj''',
    '''encoder.layers.*.self_attn.v_proj''': '''speecht5.encoder.wrapped_encoder.layers.*.attention.v_proj''',
    '''encoder.layers.*.self_attn.q_proj''': '''speecht5.encoder.wrapped_encoder.layers.*.attention.q_proj''',
    '''encoder.layers.*.self_attn.out_proj''': '''speecht5.encoder.wrapped_encoder.layers.*.attention.out_proj''',
    '''encoder.layers.*.self_attn_layer_norm''': '''speecht5.encoder.wrapped_encoder.layers.*.layer_norm''',
    '''encoder.layers.*.fc1''': '''speecht5.encoder.wrapped_encoder.layers.*.feed_forward.intermediate_dense''',
    '''encoder.layers.*.fc2''': '''speecht5.encoder.wrapped_encoder.layers.*.feed_forward.output_dense''',
    '''encoder.layers.*.final_layer_norm''': '''speecht5.encoder.wrapped_encoder.layers.*.final_layer_norm''',
    '''encoder.layer_norm''': '''speecht5.encoder.wrapped_encoder.layer_norm''',
    '''encoder.pos_emb.pe_k''': '''speecht5.encoder.wrapped_encoder.embed_positions.pe_k''',
}
_lowercase							   =				{
    '''decoder.layers.*.self_attn.k_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.self_attn.k_proj''',
    '''decoder.layers.*.self_attn.v_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.self_attn.v_proj''',
    '''decoder.layers.*.self_attn.q_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.self_attn.q_proj''',
    '''decoder.layers.*.self_attn.out_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.self_attn.out_proj''',
    '''decoder.layers.*.self_attn_layer_norm''': '''speecht5.decoder.wrapped_decoder.layers.*.self_attn_layer_norm''',
    '''decoder.layers.*.encoder_attn.k_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.encoder_attn.k_proj''',
    '''decoder.layers.*.encoder_attn.v_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.encoder_attn.v_proj''',
    '''decoder.layers.*.encoder_attn.q_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.encoder_attn.q_proj''',
    '''decoder.layers.*.encoder_attn.out_proj''': '''speecht5.decoder.wrapped_decoder.layers.*.encoder_attn.out_proj''',
    '''decoder.layers.*.encoder_attn_layer_norm''': '''speecht5.decoder.wrapped_decoder.layers.*.encoder_attn_layer_norm''',
    '''decoder.layers.*.fc1''': '''speecht5.decoder.wrapped_decoder.layers.*.feed_forward.intermediate_dense''',
    '''decoder.layers.*.fc2''': '''speecht5.decoder.wrapped_decoder.layers.*.feed_forward.output_dense''',
    '''decoder.layers.*.final_layer_norm''': '''speecht5.decoder.wrapped_decoder.layers.*.final_layer_norm''',
}
_lowercase							   =				{
    **MAPPING_SPEECH_ENCODER_PRENET,
    **MAPPING_ENCODER,
    **MAPPING_DECODER,
    **MAPPING_TEXT_DECODER_PRENET,
    **MAPPING_TEXT_DECODER_POSTNET,
}
_lowercase							   =				{
    **MAPPING_TEXT_ENCODER_PRENET,
    **MAPPING_ENCODER,
    **MAPPING_DECODER,
    **MAPPING_SPEECH_DECODER_PRENET,
    **MAPPING_SPEECH_DECODER_POSTNET,
}
_lowercase							   =				{
    **MAPPING_SPEECH_ENCODER_PRENET,
    **MAPPING_ENCODER,
    **MAPPING_DECODER,
    **MAPPING_SPEECH_DECODER_PRENET,
    **MAPPING_SPEECH_DECODER_POSTNET,
}
_lowercase							   =				[]
_lowercase							   =				[
    '''encoder.version''',
    '''encoder.layers.*.norm_k.weight''',
    '''encoder.layers.*.norm_k.bias''',
    '''decoder.version''',
    '''decoder.layers.*.norm_k.weight''',
    '''decoder.layers.*.norm_k.bias''',
    '''decoder.pos_emb.pe_k''',
    '''speech_encoder_prenet.embed_positions._float_tensor''',
    '''text_decoder_prenet.embed_positions._float_tensor''',
]
_lowercase							   =				IGNORE_KEYS + [
    '''encoder.proj''',
    '''text_encoder_prenet.*''',
    '''speech_decoder_prenet.*''',
    '''speech_decoder_postnet.*''',
]
_lowercase							   =				IGNORE_KEYS + [
    '''encoder.proj''',
    '''speech_encoder_prenet.*''',
    '''text_decoder_prenet.*''',
    '''text_decoder_postnet.*''',
]
_lowercase							   =				IGNORE_KEYS + [
    '''encoder.proj''',
    '''text_encoder_prenet.*''',
    '''text_decoder_prenet.*''',
    '''text_decoder_postnet.*''',
]






def       _snake_case				(		snake_case__   :     str	,      snake_case__   :     Dict	,      snake_case__   :     Dict	,      snake_case__   :     Optional[Any]	,      snake_case__   :     Any     ):
	for attribute in key.split('.'     ):
		A						   =   getattr(snake_case__	,      snake_case__     )

	if weight_type is not None:
		A						   =   getattr(snake_case__	,      snake_case__     ).shape
	else:
		A						   =   hf_pointer.shape

	if hf_shape != value.shape:
		raise ValueError(
		    F'Shape of hf {key + "." + weight_type if weight_type is not None else ""} is {hf_shape}, but should be'
		    F' {value.shape} for {full_name}'     )

	if weight_type == "weight":
		A						   =   value
	elif weight_type == "weight_g":
		A						   =   value
	elif weight_type == "weight_v":
		A						   =   value
	elif weight_type == "bias":
		A						   =   value
	elif weight_type == "running_mean":
		A						   =   value
	elif weight_type == "running_var":
		A						   =   value
	elif weight_type == "num_batches_tracked":
		A						   =   value
	else:
		A						   =   value

	logger.info(F'{key + ("." + weight_type if weight_type is not None else "")} was initialized from {full_name}.'     )






def       _snake_case				(		snake_case__   :     int	,      snake_case__   :     str     ):
	for key in ignore_keys:
		if key.endswith('.*'     ):
			if name.startswith(key[:-1]     ):
				return True
		elif ".*." in key:
			A   ,      A						   =   key.split('.*.'     )
			if prefix in name and suffix in name:
				return True
		elif key in name:
			return True
	return False






def       _snake_case				(		snake_case__   :     Optional[int]	,      snake_case__   :     List[str]	,      snake_case__   :     Union[str, Any]     ):
	A						   =   []

	if task == "s2t":
		A						   =   hf_model.speechta.encoder.prenet.feature_encoder
		A						   =   MAPPING_S2T
		A						   =   IGNORE_KEYS_S2T
	elif task == "t2s":
		A						   =   None
		A						   =   MAPPING_T2S
		A						   =   IGNORE_KEYS_T2S
	elif task == "s2s":
		A						   =   hf_model.speechta.encoder.prenet.feature_encoder
		A						   =   MAPPING_S2S
		A						   =   IGNORE_KEYS_S2S
	else:
		raise ValueError(F'Unsupported task: {task}'     )

	for name, value in fairseq_dict.items():
		if should_ignore(snake_case__	,      snake_case__     ):
			logger.info(F'{name} was ignored'     )
			continue

		A						   =   False
		if "conv_layers" in name:
			load_conv_layer(
			    snake_case__	,      snake_case__	,      snake_case__	,      snake_case__	,      hf_model.config.feat_extract_norm == 'group'	,      )
			A						   =   True
		else:
			for key, mapped_key in MAPPING.items():
				# mapped_key = "speecht5." + mapped_key if mapped_key not in TOP_LEVEL_KEYS else mapped_key

				if "*" in key:
					A   ,      A						   =   key.split('.*.'     )
					if prefix in name and suffix in name:
						A						   =   suffix

                # if key in name or key.split("w2v_model.")[-1] == name.split(".")[0]:
				if key in name:
					A						   =   True
					if "*" in mapped_key:
						A						   =   name.split(snake_case__     )[0].split('.'     )[-2]
						A						   =   mapped_key.replace('*'	,      snake_case__     )
					if "weight_g" in name:
						A						   =   'weight_g'
					elif "weight_v" in name:
						A						   =   'weight_v'
					elif "bias" in name:
						A						   =   'bias'
					elif "weight" in name:
						A						   =   'weight'
					elif "running_mean" in name:
						A						   =   'running_mean'
					elif "running_var" in name:
						A						   =   'running_var'
					elif "num_batches_tracked" in name:
						A						   =   'num_batches_tracked'
					else:
						A						   =   None
					set_recursively(snake_case__	,      snake_case__	,      snake_case__	,      snake_case__	,      snake_case__     )
				continue
		if not is_used:
			unused_weights.append(snake_case__     )

	logger.warning(F'Unused weights: {unused_weights}'     )






def       _snake_case				(		snake_case__   :     Optional[int]	,      snake_case__   :     int	,      snake_case__   :     List[str]	,      snake_case__   :     Optional[Any]	,      snake_case__   :     int     ):
	A						   =   full_name.split('conv_layers.'     )[-1]
	A						   =   name.split('.'     )
	A						   =   int(items[0]     )
	A						   =   int(items[1]     )

	if type_id == 0:
		if "bias" in name:
			if value.shape != feature_extractor.conv_layers[layer_id].conv.bias.data.shape:
				raise ValueError(
				    F'{full_name} has size {value.shape}, but'
				    F' {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found.'     )
			A						   =   value
			logger.info(F'Feat extract conv layer {layer_id} was initialized from {full_name}.'     )
		elif "weight" in name:
			if value.shape != feature_extractor.conv_layers[layer_id].conv.weight.data.shape:
				raise ValueError(
				    F'{full_name} has size {value.shape}, but'
				    F' {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found.'     )
			A						   =   value
			logger.info(F'Feat extract conv layer {layer_id} was initialized from {full_name}.'     )
	elif (type_id == 2 and not use_group_norm) or (type_id == 2 and layer_id == 0 and use_group_norm):
		if "bias" in name:
			if value.shape != feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape:
				raise ValueError(
				    F'{full_name} has size {value.shape}, but'
				    F' {feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape} was found.'     )
			A						   =   value
			logger.info(F'Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.'     )
		elif "weight" in name:
			if value.shape != feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape:
				raise ValueError(
				    F'{full_name} has size {value.shape}, but'
				    F' {feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape} was found.'     )
			A						   =   value
			logger.info(F'Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.'     )
	else:
		unused_weights.append(snake_case__     )






@torch.no_grad()
def       _snake_case				(		snake_case__   :     Union[str, Any]	,      snake_case__   :     Union[str, Any]	,      snake_case__   :     Dict	,      snake_case__   :     int=None	,      snake_case__   :     Tuple=None	,      snake_case__   :     int=None	,      ):
	if config_path is not None:
		A						   =   SpeechTaConfig.from_pretrained(snake_case__     )
	else:
		A						   =   SpeechTaConfig()

	if task == "s2t":
		A						   =   config.max_text_positions
		A						   =   SpeechTaForSpeechToText(snake_case__     )
	elif task == "t2s":
		A						   =   1876
		A						   =   600
		A						   =   config.max_speech_positions
		A						   =   SpeechTaForTextToSpeech(snake_case__     )
	elif task == "s2s":
		A						   =   1876
		A						   =   config.max_speech_positions
		A						   =   SpeechTaForSpeechToSpeech(snake_case__     )
	else:
		raise ValueError(F'Unknown task name: {task}'     )

	if vocab_path:
		A						   =   SpeechTaTokenizer(snake_case__	,      model_max_length=config.max_text_positions     )

		# Mask token behaves like a normal word, i.e. include the space before it
		A						   =   AddedToken('<mask>'	,      lstrip=snake_case__	,      rstrip=snake_case__     )
		A						   =   mask_token
		tokenizer.add_special_tokens({'mask_token': mask_token}     )
		tokenizer.add_tokens(['<ctc_blank>']     )

	A						   =   SpeechTaFeatureExtractor()
	A						   =   SpeechTaProcessor(tokenizer=snake_case__	,      feature_extractor=snake_case__     )
	processor.save_pretrained(snake_case__     )

	A						   =   torch.load(snake_case__     )
	recursively_load_weights(fairseq_checkpoint['model']	,      snake_case__	,      snake_case__     )

	model.save_pretrained(snake_case__     )

	if repo_id:
		print('Pushing to the hub...'     )
		processor.push_to_hub(snake_case__     )
		model.push_to_hub(snake_case__     )


if __name__ == "__main__":
		_lowercase							   =				argparse.ArgumentParser()
		parser.add_argument(
		    '''--task''',
		    default='''s2t''',
		    type=str,
		    help='''Type of the SpeechT5 model you\'d like to convert. Should be one of \'s2t\', \'t2s\', \'s2s\'.''',
		)
		parser.add_argument('''--checkpoint_path''', required=True, default=None, type=str, help='''Path to fairseq checkpoint''')
		parser.add_argument('''--vocab_path''', default=None, type=str, help='''Path to SentencePiece model''')
		parser.add_argument('''--config_path''', default=None, type=str, help='''Path to hf config.json of model to convert''')
		parser.add_argument(
		    '''--pytorch_dump_folder_path''', required=True, default=None, type=str, help='''Path to the output PyTorch model.'''
		)
		parser.add_argument(
		    '''--push_to_hub''', default=None, type=str, help='''Where to upload the converted model on the 🤗 hub.'''
		)

		_lowercase							   =				parser.parse_args()
		convert_speechta_checkpoint(
		    args.task,
		    args.checkpoint_path,
		    args.pytorch_dump_folder_path,
		    args.config_path,
		    args.vocab_path,
		    args.push_to_hub,
		)

"""simple docstring"""


import argparse
import json
from pathlib import Path

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

from transformers import AutoImageProcessor, SwinvaConfig, SwinvaForImageClassification






def       _snake_case				(		snake_case__   :     int     ):
	A						   =   SwinvaConfig()
	A						   =   swinva_name.split('_'     )

	A						   =   name_split[1]
	if "to" in name_split[3]:
		A						   =   int(name_split[3][-3:]     )
	else:
		A						   =   int(name_split[3]     )
	if "to" in name_split[2]:
		A						   =   int(name_split[2][-2:]     )
	else:
		A						   =   int(name_split[2][6:]     )

	if model_size == "tiny":
		A						   =   96
		A						   =   (2, 2, 6, 2)
		A						   =   (3, 6, 12, 24)
	elif model_size == "small":
		A						   =   96
		A						   =   (2, 2, 18, 2)
		A						   =   (3, 6, 12, 24)
	elif model_size == "base":
		A						   =   128
		A						   =   (2, 2, 18, 2)
		A						   =   (4, 8, 16, 32)
	else:
		A						   =   192
		A						   =   (2, 2, 18, 2)
		A						   =   (6, 12, 24, 48)

	if "to" in swinva_name:
		A						   =   (12, 12, 12, 6)

	if ("22k" in swinva_name) and ("to" not in swinva_name):
		A						   =   2_1841
		A						   =   'huggingface/label-files'
		A						   =   'imagenet-22k-id2label.json'
		A						   =   json.load(open(hf_hub_download(snake_case__	,      snake_case__	,      repo_type='dataset'     )	,      'r'     )     )
		A						   =   {int(snake_case__     ): v for k, v in idalabel.items()}
		A						   =   idalabel
		A						   =   {v: k for k, v in idalabel.items()}

	else:
		A						   =   1000
		A						   =   'huggingface/label-files'
		A						   =   'imagenet-1k-id2label.json'
		A						   =   json.load(open(hf_hub_download(snake_case__	,      snake_case__	,      repo_type='dataset'     )	,      'r'     )     )
		A						   =   {int(snake_case__     ): v for k, v in idalabel.items()}
		A						   =   idalabel
		A						   =   {v: k for k, v in idalabel.items()}

	A						   =   img_size
	A						   =   num_classes
	A						   =   embed_dim
	A						   =   depths
	A						   =   num_heads
	A						   =   window_size

	return config






def       _snake_case				(		snake_case__   :     List[Any]     ):
	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 "layers" in name:
		A						   =   'encoder.' + name
	if "attn.proj" in name:
		A						   =   name.replace('attn.proj'	,      'attention.output.dense'     )
	if "attn" 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 "q_bias" in name:
		A						   =   name.replace('q_bias'	,      'query.bias'     )
	if "k_bias" in name:
		A						   =   name.replace('k_bias'	,      'key.bias'     )
	if "v_bias" in name:
		A						   =   name.replace('v_bias'	,      'value.bias'     )
	if "cpb_mlp" in name:
		A						   =   name.replace('cpb_mlp'	,      'continuous_position_bias_mlp'     )
	if name == "norm.weight":
		A						   =   'layernorm.weight'
	if name == "norm.bias":
		A						   =   'layernorm.bias'

	if "head" in name:
		A						   =   name.replace('head'	,      'classifier'     )
	else:
		A						   =   'swinv2.' + name

	return name






def       _snake_case				(		snake_case__   :     List[Any]	,      snake_case__   :     List[Any]     ):
	for key in orig_state_dict.copy().keys():
		A						   =   orig_state_dict.pop(snake_case__     )

		if "mask" in key:
			continue
		elif "qkv" in key:
			A						   =   key.split('.'     )
			A						   =   int(key_split[1]     )
			A						   =   int(key_split[3]     )
			A						   =   model.swinva.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:]
		else:
			A						   =   val

	return orig_state_dict






def       _snake_case				(		snake_case__   :     Optional[int]	,      snake_case__   :     Tuple     ):
	A						   =   timm.create_model(snake_case__	,      pretrained=snake_case__     )
	timm_model.eval()

	A						   =   get_swinva_config(snake_case__     )
	A						   =   SwinvaForImageClassification(snake_case__     )
	model.eval()

	A						   =   convert_state_dict(timm_model.state_dict()	,      snake_case__     )
	model.load_state_dict(snake_case__     )

	A						   =   'http://images.cocodataset.org/val2017/000000039769.jpg'

	A						   =   AutoImageProcessor.from_pretrained('microsoft/{}'.format(swinva_name.replace('_'	,      '-'     )     )     )
	A						   =   Image.open(requests.get(snake_case__	,      stream=snake_case__     ).raw     )
	A						   =   image_processor(images=snake_case__	,      return_tensors='pt'     )

	A						   =   timm_model(inputs['pixel_values']     )
	A						   =   model(**snake_case__     ).logits

	assert torch.allclose(snake_case__	,      snake_case__	,      atol=1e-3     )

	print(F'Saving model {swinva_name} to {pytorch_dump_folder_path}'     )
	model.save_pretrained(snake_case__     )

	print(F'Saving image processor to {pytorch_dump_folder_path}'     )
	image_processor.save_pretrained(snake_case__     )

	model.push_to_hub(
	    repo_path_or_name=Path(snake_case__	,      snake_case__     )	,      organization='nandwalritik'	,      commit_message='Add model'	,      )


if __name__ == "__main__":
		_lowercase							   =				argparse.ArgumentParser()
		# Required parameters
		parser.add_argument(
		    '''--swinv2_name''',
		    default='''swinv2_tiny_patch4_window8_256''',
		    type=str,
		    help='''Name of the Swinv2 timm model you\'d like to convert.''',
		)
		parser.add_argument(
		    '''--pytorch_dump_folder_path''', default=None, type=str, help='''Path to the output PyTorch model directory.'''
		)

		_lowercase							   =				parser.parse_args()
		convert_swinva_checkpoint(args.swinva_name, args.pytorch_dump_folder_path)