


import argparse

import fairseq
import torch
from torch import nn

from transformers import (
    MBartaaTokenizer,
    MBartConfig,
    MBartForCausalLM,
    SpeechEncoderDecoderConfig,
    SpeechEncoderDecoderModel,
    WavaVecaConfig,
    WavaVecaFeatureExtractor,
    WavaVecaModel,
    logging,
)


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

UpperCAmelCase_      : int  					=       {
    'post_extract_proj': 'feature_projection.projection',
    'encoder.pos_conv.0': 'encoder.pos_conv_embed.conv',
    'self_attn.k_proj': 'encoder.layers.*.attention.k_proj',
    'self_attn.v_proj': 'encoder.layers.*.attention.v_proj',
    'self_attn.q_proj': 'encoder.layers.*.attention.q_proj',
    'self_attn.out_proj': 'encoder.layers.*.attention.out_proj',
    'self_attn_layer_norm': 'encoder.layers.*.layer_norm',
    'fc1': 'encoder.layers.*.feed_forward.intermediate_dense',
    'fc2': 'encoder.layers.*.feed_forward.output_dense',
    '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_      : Union[str, Any]  					=       [
    'lm_head',
    'quantizer.weight_proj',
    'quantizer.codevectors',
    'project_q',
    'project_hid',
]







def        SCREAMING_SNAKE_CASE_						(			__A :			str  ,    __A :			Optional[Any]  ,    __A :			Optional[Any]  ,    __A :			int  ,    __A :			Dict				)	->		List[Any]:

       """simple docstring"""

       for attribute in key.split('.'				):
              a_					:		Optional[Any]							=  getattr(__A  ,    __A				)

       if weight_type is not None:
              a_					:		Optional[int]							=  getattr(__A  ,    __A				).shape
       else:
              a_					:		Any							=  hf_pointer.shape

       assert hf_shape == value.shape, (
           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_					:		str							=  value
       elif weight_type == "weight_g":
              a_					:		Tuple							=  value
       elif weight_type == "weight_v":
              a_					:		Optional[int]							=  value
       elif weight_type == "bias":
              a_					:		Union[str, Any]							=  value
       else:
              a_					:		Tuple							=  value

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







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

       """simple docstring"""

       a_					:		Any							=  []
       a_					:		Dict							=  fairseq_model.state_dict()

       a_					:		Optional[int]							=  hf_model.feature_extractor
       a_					:		str							=  hf_model.adapter

       for name, value in fairseq_dict.items():
              a_					:		str							=  False
              if "conv_layers" in name:
                     load_conv_layer(
                         __A  ,    __A  ,    __A  ,    __A  ,    hf_model.config.feat_extract_norm == 'group'  ,    )
                     a_					:		Dict							=  True
              elif any(x in name for x in ['adaptor', 'w2v_encoder.proj.', 'w2v_proj_ln.']				):
                     load_adapter(__A  ,    __A  ,    __A  ,    __A				)
                     a_					:		Tuple							=  True
              else:
                     for key, mapped_key in MAPPING.items():
                            if key in name or key.split('w2v_model.'				)[-1] == name.split('.'				)[0]:
                                   a_					:		Union[str, Any]							=  True
                                   if "*" in mapped_key:
                                          a_					:		List[Any]							=  name.split(__A				)[0].split('.'				)[-2]
                                          a_					:		str							=  mapped_key.replace('*'  ,    __A				)
                                   if "weight_g" in name:
                                          a_					:		Dict							=  'weight_g'
                                   elif "weight_v" in name:
                                          a_					:		Optional[Any]							=  'weight_v'
                                   elif "bias" in name:
                                          a_					:		Optional[int]							=  'bias'
                                   elif "weight" in name:
                                          a_					:		Dict							=  'weight'
                                   else:
                                          a_					:		Any							=  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        SCREAMING_SNAKE_CASE_						(			__A :			List[Any]  ,    __A :			Dict  ,    __A :			int  ,    __A :			int  ,    __A :			List[str]				)	->		List[Any]:

       """simple docstring"""

       a_					:		int							=  full_name.split('conv_layers.'				)[-1]
       a_					:		Dict							=  name.split('.'				)
       a_					:		str							=  int(items[0]				)
       a_					:		Optional[Any]							=  int(items[1]				)

       if type_id == 0:
              if "bias" in name:
                     assert value.shape == feature_extractor.conv_layers[layer_id].conv.bias.data.shape, (
                         F"""{full_name} has size {value.shape}, but"""
                         F""" {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found."""
                     )
                     a_					:		Optional[Any]							=  value
                     logger.info(F"""Feat extract conv layer {layer_id} was initialized from {full_name}."""				)
              elif "weight" in name:
                     assert value.shape == feature_extractor.conv_layers[layer_id].conv.weight.data.shape, (
                         F"""{full_name} has size {value.shape}, but"""
                         F""" {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found."""
                     )
                     a_					:		Any							=  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:
                     assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape, (
                         F"""{full_name} has size {value.shape}, but {feature_extractor[layer_id].layer_norm.bias.data.shape} was"""
                         " found."
                     )
                     a_					:		str							=  value
                     logger.info(F"""Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}."""				)
              elif "weight" in name:
                     assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape, (
                         F"""{full_name} has size {value.shape}, but"""
                         F""" {feature_extractor[layer_id].layer_norm.weight.data.shape} was found."""
                     )
                     a_					:		str							=  value
                     logger.info(F"""Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}."""				)
       else:
              unused_weights.append(__A				)







def        SCREAMING_SNAKE_CASE_						(			__A :			Any  ,    __A :			int  ,    __A :			Optional[int]  ,    __A :			Optional[int]				)	->		List[Any]:

       """simple docstring"""

       a_					:		List[Any]							=  full_name.split('adaptor.'				)[-1]
       a_					:		str							=  name.split('.'				)

       if items[1].isdigit():
              a_					:		Dict							=  int(items[1]				)
       else:
              a_					:		int							=  None

       if "adaptor" not in full_name:
              if "proj_ln" in full_name:
                     # has to be layer norm
                     if "bias" in name:
                            assert (
                                value.shape == adapter.proj_layer_norm.bias.data.shape
                            ), F"""{full_name} has size {value.shape}, but {adapter.proj_layer_norm.bias.data.shape} was found."""
                            a_					:		int							=  value
                            logger.info(F"""Adapter proj layer norm bias was initialized from {full_name}."""				)
                     if "weight" in name:
                            assert (
                                value.shape == adapter.proj_layer_norm.weight.data.shape
                            ), F"""{full_name} has size {value.shape}, but {adapter.proj_layer_norm.weight.data.shape} was found."""
                            a_					:		Union[str, Any]							=  value
              else:
                     # has to be projection layer
                     if "bias" in name:
                            assert (
                                value.shape == adapter.proj.bias.data.shape
                            ), F"""{full_name} has size {value.shape}, but {adapter.proj.bias.data.shape} was found."""
                            a_					:		List[str]							=  value
                            logger.info(F"""Adapter proj layer bias was initialized from {full_name}."""				)
                     if "weight" in name:
                            assert (
                                value.shape == adapter.proj.weight.data.shape
                            ), F"""{full_name} has size {value.shape}, but {adapter.proj.weight.data.shape} was found."""
                            a_					:		str							=  value
                            logger.info(F"""Adapter proj layer weight was initialized from {full_name}."""				)
       elif isinstance(__A  ,    __A				):
              if "bias" in name:
                     assert (
                         value.shape == adapter.layers[layer_id].conv.bias.data.shape
                     ), F"""{full_name} has size {value.shape}, but {adapter.layers[layer_id].conv.bias.data.shape} was found."""
                     a_					:		Optional[Any]							=  value
                     logger.info(F"""Adapter layer {layer_id} bias was initialized from {full_name}."""				)
              elif "weight" in name:
                     assert (
                         value.shape == adapter.layers[layer_id].conv.weight.data.shape
                     ), F"""{full_name} has size {value.shape}, but {adapter.layers[layer_id].conv.weight.data.shape} was found."""
                     a_					:		List[Any]							=  value
                     logger.info(F"""Adapter layer {layer_id} bias was initialized from {full_name}."""				)
       else:
              unused_weights.append(__A				)







def        SCREAMING_SNAKE_CASE_						(			__A :			List[Any]				)	->		List[Any]:

       """simple docstring"""

       a_							,		a_					:		str							=  emb.weight.shape
       a_					:		Optional[int]							=  nn.Linear(__A  ,    __A  ,    bias=__A				)
       a_					:		Optional[int]							=  emb.weight.data
       return lin_layer







@torch.no_grad()
def        SCREAMING_SNAKE_CASE_						(			__A :			Dict  ,    __A :			Optional[int]  ,    __A :			Dict  ,    __A :			Optional[Any]  ,    __A :			str  ,    __A :			List[Any]  ,    __A :			Tuple  ,    __A :			Dict  ,    __A :			Optional[int]  ,    __A :			str  ,    __A :			str  ,    )	->		int:

       """simple docstring"""

       a_					:		Any							=  WavaVecaConfig.from_pretrained(
           __A  ,    add_adapter=__A  ,    adapter_stride=__A  ,    adapter_kernel_size=__A  ,    use_auth_token=__A  ,    output_hidden_size=__A  ,    )
       a_					:		Union[str, Any]							=  MBartConfig.from_pretrained(__A				)

       # load model
       a_							,		a_							,		a_					:		Union[str, Any]							=  fairseq.checkpoint_utils.load_model_ensemble_and_task(
           [checkpoint_path]  ,    arg_overrides={
               'config_yaml': config_yaml_path,
               'data': '/'.join(dict_path.split('/'				)[:-1]				),
               'w2v_path': checkpoint_path,
               'load_pretrained_decoder_from': None,
           }  ,    )
       a_					:		int							=  model[0].eval()

       # load feature extractor
       a_					:		List[Any]							=  WavaVecaFeatureExtractor.from_pretrained(__A  ,    use_auth_token=__A				)

       # set weights for wav2vec2 encoder
       a_					:		int							=  WavaVecaModel(__A				)

       recursively_load_weights_wavaveca(model.encoder  ,    __A				)

       # load decoder weights
       a_					:		Tuple							=  MBartForCausalLM(__A				)
       a_							,		a_					:		Optional[int]							=  hf_decoder.model.decoder.load_state_dict(model.decoder.state_dict()  ,    strict=__A				)
       logger.warning(F"""The following keys are missing when loading the decoder weights: {missing_keys}"""				)
       logger.warning(F"""The following keys are unexpected when loading the decoder weights: {unexpected_keys}"""				)

       a_					:		Union[str, Any]							=  SpeechEncoderDecoderModel(encoder=__A  ,    decoder=__A				)
       a_					:		List[str]							=  False

       a_					:		List[Any]							=  MBartaaTokenizer(__A				)
       tokenizer.save_pretrained(__A				)

       a_					:		Optional[Any]							=  hf_wavavec.config.to_dict()
       a_					:		Dict							=  tokenizer.pad_token_id
       a_					:		int							=  tokenizer.bos_token_id
       a_					:		Tuple							=  tokenizer.eos_token_id
       a_					:		str							=  'mbart50'
       a_					:		Union[str, Any]							=  'wav2vec2'

       a_					:		Union[str, Any]							=  tokenizer.eos_token_id
       a_					:		Optional[Any]							=  25_00_04
       a_					:		List[Any]							=  tokenizer.eos_token_id

       a_					:		Optional[int]							=  SpeechEncoderDecoderConfig.from_dict(__A				)

       hf_wavavec.save_pretrained(__A				)
       feature_extractor.save_pretrained(__A				)


if __name__ == "__main__":
   UpperCAmelCase_      : Any  					=       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_yaml_path', default=None, type=str, help='Path to yaml file of fine-tuned model')
   parser.add_argument(
       '--encoder_config_path',
       default='facebook/wav2vec2-xls-r-1b',
       type=str,
       help='Path to hf encoder wav2vec2 checkpoint config',
   )
   parser.add_argument(
       '--decoder_config_path',
       default='facebook/mbart-large-50-one-to-many-mmt',
       type=str,
       help='Path to hf decoder checkpoint config',
   )
   parser.add_argument('--add_adapter', default=True, type=bool, help='whethere to add model adapter layers')
   parser.add_argument('--adapter_stride', default=2, type=int, help='stride of adapter layers')
   parser.add_argument('--adapter_kernel_size', default=3, type=int, help='kernel size of adapter layers')
   parser.add_argument('--encoder_output_dim', default=1024, type=int, help='encoder output dim')
   parser.add_argument('--start_token_id', default=25_0004, type=int, help='`decoder_start_token_id` of model config')

   UpperCAmelCase_      : str  					=       parser.parse_args()
   convert_wavaveca_checkpoint(
       args.checkpoint_path,
       args.pytorch_dump_folder_path,
       args.dict_path,
       args.config_yaml_path,
       encoder_config_path=args.encoder_config_path,
       decoder_config_path=args.decoder_config_path,
       add_adapter=args.add_adapter,
       adapter_kernel_size=args.adapter_kernel_size,
       adapter_stride=args.adapter_stride,
       decoder_start_token_id=args.start_token_id,
       encoder_output_dim=args.encoder_output_dim,
   )







'''simple docstring'''





import argparse
import json
import os

import fairseq
import torch
from fairseq.data import Dictionary

from transformers import (
    UniSpeechConfig,
    UniSpeechForCTC,
    UniSpeechForPreTraining,
    WavaVecaFeatureExtractor,
    WavaVecaPhonemeCTCTokenizer,
    WavaVecaProcessor,
    logging,
)


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

lowercase_		       =  {
    "post_extract_proj": "feature_projection.projection",
    "encoder.pos_conv.0": "encoder.pos_conv_embed.conv",
    "self_attn.k_proj": "encoder.layers.*.attention.k_proj",
    "self_attn.v_proj": "encoder.layers.*.attention.v_proj",
    "self_attn.q_proj": "encoder.layers.*.attention.q_proj",
    "self_attn.out_proj": "encoder.layers.*.attention.out_proj",
    "self_attn_layer_norm": "encoder.layers.*.layer_norm",
    "fc1": "encoder.layers.*.feed_forward.intermediate_dense",
    "fc2": "encoder.layers.*.feed_forward.output_dense",
    "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": "ctc_proj",
    "mask_emb": "masked_spec_embed",
}
lowercase_		       =  [
    "ctc_proj",
    "quantizer.weight_proj",
    "quantizer.codevectors",
    "project_q",
    "project_hid",
]




def lowerCAmelCase  (__A  ,	__A  ,	__A  ,	__A  ,	__A  ,	__A):



     """simple docstring"""



     for attribute in key.split('''.'''):
          if is_finetuned:
               if attribute in ["quantizer", "project_q", "project_hid"]:
                    # those layers are only relevant for pretraining and should be dropped
                    return

               if attribute == "ctc_proj":
                    # we should rename `ctc_proj` to `lm_head` for fine-tuned phoneme models
                    _a      =  '''lm_head'''

          _a      =  getattr(__A  ,	__A)

     if weight_type is not None:
          _a      =  getattr(__A  ,	__A).shape
     else:
          _a      =  hf_pointer.shape

     assert hf_shape == value.shape, (
         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
     else:
          _a      =  value

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




def lowerCAmelCase  (__A  ,	__A  ,	__A):



     """simple docstring"""



     _a      =  []
     _a      =  fairseq_model.state_dict()

     _a      =  hf_model.unispeech.feature_extractor

     for name, value in fairseq_dict.items():
          _a      =  False
          if "conv_layers" in name:
               load_conv_layer(
                   __A  ,	__A  ,	__A  ,	__A  ,	hf_model.config.feat_extract_norm == '''group'''  ,	)
               _a      =  True
          else:
               for key, mapped_key in MAPPING.items():
                    _a      =  '''unispeech.''' + 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]:
                         _a      =  True
                         if "*" in mapped_key:
                              _a      =  name.split(__A)[0].split('''.''')[-2]
                              _a      =  mapped_key.replace('''*'''  ,	__A)
                         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:
                              # TODO: don't match quantizer.weight_proj
                              _a      =  '''weight'''
                         else:
                              _a      =  None
                         set_recursively(__A  ,	__A  ,	__A  ,	__A  ,	__A  ,	__A)
                    continue
          if not is_used:
               unused_weights.append(__A)

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




def lowerCAmelCase  (__A  ,	__A  ,	__A  ,	__A  ,	__A):



     """simple docstring"""



     _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:
               assert value.shape == feature_extractor.conv_layers[layer_id].conv.bias.data.shape, (
                   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:
               assert value.shape == feature_extractor.conv_layers[layer_id].conv.weight.data.shape, (
                   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:
               assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape, (
                   F'''{full_name} has size {value.shape}, but {feature_extractor[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:
               assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape, (
                   F'''{full_name} has size {value.shape}, but'''
                   F''' {feature_extractor[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(__A)




@torch.no_grad()
def lowerCAmelCase  (__A  ,	__A  ,	__A=None  ,	__A=None  ,	__A=True):



     """simple docstring"""



     if config_path is not None:
          _a      =  UniSpeechConfig.from_pretrained(__A)
     else:
          _a      =  UniSpeechConfig()

     if is_finetuned:
          if dict_path:
               _a      =  Dictionary.load_from_json(__A)

               # important change bos & pad token id since CTC symbol is <pad> and
               # not <s> as in fairseq
               _a      =  target_dict.pad_index
               _a      =  target_dict.bos_index
               _a      =  target_dict.eos_index
               _a      =  len(target_dict.symbols)
               _a      =  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)
               _a      =  target_dict.indices

               # fairseq has the <pad> and <s> switched
               _a      =  42
               _a      =  43
               with open(__A  ,	'''w'''  ,	encoding='''utf-8''') as vocab_handle:
                    json.dump(__A  ,	__A)
               _a      =  WavaVecaPhonemeCTCTokenizer(
                   __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  ,	)
               _a      =  True if config.feat_extract_norm == '''layer''' else False
               _a      =  WavaVecaFeatureExtractor(
                   feature_size=1  ,	sampling_rate=16_000  ,	padding_value=0  ,	do_normalize=__A  ,	return_attention_mask=__A  ,	)
               _a      =  WavaVecaProcessor(feature_extractor=__A  ,	tokenizer=__A)
               processor.save_pretrained(__A)

          _a      =  UniSpeechForCTC(__A)
     else:
          _a      =  UniSpeechForPreTraining(__A)

     if is_finetuned:
          _a  ,    _a  ,    _a      =  fairseq.checkpoint_utils.load_model_ensemble_and_task(
              [checkpoint_path]  ,	arg_overrides={'''data''': '''/'''.join(dict_path.split('''/''')[:-1]), '''w2v_path''': checkpoint_path})
     else:
          _a  ,    _a  ,    _a      =  fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path])

     _a      =  model[0].eval()

     recursively_load_weights(__A  ,	__A  ,	__A)

     hf_unispeech.save_pretrained(__A)


if __name__ == "__main__":
  lowercase_		       =  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"
  )
  lowercase_		       =  parser.parse_args()
  convert_unispeech_checkpoint(
      args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, not args.not_finetuned
  )



