





import argparse
import os
from pathlib import Path

import torch
from bark.generation import _load_model as _bark_load_model
from huggingface_hub import hf_hub_download

from transformers import EncodecConfig, EncodecModel, set_seed
from transformers.models.bark.configuration_bark import (
    BarkCoarseConfig,
    BarkConfig,
    BarkFineConfig,
    BarkSemanticConfig,
)
from transformers.models.bark.generation_configuration_bark import (
    BarkCoarseGenerationConfig,
    BarkFineGenerationConfig,
    BarkGenerationConfig,
    BarkSemanticGenerationConfig,
)
from transformers.models.bark.modeling_bark import BarkCoarseModel, BarkFineModel, BarkModel, BarkSemanticModel
from transformers.utils import logging


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

set_seed(770)


_lowerCAmelCase 				=     {
    """c_attn""": """att_proj""",
    """c_proj""": """out_proj""",
    """c_fc""": """in_proj""",
    """transformer.""": """""",
    """h.""": """layers.""",
    """ln_1""": """layernorm_1""",
    """ln_2""": """layernorm_2""",
    """ln_f""": """layernorm_final""",
    """wpe""": """position_embeds_layer""",
    """wte""": """input_embeds_layer""",
}


_lowerCAmelCase 				=     {
    """text_small""": {
        """repo_id""": """suno/bark""",
        """file_name""": """text.pt""",
    },
    """coarse_small""": {
        """repo_id""": """suno/bark""",
        """file_name""": """coarse.pt""",
    },
    """fine_small""": {
        """repo_id""": """suno/bark""",
        """file_name""": """fine.pt""",
    },
    """text""": {
        """repo_id""": """suno/bark""",
        """file_name""": """text_2.pt""",
    },
    """coarse""": {
        """repo_id""": """suno/bark""",
        """file_name""": """coarse_2.pt""",
    },
    """fine""": {
        """repo_id""": """suno/bark""",
        """file_name""": """fine_2.pt""",
    },
}

_lowerCAmelCase 				=     os.path.dirname(os.path.abspath(__file__))
_lowerCAmelCase 				=     os.path.join(os.path.expanduser("""~"""), """.cache""")
_lowerCAmelCase 				=     os.path.join(os.getenv("""XDG_CACHE_HOME""", default_cache_dir), """suno""", """bark_v0""")



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase=False     ):
   '''simple docstring'''


   A_     :				Optional[int]			      =	model_type
   if use_small:
      key += "_small"
   return os.path.join(_lowerCAmelCase  ,REMOTE_MODEL_PATHS[key]["""file_name"""]     )



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase     ):
   '''simple docstring'''


   os.makedirs(_lowerCAmelCase  ,exist_ok=_lowerCAmelCase     )
   hf_hub_download(repo_id=_lowerCAmelCase  ,filename=_lowerCAmelCase  ,local_dir=_lowerCAmelCase     )



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase=False  ,_lowerCAmelCase="text"     ):
   '''simple docstring'''


   if model_type == "text":
      A_     :				Optional[Any]			      =	BarkSemanticModel
      A_     :				List[str]			      =	BarkSemanticConfig
      A_     :				Tuple			      =	BarkSemanticGenerationConfig
   elif model_type == "coarse":
      A_     :				Union[str, Any]			      =	BarkCoarseModel
      A_     :				Union[str, Any]			      =	BarkCoarseConfig
      A_     :				Any			      =	BarkCoarseGenerationConfig
   elif model_type == "fine":
      A_     :				str			      =	BarkFineModel
      A_     :				Optional[int]			      =	BarkFineConfig
      A_     :				List[Any]			      =	BarkFineGenerationConfig
   else:
      raise NotImplementedError()
   A_     :				int			      =	f"""{model_type}_small""" if use_small else model_type
   A_     :				Tuple			      =	REMOTE_MODEL_PATHS[model_key]
   if not os.path.exists(_lowerCAmelCase     ):
      logger.info(f"""{model_type} model not found, downloading into `{CACHE_DIR}`."""     )
      _download(model_info["""repo_id"""]  ,model_info["""file_name"""]     )
   A_     :				Optional[int]			      =	torch.load(_lowerCAmelCase  ,map_location=_lowerCAmelCase     )
   # this is a hack
   A_     :				int			      =	checkpoint["""model_args"""]
   if "input_vocab_size" not in model_args:
      A_     :				List[str]			      =	model_args["""vocab_size"""]
      A_     :				Dict			      =	model_args["""vocab_size"""]
      del model_args["vocab_size"]

   # convert Bark model arguments to HF Bark model arguments
   A_     :				List[Any]			      =	model_args.pop("""n_head"""     )
   A_     :				str			      =	model_args.pop("""n_embd"""     )
   A_     :				Union[str, Any]			      =	model_args.pop("""n_layer"""     )

   A_     :				Optional[int]			      =	ConfigClass(**checkpoint["""model_args"""]     )
   A_     :				int			      =	ModelClass(config=_lowerCAmelCase     )
   A_     :				Any			      =	GenerationConfigClass()

   A_     :				List[Any]			      =	model_generation_config
   A_     :				Union[str, Any]			      =	checkpoint["""model"""]
   # fixup checkpoint
   A_     :				List[str]			      =	"""_orig_mod."""
   for k, v in list(state_dict.items()     ):
      if k.startswith(_lowerCAmelCase     ):
         # replace part of the key with corresponding layer name in HF implementation
         A_     :				str			      =	k[len(_lowerCAmelCase     ) :]
         for old_layer_name in new_layer_name_dict:
            A_     :				List[Any]			      =	new_k.replace(_lowerCAmelCase  ,new_layer_name_dict[old_layer_name]     )

         A_     :				Tuple			      =	state_dict.pop(_lowerCAmelCase     )

   A_     :				Optional[Any]			      =	set(state_dict.keys()     ) - set(model.state_dict().keys()     )
   A_     :				Optional[int]			      =	{k for k in extra_keys if not k.endswith(""".attn.bias"""     )}
   A_     :				int			      =	set(model.state_dict().keys()     ) - set(state_dict.keys()     )
   A_     :				int			      =	{k for k in missing_keys if not k.endswith(""".attn.bias"""     )}
   if len(_lowerCAmelCase     ) != 0:
      raise ValueError(f"""extra keys found: {extra_keys}"""     )
   if len(_lowerCAmelCase     ) != 0:
      raise ValueError(f"""missing keys: {missing_keys}"""     )
   model.load_state_dict(_lowerCAmelCase  ,strict=_lowerCAmelCase     )
   A_     :				Union[str, Any]			      =	model.num_parameters(exclude_embeddings=_lowerCAmelCase     )
   A_     :				str			      =	checkpoint["""best_val_loss"""].item()
   logger.info(f"""model loaded: {round(n_params/1e6  ,1     )}M params, {round(_lowerCAmelCase  ,3     )} loss"""     )
   model.eval()
   model.to(_lowerCAmelCase     )
   del checkpoint, state_dict

   return model



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase=False  ,_lowerCAmelCase="text"     ):
   '''simple docstring'''


   if model_type not in ("text", "coarse", "fine"):
      raise NotImplementedError()

   A_     :				Dict			      =	"""cpu"""  # do conversion on cpu

   A_     :				str			      =	_get_ckpt_path(_lowerCAmelCase  ,use_small=_lowerCAmelCase     )
   A_     :				Union[str, Any]			      =	_load_model(_lowerCAmelCase  ,_lowerCAmelCase  ,model_type=_lowerCAmelCase  ,use_small=_lowerCAmelCase     )

   # load bark initial model
   A_     :				Dict			      =	_bark_load_model(_lowerCAmelCase  ,"""cpu"""  ,model_type=_lowerCAmelCase  ,use_small=_lowerCAmelCase     )

   if model_type == "text":
      A_     :				List[Any]			      =	bark_model["""model"""]

   if model.num_parameters(exclude_embeddings=_lowerCAmelCase     ) != bark_model.get_num_params():
      raise ValueError("""initial and new models don't have the same number of parameters"""     )

   # check if same output as the bark model
   A_     :				Optional[Any]			      =	5
   A_     :				Any			      =	1_0

   if model_type in ["text", "coarse"]:
      A_     :				Any			      =	torch.randint(2_5_6  ,(batch_size, sequence_length)  ,dtype=torch.int     )
      A_     :				List[str]			      =	bark_model(_lowerCAmelCase     )[0]

      A_     :				Tuple			      =	model(_lowerCAmelCase     )

      # take last logits
      A_     :				Optional[Any]			      =	output_new_model_total.logits[:, [-1], :]

   else:
      A_     :				int			      =	3
      A_     :				Tuple			      =	8
      A_     :				Optional[int]			      =	torch.randint(2_5_6  ,(batch_size, sequence_length, n_codes_total)  ,dtype=torch.int     )

      A_     :				Dict			      =	model(_lowerCAmelCase  ,_lowerCAmelCase     )
      A_     :				Dict			      =	bark_model(_lowerCAmelCase  ,_lowerCAmelCase     )

      A_     :				Any			      =	output_new_model_total.logits

   # output difference should come from the difference of self-attention implementation design
   if output_new_model.shape != output_old_model.shape:
      raise ValueError("""initial and new outputs don't have the same shape"""     )
   if (output_new_model - output_old_model).abs().max().item() > 1e-3:
      raise ValueError("""initial and new outputs are not equal"""     )

   Path(_lowerCAmelCase     ).mkdir(exist_ok=_lowerCAmelCase     )
   model.save_pretrained(_lowerCAmelCase     )



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,):
   '''simple docstring'''


   A_     :				Union[str, Any]			      =	os.path.join(_lowerCAmelCase  ,_lowerCAmelCase     )

   A_     :				Union[str, Any]			      =	BarkSemanticConfig.from_pretrained(os.path.join(_lowerCAmelCase  ,"""config.json"""     )     )
   A_     :				Tuple			      =	BarkCoarseConfig.from_pretrained(os.path.join(_lowerCAmelCase  ,"""config.json"""     )     )
   A_     :				Dict			      =	BarkFineConfig.from_pretrained(os.path.join(_lowerCAmelCase  ,"""config.json"""     )     )
   A_     :				Optional[int]			      =	EncodecConfig.from_pretrained("""facebook/encodec_24khz"""     )

   A_     :				Tuple			      =	BarkSemanticModel.from_pretrained(_lowerCAmelCase     )
   A_     :				int			      =	BarkCoarseModel.from_pretrained(_lowerCAmelCase     )
   A_     :				List[str]			      =	BarkFineModel.from_pretrained(_lowerCAmelCase     )
   A_     :				str			      =	EncodecModel.from_pretrained("""facebook/encodec_24khz"""     )

   A_     :				Any			      =	BarkConfig.from_sub_model_configs(
       _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     )

   A_     :				str			      =	BarkGenerationConfig.from_sub_model_configs(
       semantic.generation_config  ,coarseAcoustic.generation_config  ,fineAcoustic.generation_config     )

   A_     :				Optional[Any]			      =	BarkModel(_lowerCAmelCase     )

   A_     :				Dict			      =	semantic
   A_     :				List[str]			      =	coarseAcoustic
   A_     :				str			      =	fineAcoustic
   A_     :				int			      =	codec

   A_     :				Union[str, Any]			      =	bark_generation_config

   Path(_lowerCAmelCase     ).mkdir(exist_ok=_lowerCAmelCase     )
   bark.save_pretrained(_lowerCAmelCase  ,repo_id=_lowerCAmelCase  ,push_to_hub=_lowerCAmelCase     )


if __name__ == "__main__":
      _lowerCAmelCase 				=     argparse.ArgumentParser()
      # Required parameters

      parser.add_argument("""model_type""", type=str, help="""text, coarse or fine.""")
      parser.add_argument("""pytorch_dump_folder_path""", default=None, type=str, help="""Path to the output PyTorch model.""")
      parser.add_argument("""--is_small""", action="""store_true""", help="""convert the small version instead of the large.""")

      _lowerCAmelCase 				=     parser.parse_args()

      load_model(args.pytorch_dump_folder_path, model_type=args.model_type, use_small=args.is_small)













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()
_lowerCAmelCase 				=     logging.get_logger(__name__)

_lowerCAmelCase 				=     {
    """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""",
}
_lowerCAmelCase 				=     [
    """ctc_proj""",
    """quantizer.weight_proj""",
    """quantizer.codevectors""",
    """project_q""",
    """project_hid""",
]



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     ):
   '''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_     :				Tuple			      =	"""lm_head"""

      A_     :				int			      =	getattr(_lowerCAmelCase  ,_lowerCAmelCase     )

   if weight_type is not None:
      A_     :				List[str]			      =	getattr(_lowerCAmelCase  ,_lowerCAmelCase     ).shape
   else:
      A_     :				Optional[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_     :				Union[str, Any]			      =	value
   elif weight_type == "weight_g":
      A_     :				Any			      =	value
   elif weight_type == "weight_v":
      A_     :				Tuple			      =	value
   elif weight_type == "bias":
      A_     :				List[Any]			      =	value
   else:
      A_     :				int			      =	value

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



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     ):
   '''simple docstring'''


   A_     :				Dict			      =	[]
   A_     :				List[Any]			      =	fairseq_model.state_dict()

   A_     :				Any			      =	hf_model.unispeech.feature_extractor

   for name, value in fairseq_dict.items():
      A_     :				Any			      =	False
      if "conv_layers" in name:
         load_conv_layer(
             _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,hf_model.config.feat_extract_norm == """group"""  ,)
         A_     :				int			      =	True
      else:
         for key, mapped_key in MAPPING.items():
            A_     :				Any			      =	"""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_     :				Dict			      =	True
               if "*" in mapped_key:
                  A_     :				Any			      =	name.split(_lowerCAmelCase     )[0].split("""."""     )[-2]
                  A_     :				Optional[int]			      =	mapped_key.replace("""*"""  ,_lowerCAmelCase     )
               if "weight_g" in name:
                  A_     :				Tuple			      =	"""weight_g"""
               elif "weight_v" in name:
                  A_     :				Optional[int]			      =	"""weight_v"""
               elif "bias" in name:
                  A_     :				List[Any]			      =	"""bias"""
               elif "weight" in name:
                  # TODO: don't match quantizer.weight_proj
                  A_     :				Optional[int]			      =	"""weight"""
               else:
                  A_     :				Dict			      =	None
               set_recursively(_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     )
            continue
      if not is_used:
         unused_weights.append(_lowerCAmelCase     )

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



def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     ):
   '''simple docstring'''


   A_     :				Union[str, Any]			      =	full_name.split("""conv_layers."""     )[-1]
   A_     :				Union[str, Any]			      =	name.split("""."""     )
   A_     :				List[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_     :				List[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_     :				int			      =	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_     :				List[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_     :				Tuple			      =	value
         logger.info(f"""Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}."""     )
   else:
      unused_weights.append(_lowerCAmelCase     )



@torch.no_grad()
def     _lowerCAmelCase		(  _lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase=None  ,_lowerCAmelCase=None  ,_lowerCAmelCase=True     ):
   '''simple docstring'''


   if config_path is not None:
      A_     :				Optional[int]			      =	UniSpeechConfig.from_pretrained(_lowerCAmelCase     )
   else:
      A_     :				List[str]			      =	UniSpeechConfig()

   if is_finetuned:
      if dict_path:
         A_     :				str			      =	Dictionary.load_from_json(_lowerCAmelCase     )

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

         # fairseq has the <pad> and <s> switched
         A_     :				Dict			      =	4_2
         A_     :				Optional[Any]			      =	4_3
         with open(_lowerCAmelCase  ,"""w"""  ,encoding="""utf-8"""     ) as vocab_handle:
            json.dump(_lowerCAmelCase  ,_lowerCAmelCase     )
         A_     :				Tuple			      =	WavaVecaPhonemeCTCTokenizer(
             _lowerCAmelCase  ,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=_lowerCAmelCase  ,)
         A_     :				Any			      =	True if config.feat_extract_norm == """layer""" else False
         A_     :				List[str]			      =	WavaVecaFeatureExtractor(
             feature_size=1  ,sampling_rate=1_6_0_0_0  ,padding_value=0  ,do_normalize=_lowerCAmelCase  ,return_attention_mask=_lowerCAmelCase  ,)
         A_     :				Optional[int]			      =	WavaVecaProcessor(feature_extractor=_lowerCAmelCase  ,tokenizer=_lowerCAmelCase     )
         processor.save_pretrained(_lowerCAmelCase     )

      A_     :				int			      =	UniSpeechForCTC(_lowerCAmelCase     )
   else:
      A_     :				str			      =	UniSpeechForPreTraining(_lowerCAmelCase     )

   if is_finetuned:
      A_      ,				A_      ,				A_     :				Union[str, Any]			      =	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_     :				Any			      =	fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path]     )

   A_     :				List[str]			      =	model[0].eval()

   recursively_load_weights(_lowerCAmelCase  ,_lowerCAmelCase  ,_lowerCAmelCase     )

   hf_unispeech.save_pretrained(_lowerCAmelCase     )


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






