


import argparse
import json
from pathlib import Path

import torch
import torchaudio
from datasets import load_dataset
from huggingface_hub import hf_hub_download

from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification
from transformers.utils import logging


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


def       _snake_case     (  A )		->					Dict:
							lowerCAmelCase__      =			ASTConfig()

							if "10-10" in model_name:
														pass
							elif "speech-commands" in model_name:
														lowerCAmelCase__      =			128
							elif "12-12" in model_name:
														lowerCAmelCase__      =			12
														lowerCAmelCase__      =			12
							elif "14-14" in model_name:
														lowerCAmelCase__      =			14
														lowerCAmelCase__      =			14
							elif "16-16" in model_name:
														lowerCAmelCase__      =			16
														lowerCAmelCase__      =			16
							else:
														raise ValueError('''Model not supported''' )

							lowerCAmelCase__      =			'''huggingface/label-files'''
							if "speech-commands" in model_name:
														lowerCAmelCase__      =			35
														lowerCAmelCase__      =			'''speech-commands-v2-id2label.json'''
							else:
														lowerCAmelCase__      =			527
														lowerCAmelCase__      =			'''audioset-id2label.json'''

							lowerCAmelCase__      =			json.load(open(hf_hub_download(A				,					A				,					repo_type='''dataset''' )				,					'''r''' ) )
							lowerCAmelCase__      =			{int(A ): v for k, v in idalabel.items()}
							lowerCAmelCase__      =			idalabel
							lowerCAmelCase__      =			{v: k for k, v in idalabel.items()}

							return config


def       _snake_case     (  A )		->					str:
							if "module.v" in name:
														lowerCAmelCase__      =			name.replace('''module.v'''				,					'''audio_spectrogram_transformer''' )
							if "cls_token" in name:
														lowerCAmelCase__      =			name.replace('''cls_token'''				,					'''embeddings.cls_token''' )
							if "dist_token" in name:
														lowerCAmelCase__      =			name.replace('''dist_token'''				,					'''embeddings.distillation_token''' )
							if "pos_embed" in name:
														lowerCAmelCase__      =			name.replace('''pos_embed'''				,					'''embeddings.position_embeddings''' )
							if "patch_embed.proj" in name:
														lowerCAmelCase__      =			name.replace('''patch_embed.proj'''				,					'''embeddings.patch_embeddings.projection''' )
							# transformer blocks
							if "blocks" in name:
														lowerCAmelCase__      =			name.replace('''blocks'''				,					'''encoder.layer''' )
							if "attn.proj" in name:
														lowerCAmelCase__      =			name.replace('''attn.proj'''				,					'''attention.output.dense''' )
							if "attn" in name:
														lowerCAmelCase__      =			name.replace('''attn'''				,					'''attention.self''' )
							if "norm1" in name:
														lowerCAmelCase__      =			name.replace('''norm1'''				,					'''layernorm_before''' )
							if "norm2" in name:
														lowerCAmelCase__      =			name.replace('''norm2'''				,					'''layernorm_after''' )
							if "mlp.fc1" in name:
														lowerCAmelCase__      =			name.replace('''mlp.fc1'''				,					'''intermediate.dense''' )
							if "mlp.fc2" in name:
														lowerCAmelCase__      =			name.replace('''mlp.fc2'''				,					'''output.dense''' )
							# final layernorm
							if "audio_spectrogram_transformer.norm" in name:
														lowerCAmelCase__      =			name.replace('''audio_spectrogram_transformer.norm'''				,					'''audio_spectrogram_transformer.layernorm''' )
							# classifier head
							if "module.mlp_head.0" in name:
														lowerCAmelCase__      =			name.replace('''module.mlp_head.0'''				,					'''classifier.layernorm''' )
							if "module.mlp_head.1" in name:
														lowerCAmelCase__      =			name.replace('''module.mlp_head.1'''				,					'''classifier.dense''' )

							return name


def       _snake_case     (  A				,					A )		->					str:
							for key in orig_state_dict.copy().keys():
														lowerCAmelCase__      =			orig_state_dict.pop(A )

														if "qkv" in key:
																					lowerCAmelCase__      =			key.split('''.''' )
																					lowerCAmelCase__      =			int(key_split[3] )
																					lowerCAmelCase__      =			config.hidden_size
																					if "weight" in key:
																												lowerCAmelCase__      =			val[:dim, :]
																												lowerCAmelCase__      =			val[dim : dim * 2, :]
																												lowerCAmelCase__      =			val[-dim:, :]
																					else:
																												lowerCAmelCase__      =			val[:dim]
																												lowerCAmelCase__      =			val[dim : dim * 2]
																												lowerCAmelCase__      =			val[-dim:]
														else:
																					lowerCAmelCase__      =			val

							return orig_state_dict


def       _snake_case     (  A )		->					Optional[int]:
							lowerCAmelCase__      =			[
							    '''module.v.head.weight''',
							    '''module.v.head.bias''',
							    '''module.v.head_dist.weight''',
							    '''module.v.head_dist.bias''',
							]
							for k in ignore_keys:
														state_dict.pop(A				,					A )


@torch.no_grad()
def       _snake_case     (  A				,					A				,					A=False )		->					Tuple:
							lowerCAmelCase__      =			get_audio_spectrogram_transformer_config(A )

							lowerCAmelCase__      =			{
							    '''ast-finetuned-audioset-10-10-0.4593''': (
							        '''https://www.dropbox.com/s/ca0b1v2nlxzyeb4/audioset_10_10_0.4593.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-10-10-0.450''': (
							        '''https://www.dropbox.com/s/1tv0hovue1bxupk/audioset_10_10_0.4495.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-10-10-0.448''': (
							        '''https://www.dropbox.com/s/6u5sikl4b9wo4u5/audioset_10_10_0.4483.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-10-10-0.448-v2''': (
							        '''https://www.dropbox.com/s/kt6i0v9fvfm1mbq/audioset_10_10_0.4475.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-12-12-0.447''': (
							        '''https://www.dropbox.com/s/snfhx3tizr4nuc8/audioset_12_12_0.4467.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-14-14-0.443''': (
							        '''https://www.dropbox.com/s/z18s6pemtnxm4k7/audioset_14_14_0.4431.pth?dl=1'''
							    ),
							    '''ast-finetuned-audioset-16-16-0.442''': (
							        '''https://www.dropbox.com/s/mdsa4t1xmcimia6/audioset_16_16_0.4422.pth?dl=1'''
							    ),
							    '''ast-finetuned-speech-commands-v2''': (
							        '''https://www.dropbox.com/s/q0tbqpwv44pquwy/speechcommands_10_10_0.9812.pth?dl=1'''
							    ),
							}

							# load original state_dict
							lowerCAmelCase__      =			model_name_to_url[model_name]
							lowerCAmelCase__      =			torch.hub.load_state_dict_from_url(A				,					map_location='''cpu''' )
							# remove some keys
							remove_keys(A )
							# rename some keys
							lowerCAmelCase__      =			convert_state_dict(A				,					A )

							# load 🤗 model
							lowerCAmelCase__      =			ASTForAudioClassification(A )
							model.eval()

							model.load_state_dict(A )

							# verify outputs on dummy input
							# source: https://github.com/YuanGongND/ast/blob/79e873b8a54d0a3b330dd522584ff2b9926cd581/src/run.py#L62
							lowerCAmelCase__      =			-4.2_677_393 if '''speech-commands''' not in model_name else -6.845_978
							lowerCAmelCase__      =			4.5_689_974 if '''speech-commands''' not in model_name else 5.5_654_526
							lowerCAmelCase__      =			1024 if '''speech-commands''' not in model_name else 128
							lowerCAmelCase__      =			ASTFeatureExtractor(mean=A				,					std=A				,					max_length=A )

							if "speech-commands" in model_name:
														lowerCAmelCase__      =			load_dataset('''speech_commands'''				,					'''v0.02'''				,					split='''validation''' )
														lowerCAmelCase__      =			dataset[0]['''audio''']['''array''']
							else:
														lowerCAmelCase__      =			hf_hub_download(
														    repo_id='''nielsr/audio-spectogram-transformer-checkpoint'''				,					filename='''sample_audio.flac'''				,					repo_type='''dataset'''				,					)

														lowerCAmelCase__     ,      lowerCAmelCase__      =			torchaudio.load(A )
														lowerCAmelCase__      =			waveform.squeeze().numpy()

							lowerCAmelCase__      =			feature_extractor(A				,					sampling_rate=16000				,					return_tensors='''pt''' )

							# forward pass
							lowerCAmelCase__      =			model(**A )
							lowerCAmelCase__      =			outputs.logits

							if model_name == "ast-finetuned-audioset-10-10-0.4593":
														lowerCAmelCase__      =			torch.tensor([-0.8_760, -7.0_042, -8.6_602] )
							elif model_name == "ast-finetuned-audioset-10-10-0.450":
														lowerCAmelCase__      =			torch.tensor([-1.1_986, -7.0_903, -8.2_718] )
							elif model_name == "ast-finetuned-audioset-10-10-0.448":
														lowerCAmelCase__      =			torch.tensor([-2.6_128, -8.0_080, -9.4_344] )
							elif model_name == "ast-finetuned-audioset-10-10-0.448-v2":
														lowerCAmelCase__      =			torch.tensor([-1.5_080, -7.4_534, -8.8_917] )
							elif model_name == "ast-finetuned-audioset-12-12-0.447":
														lowerCAmelCase__      =			torch.tensor([-0.5_050, -6.5_833, -8.0_843] )
							elif model_name == "ast-finetuned-audioset-14-14-0.443":
														lowerCAmelCase__      =			torch.tensor([-0.3_826, -7.0_336, -8.2_413] )
							elif model_name == "ast-finetuned-audioset-16-16-0.442":
														lowerCAmelCase__      =			torch.tensor([-1.2_113, -6.9_101, -8.3_470] )
							elif model_name == "ast-finetuned-speech-commands-v2":
														lowerCAmelCase__      =			torch.tensor([6.1_589, -8.0_566, -8.7_984] )
							else:
														raise ValueError('''Unknown model name''' )
							if not torch.allclose(logits[0, :3]				,					A				,					atol=1E-4 ):
														raise ValueError('''Logits don\'t match''' )
							print('''Looks ok!''' )

							if pytorch_dump_folder_path is not None:
														Path(A ).mkdir(exist_ok=A )
														print(F"""Saving model {model_name} to {pytorch_dump_folder_path}""" )
														model.save_pretrained(A )
														print(F"""Saving feature extractor to {pytorch_dump_folder_path}""" )
														feature_extractor.save_pretrained(A )

							if push_to_hub:
														print('''Pushing model and feature extractor to the hub...''' )
														model.push_to_hub(F"""MIT/{model_name}""" )
														feature_extractor.push_to_hub(F"""MIT/{model_name}""" )


if __name__ == "__main__":
		__UpperCAmelCase					       =							argparse.ArgumentParser()
		# Required parameters
		parser.add_argument(
		    '''--model_name''',
		    default='''ast-finetuned-audioset-10-10-0.4593''',
		    type=str,
		    help='''Name of the Audio Spectrogram Transformer 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.'''
		)
		parser.add_argument(
		    '''--push_to_hub''', action='''store_true''', help='''Whether or not to push the converted model to the 🤗 hub.'''
		)

		__UpperCAmelCase					       =							parser.parse_args()
		convert_audio_spectrogram_transformer_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.push_to_hub)



'''simple docstring'''






import argparse
import json
import os

import fairseq
import torch
from fairseq.data import Dictionary

from transformers import (
    WavaVecaConformerConfig,
    WavaVecaConformerForCTC,
    WavaVecaConformerForPreTraining,
    WavaVecaCTCTokenizer,
    WavaVecaFeatureExtractor,
    WavaVecaProcessor,
    logging,
)


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

__UpperCAmelCase					       =							{
    '''post_extract_proj''': '''feature_projection.projection''',
    '''encoder.pos_conv.0''': '''encoder.pos_conv_embed.conv''',
    '''self_attn.linear_k''': '''encoder.layers.*.self_attn.linear_k''',
    '''self_attn.linear_v''': '''encoder.layers.*.self_attn.linear_v''',
    '''self_attn.linear_q''': '''encoder.layers.*.self_attn.linear_q''',
    '''self_attn.pos_bias_u''': '''encoder.layers.*.self_attn.pos_bias_u''',
    '''self_attn.pos_bias_v''': '''encoder.layers.*.self_attn.pos_bias_v''',
    '''self_attn.linear_out''': '''encoder.layers.*.self_attn.linear_out''',
    '''self_attn.linear_pos''': '''encoder.layers.*.self_attn.linear_pos''',
    '''self_attn.rotary_emb''': '''encoder.embed_positions''',
    '''self_attn_layer_norm''': '''encoder.layers.*.self_attn_layer_norm''',
    '''conv_module.pointwise_conv1''': '''encoder.layers.*.conv_module.pointwise_conv1''',
    '''conv_module.pointwise_conv2''': '''encoder.layers.*.conv_module.pointwise_conv2''',
    '''conv_module.depthwise_conv''': '''encoder.layers.*.conv_module.depthwise_conv''',
    '''conv_module.batch_norm''': '''encoder.layers.*.conv_module.batch_norm''',
    '''conv_module.layer_norm''': '''encoder.layers.*.conv_module.layer_norm''',
    '''ffn1.w_1''': '''encoder.layers.*.ffn1.intermediate_dense''',
    '''ffn1.w_2''': '''encoder.layers.*.ffn1.output_dense''',
    '''ffn1.layer_norm''': '''encoder.layers.*.ffn1_layer_norm''',
    '''ffn2.w_1''': '''encoder.layers.*.ffn2.intermediate_dense''',
    '''ffn2.w_2''': '''encoder.layers.*.ffn2.output_dense''',
    '''ffn2.layer_norm''': '''encoder.layers.*.ffn2_layer_norm''',
    '''final_layer_norm''': '''encoder.layers.*.final_layer_norm''',
    '''encoder.layer_norm''': '''encoder.layer_norm''',
    '''w2v_model.layer_norm''': '''feature_projection.layer_norm''',
    '''quantizer.weight_proj''': '''quantizer.weight_proj''',
    '''quantizer.vars''': '''quantizer.codevectors''',
    '''project_q''': '''project_q''',
    '''final_proj''': '''project_hid''',
    '''w2v_encoder.proj''': '''lm_head''',
    '''mask_emb''': '''masked_spec_embed''',
}
__UpperCAmelCase					       =							[
    '''lm_head''',
    '''quantizer.weight_proj''',
    '''quantizer.codevectors''',
    '''project_q''',
    '''project_hid''',
]


def       _snake_case     (  A				,					A				,					A				,					A				,					A )		->					Optional[Any]:
							for attribute in key.split('''.''' ):
														lowerCAmelCase__      =			getattr(A				,					A )

							if weight_type is not None:
														lowerCAmelCase__      =			getattr(A				,					A ).shape
							else:
														lowerCAmelCase__      =			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":
														lowerCAmelCase__      =			value
							elif weight_type == "weight_g":
														lowerCAmelCase__      =			value
							elif weight_type == "weight_v":
														lowerCAmelCase__      =			value
							elif weight_type == "bias":
														lowerCAmelCase__      =			value
							elif weight_type == "running_mean":
														lowerCAmelCase__      =			value
							elif weight_type == "running_var":
														lowerCAmelCase__      =			value
							elif weight_type == "num_batches_tracked":
														lowerCAmelCase__      =			value
							elif weight_type == "inv_freq":
														lowerCAmelCase__      =			value
							else:
														lowerCAmelCase__      =			value

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


def       _snake_case     (  A				,					A				,					A )		->					Any:
							lowerCAmelCase__      =			[]
							lowerCAmelCase__      =			fairseq_model.state_dict()

							lowerCAmelCase__      =			hf_model.wavaveca_conformer.feature_extractor

							for name, value in fairseq_dict.items():
														lowerCAmelCase__      =			False
														if "conv_layers" in name:
																					load_conv_layer(
																					    A				,					A				,					A				,					A				,					hf_model.config.feat_extract_norm == '''group'''				,					)
																					lowerCAmelCase__      =			True
														else:
																					for key, mapped_key in MAPPING.items():
																												lowerCAmelCase__      =			'''wav2vec2_conformer.''' + mapped_key if mapped_key not in TOP_LEVEL_KEYS else mapped_key
																												if key in name or key.split('''w2v_model.''' )[-1] == name.split('''.''' )[0]:
																																			lowerCAmelCase__      =			True
																																			if "*" in mapped_key:
																																										lowerCAmelCase__      =			name.split(A )[0].split('''.''' )[-2]
																																										lowerCAmelCase__      =			mapped_key.replace('''*'''				,					A )
																																			if "pos_bias_u" in name:
																																										lowerCAmelCase__      =			None
																																			elif "pos_bias_v" in name:
																																										lowerCAmelCase__      =			None
																																			elif "weight_g" in name:
																																										lowerCAmelCase__      =			'''weight_g'''
																																			elif "weight_v" in name:
																																										lowerCAmelCase__      =			'''weight_v'''
																																			elif "bias" in name:
																																										lowerCAmelCase__      =			'''bias'''
																																			elif "weight" in name:
																																										# TODO: don't match quantizer.weight_proj
																																										lowerCAmelCase__      =			'''weight'''
																																			elif "running_mean" in name:
																																										lowerCAmelCase__      =			'''running_mean'''
																																			elif "inv_freq" in name:
																																										lowerCAmelCase__      =			'''inv_freq'''
																																			elif "running_var" in name:
																																										lowerCAmelCase__      =			'''running_var'''
																																			elif "num_batches_tracked" in name:
																																										lowerCAmelCase__      =			'''num_batches_tracked'''
																																			else:
																																										lowerCAmelCase__      =			None
																																			set_recursively(A				,					A				,					A				,					A				,					A )
																												continue
														if not is_used:
																					unused_weights.append(A )

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


def       _snake_case     (  A				,					A				,					A				,					A				,					A )		->					Tuple:
							lowerCAmelCase__      =			full_name.split('''conv_layers.''' )[-1]
							lowerCAmelCase__      =			name.split('''.''' )
							lowerCAmelCase__      =			int(items[0] )
							lowerCAmelCase__      =			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.""" )
																					lowerCAmelCase__      =			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.""" )
																					lowerCAmelCase__      =			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.""" )
																					lowerCAmelCase__      =			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.""" )
																					lowerCAmelCase__      =			value
																					logger.info(F"""Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.""" )
							else:
														unused_weights.append(A )


@torch.no_grad()
def       _snake_case     (  A				,					A				,					A=None				,					A=None				,					A=True )		->					Optional[int]:
							if config_path is not None:
														lowerCAmelCase__      =			WavaVecaConformerConfig.from_pretrained(A				,					hidden_act='''swish''' )
							else:
														lowerCAmelCase__      =			WavaVecaConformerConfig()

							if "rope" in checkpoint_path:
														lowerCAmelCase__      =			'''rotary'''

							if is_finetuned:
														if dict_path:
																					lowerCAmelCase__      =			Dictionary.load(A )

																					# important change bos & pad token id since CTC symbol is <pad> and
																					# not <s> as in fairseq
																					lowerCAmelCase__      =			target_dict.pad_index
																					lowerCAmelCase__      =			target_dict.bos_index
																					lowerCAmelCase__      =			target_dict.eos_index
																					lowerCAmelCase__      =			len(target_dict.symbols )
																					lowerCAmelCase__      =			os.path.join(A				,					'''vocab.json''' )
																					if not os.path.isdir(A ):
																												logger.error('''--pytorch_dump_folder_path ({}) should be a directory'''.format(A ) )
																												return
																					os.makedirs(A				,					exist_ok=A )
																					lowerCAmelCase__      =			target_dict.indices

																					# fairseq has the <pad> and <s> switched
																					lowerCAmelCase__      =			0
																					lowerCAmelCase__      =			1
																					with open(A				,					'''w'''				,					encoding='''utf-8''' ) as vocab_handle:
																												json.dump(A				,					A )
																					lowerCAmelCase__      =			WavaVecaCTCTokenizer(
																					    A				,					unk_token=target_dict.unk_word				,					pad_token=target_dict.pad_word				,					bos_token=target_dict.bos_word				,					eos_token=target_dict.eos_word				,					word_delimiter_token='''|'''				,					do_lower_case=A				,					)
																					lowerCAmelCase__      =			True if config.feat_extract_norm == '''layer''' else False
																					lowerCAmelCase__      =			WavaVecaFeatureExtractor(
																					    feature_size=1				,					sampling_rate=16000				,					padding_value=0				,					do_normalize=A				,					return_attention_mask=A				,					)
																					lowerCAmelCase__      =			WavaVecaProcessor(feature_extractor=A				,					tokenizer=A )
																					processor.save_pretrained(A )

														lowerCAmelCase__      =			WavaVecaConformerForCTC(A )
							else:
														lowerCAmelCase__      =			WavaVecaConformerForPreTraining(A )

							if is_finetuned:
														lowerCAmelCase__     ,      lowerCAmelCase__     ,      lowerCAmelCase__      =			fairseq.checkpoint_utils.load_model_ensemble_and_task(
														    [checkpoint_path]				,					arg_overrides={'''data''': '''/'''.join(dict_path.split('''/''' )[:-1] )} )
							else:
														lowerCAmelCase__      =			argparse.Namespace(task='''audio_pretraining''' )
														lowerCAmelCase__      =			fairseq.tasks.setup_task(A )

														lowerCAmelCase__     ,      lowerCAmelCase__     ,      lowerCAmelCase__      =			fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path]				,					task=A )

							lowerCAmelCase__      =			model[0].eval()

							recursively_load_weights(A				,					A				,					not is_finetuned )

							hf_wavavec.save_pretrained(A )


if __name__ == "__main__":
		__UpperCAmelCase					       =							argparse.ArgumentParser()
		parser.add_argument('''--pytorch_dump_folder_path''', default=None, type=str, help='''Path to the output PyTorch model.''')
		parser.add_argument('''--checkpoint_path''', default=None, type=str, help='''Path to fairseq checkpoint''')
		parser.add_argument('''--dict_path''', default=None, type=str, help='''Path to dict of fine-tuned model''')
		parser.add_argument('''--config_path''', default=None, type=str, help='''Path to hf config.json of model to convert''')
		parser.add_argument(
		    '''--not_finetuned''', action='''store_true''', help='''Whether the model to convert is a fine-tuned model or not'''
		)
		__UpperCAmelCase					       =							parser.parse_args()
		convert_wavaveca_conformer_checkpoint(
		    args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, not args.not_finetuned
		)