






"""simple docstring"""



import unittest

from transformers import AlbertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
						import torch

						from transformers import (
						    MODEL_FOR_PRETRAINING_MAPPING,
						    AlbertForMaskedLM,
						    AlbertForMultipleChoice,
						    AlbertForPreTraining,
						    AlbertForQuestionAnswering,
						    AlbertForSequenceClassification,
						    AlbertForTokenClassification,
						    AlbertModel,
						)
						from transformers.models.albert.modeling_albert import ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST





class 					_UpperCAmelCase       :




					def __init__(				self     :						Optional[Any]    ,						A     :						Dict    ,						A     :						Tuple=13    ,						A     :						List[Any]=7    ,						A     :						List[str]=True    ,						A     :						List[str]=True    ,						A     :						Any=True    ,						A     :						Union[str, Any]=True    ,						A     :						List[Any]=99    ,						A     :						Any=16    ,						A     :						int=36    ,						A     :						Optional[int]=6    ,						A     :						List[Any]=6    ,						A     :						Union[str, Any]=6    ,						A     :						List[str]=37    ,						A     :						Optional[Any]="gelu"    ,						A     :						Tuple=0.1    ,						A     :						List[Any]=0.1    ,						A     :						List[str]=5_12    ,						A     :						Optional[int]=16    ,						A     :						Any=2    ,						A     :						Dict=0.02    ,						A     :						List[Any]=3    ,						A     :						Optional[int]=4    ,						A     :						List[Any]=None    ,						)  ->  Tuple:
							lowercase_ : List[Any]							       =   parent
							lowercase_ : List[Any]							       =   batch_size
							lowercase_ : Optional[int]							       =   seq_length
							lowercase_ : Any							       =   is_training
							lowercase_ : List[Any]							       =   use_input_mask
							lowercase_ : Dict							       =   use_token_type_ids
							lowercase_ : Optional[int]							       =   use_labels
							lowercase_ : Dict							       =   vocab_size
							lowercase_ : Any							       =   embedding_size
							lowercase_ : str							       =   hidden_size
							lowercase_ : str							       =   num_hidden_layers
							lowercase_ : Optional[int]							       =   num_hidden_groups
							lowercase_ : Union[str, Any]							       =   num_attention_heads
							lowercase_ : int							       =   intermediate_size
							lowercase_ : Any							       =   hidden_act
							lowercase_ : Optional[Any]							       =   hidden_dropout_prob
							lowercase_ : str							       =   attention_probs_dropout_prob
							lowercase_ : List[Any]							       =   max_position_embeddings
							lowercase_ : List[Any]							       =   type_vocab_size
							lowercase_ : Optional[int]							       =   type_sequence_label_size
							lowercase_ : Any							       =   initializer_range
							lowercase_ : Union[str, Any]							       =   num_labels
							lowercase_ : List[Any]							       =   num_choices
							lowercase_ : Optional[Any]							       =   scope




					def   A  (				self     :						Any   )  ->  Optional[Any]:
							lowercase_ : Tuple							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.vocab_size   )

							lowercase_ : str							       =   None
							if self.use_input_mask:
									lowercase_ : int							       =   random_attention_mask([self.batch_size, self.seq_length]   )

							lowercase_ : Dict							       =   None
							if self.use_token_type_ids:
									lowercase_ : Dict							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.type_vocab_size   )

							lowercase_ : Union[str, Any]							       =   None
							lowercase_ : Dict							       =   None
							lowercase_ : Tuple							       =   None
							if self.use_labels:
									lowercase_ : int							       =   ids_tensor([self.batch_size]    ,						self.type_sequence_label_size   )
									lowercase_ : Any							       =   ids_tensor([self.batch_size, self.seq_length]    ,						self.num_labels   )
									lowercase_ : Optional[int]							       =   ids_tensor([self.batch_size]    ,						self.num_choices   )

							lowercase_ : str							       =   self.get_config()

							return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




					def   A  (				self     :						Tuple   )  ->  Any:
							return AlbertConfig(
							    vocab_size=self.vocab_size    ,						hidden_size=self.hidden_size    ,						num_hidden_layers=self.num_hidden_layers    ,						num_attention_heads=self.num_attention_heads    ,						intermediate_size=self.intermediate_size    ,						hidden_act=self.hidden_act    ,						hidden_dropout_prob=self.hidden_dropout_prob    ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,						max_position_embeddings=self.max_position_embeddings    ,						type_vocab_size=self.type_vocab_size    ,						initializer_range=self.initializer_range    ,						num_hidden_groups=self.num_hidden_groups    ,						)




					def   A  (				self     :						Union[str, Any]    ,						A     :						List[Any]    ,						A     :						Optional[Any]    ,						A     :						Optional[Any]    ,						A     :						Any    ,						A     :						Dict    ,						A     :						str    ,						A     :						Optional[int]   )  ->  str:
							lowercase_ : Dict							       =   AlbertModel(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : Optional[Any]							       =   model(A    ,						attention_mask=A    ,						token_type_ids=A   )
							lowercase_ : Dict							       =   model(A    ,						token_type_ids=A   )
							lowercase_ : Optional[int]							       =   model(A   )
							self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, self.seq_length, self.hidden_size)   )
							self.parent.assertEqual(result.pooler_output.shape    ,						(self.batch_size, self.hidden_size)   )




					def   A  (				self     :						Dict    ,						A     :						Tuple    ,						A     :						Optional[Any]    ,						A     :						Optional[int]    ,						A     :						Dict    ,						A     :						str    ,						A     :						Tuple    ,						A     :						List[Any]   )  ->  List[str]:
							lowercase_ : str							       =   AlbertForPreTraining(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : Any							       =   model(
							    A    ,						attention_mask=A    ,						token_type_ids=A    ,						labels=A    ,						sentence_order_label=A    ,						)
							self.parent.assertEqual(result.prediction_logits.shape    ,						(self.batch_size, self.seq_length, self.vocab_size)   )
							self.parent.assertEqual(result.sop_logits.shape    ,						(self.batch_size, config.num_labels)   )




					def   A  (				self     :						Tuple    ,						A     :						List[str]    ,						A     :						List[str]    ,						A     :						Any    ,						A     :						List[Any]    ,						A     :						Optional[int]    ,						A     :						Tuple    ,						A     :						Optional[int]   )  ->  Any:
							lowercase_ : Union[str, Any]							       =   AlbertForMaskedLM(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : Any							       =   model(A    ,						attention_mask=A    ,						token_type_ids=A    ,						labels=A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.seq_length, self.vocab_size)   )




					def   A  (				self     :						str    ,						A     :						Dict    ,						A     :						str    ,						A     :						Union[str, Any]    ,						A     :						str    ,						A     :						Optional[Any]    ,						A     :						List[Any]    ,						A     :						str   )  ->  Union[str, Any]:
							lowercase_ : Optional[Any]							       =   AlbertForQuestionAnswering(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : List[str]							       =   model(
							    A    ,						attention_mask=A    ,						token_type_ids=A    ,						start_positions=A    ,						end_positions=A    ,						)
							self.parent.assertEqual(result.start_logits.shape    ,						(self.batch_size, self.seq_length)   )
							self.parent.assertEqual(result.end_logits.shape    ,						(self.batch_size, self.seq_length)   )




					def   A  (				self     :						Tuple    ,						A     :						Dict    ,						A     :						Tuple    ,						A     :						Optional[int]    ,						A     :						Optional[int]    ,						A     :						str    ,						A     :						Optional[Any]    ,						A     :						Optional[int]   )  ->  List[str]:
							lowercase_ : str							       =   self.num_labels
							lowercase_ : int							       =   AlbertForSequenceClassification(A   )
							model.to(A   )
							model.eval()
							lowercase_ : List[Any]							       =   model(A    ,						attention_mask=A    ,						token_type_ids=A    ,						labels=A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_labels)   )




					def   A  (				self     :						Any    ,						A     :						Union[str, Any]    ,						A     :						List[Any]    ,						A     :						List[str]    ,						A     :						Union[str, Any]    ,						A     :						Optional[int]    ,						A     :						str    ,						A     :						Dict   )  ->  Dict:
							lowercase_ : Any							       =   self.num_labels
							lowercase_ : Optional[int]							       =   AlbertForTokenClassification(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : int							       =   model(A    ,						attention_mask=A    ,						token_type_ids=A    ,						labels=A   )
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.seq_length, self.num_labels)   )




					def   A  (				self     :						Union[str, Any]    ,						A     :						Optional[int]    ,						A     :						Dict    ,						A     :						int    ,						A     :						Dict    ,						A     :						str    ,						A     :						Union[str, Any]    ,						A     :						Tuple   )  ->  List[str]:
							lowercase_ : Optional[Any]							       =   self.num_choices
							lowercase_ : Optional[int]							       =   AlbertForMultipleChoice(config=A   )
							model.to(A   )
							model.eval()
							lowercase_ : Dict							       =   input_ids.unsqueeze(1   ).expand(-1    ,						self.num_choices    ,						-1   ).contiguous()
							lowercase_ : Any							       =   token_type_ids.unsqueeze(1   ).expand(-1    ,						self.num_choices    ,						-1   ).contiguous()
							lowercase_ : Dict							       =   input_mask.unsqueeze(1   ).expand(-1    ,						self.num_choices    ,						-1   ).contiguous()
							lowercase_ : Optional[Any]							       =   model(
							    A    ,						attention_mask=A    ,						token_type_ids=A    ,						labels=A    ,						)
							self.parent.assertEqual(result.logits.shape    ,						(self.batch_size, self.num_choices)   )






					def   A  (				self     :						str   )  ->  Any:
							lowercase_ : Union[str, Any]							       =   self.prepare_config_and_inputs()
							(
							    (
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					(
							    lowercase_
							)       ,					
							) : Any							       =   config_and_inputs
							lowercase_ : Dict							       =   {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
							return config, inputs_dict





@require_torch
class 					_UpperCAmelCase       ( _A   ,						_A   ,						unittest.TestCase							):
					SCREAMING_SNAKE_CASE_		:				Optional[Any]							    =   (
					    (
					        AlbertModel,
					        AlbertForPreTraining,
					        AlbertForMaskedLM,
					        AlbertForMultipleChoice,
					        AlbertForSequenceClassification,
					        AlbertForTokenClassification,
					        AlbertForQuestionAnswering,
					    )
					    if is_torch_available()
					    else ()
					)
					SCREAMING_SNAKE_CASE_		:				List[Any]							    =   (
					    {
					        "feature-extraction": AlbertModel,
					        "fill-mask": AlbertForMaskedLM,
					        "question-answering": AlbertForQuestionAnswering,
					        "text-classification": AlbertForSequenceClassification,
					        "token-classification": AlbertForTokenClassification,
					        "zero-shot": AlbertForSequenceClassification,
					    }
					    if is_torch_available()
					    else {}
					)
					SCREAMING_SNAKE_CASE_		:				str							    =   True




					def   A  (				self     :						List[Any]    ,						A     :						Any    ,						A     :						Optional[Any]    ,						A     :						Tuple=False   )  ->  List[Any]:
							lowercase_ : List[Any]							       =   super()._prepare_for_class(A    ,						A    ,						return_labels=A   )

							if return_labels:
									if model_class in get_values(A   ):
											lowercase_ : Any							       =   torch.zeros(
											    (self.model_tester.batch_size, self.model_tester.seq_length)    ,						dtype=torch.long    ,						device=A   )
											lowercase_ : Union[str, Any]							       =   torch.zeros(
											    self.model_tester.batch_size    ,						dtype=torch.long    ,						device=A   )
							return inputs_dict




					def   A  (				self     :						Tuple   )  ->  List[Any]:
							lowercase_ : Union[str, Any]							       =   AlbertModelTester(self   )
							lowercase_ : int							       =   ConfigTester(self    ,						config_class=A    ,						hidden_size=37   )




					def   A  (				self     :						Tuple   )  ->  Union[str, Any]:
							self.config_tester.run_common_tests()




					def   A  (				self     :						List[Any]   )  ->  int:
							lowercase_ : Optional[int]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*A   )




					def   A  (				self     :						Optional[int]   )  ->  Tuple:
							lowercase_ : Dict							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_pretraining(*A   )




					def   A  (				self     :						Optional[int]   )  ->  Dict:
							lowercase_ : Optional[Any]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*A   )




					def   A  (				self     :						List[str]   )  ->  Optional[Any]:
							lowercase_ : List[str]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_multiple_choice(*A   )




					def   A  (				self     :						Optional[int]   )  ->  Any:
							lowercase_ : str							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*A   )




					def   A  (				self     :						int   )  ->  Dict:
							lowercase_ : Optional[Any]							       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*A   )




					def   A  (				self     :						Union[str, Any]   )  ->  int:
							lowercase_ : Tuple							       =   self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
									lowercase_ : Any							       =   type
									self.model_tester.create_and_check_model(*A   )






					@slow
					def   A  (				self     :						Optional[int]   )  ->  Optional[int]:
							for model_name in ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									lowercase_ : str							       =   AlbertModel.from_pretrained(A   )
									self.assertIsNotNone(A   )





@require_torch
class 					_UpperCAmelCase       ( unittest.TestCase							):




					@slow
					def   A  (				self     :						Tuple   )  ->  Dict:
							lowercase_ : Union[str, Any]							       =   AlbertModel.from_pretrained('''albert-base-v2'''   )
							lowercase_ : str							       =   torch.tensor([[0, 3_45, 2_32, 3_28, 7_40, 1_40, 16_95, 69, 60_78, 15_88, 2]]   )
							lowercase_ : Optional[Any]							       =   torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]   )
							with torch.no_grad():
									lowercase_ : Dict							       =   model(A    ,						attention_mask=A   )[0]
							lowercase_ : int							       =   torch.Size((1, 11, 7_68)   )
							self.assertEqual(output.shape    ,						A   )
							lowercase_ : List[Any]							       =   torch.tensor(
							    [[[-0.6513, 1.5035, -0.2766], [-0.6515, 1.5046, -0.2780], [-0.6512, 1.5049, -0.2784]]]   )

							self.assertTrue(torch.allclose(output[:, 1:4, 1:4]    ,						A    ,						atol=1e-4   )   )






'''simple docstring'''






import argparse

import fairseq
import torch

from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, 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''',
    '''encoder.layer_norm_for_extract''': '''layer_norm_for_extract''',
    '''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''',
    '''label_embs_concat''': '''label_embeddings_concat''',
    '''mask_emb''': '''masked_spec_embed''',
    '''spk_proj''': '''speaker_proj''',
}
lowerCAmelCase__											=	[
    '''lm_head''',
    '''quantizer.weight_proj''',
    '''quantizer.codevectors''',
    '''project_q''',
    '''project_hid''',
    '''label_embeddings_concat''',
    '''speaker_proj''',
    '''layer_norm_for_extract''',
]


def 		_A     (    A__     ,				A__     ,				A__     ,				A__     ,				A__      ):






 """simple docstring"""



 for attribute in key.split('''.'''      ):
  __lowercase							  = getattr(A__     ,				A__      )

 if weight_type is not None:
  __lowercase							  = getattr(A__     ,				A__      ).shape
 else:
  __lowercase							  = 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":
  __lowercase							  = value
 elif weight_type == "weight_g":
  __lowercase							  = value
 elif weight_type == "weight_v":
  __lowercase							  = value
 elif weight_type == "bias":
  __lowercase							  = value
 else:
  __lowercase							  = value

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


def 		_A     (    A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = []
 __lowercase							  = fairseq_model.state_dict()

 __lowercase							  = hf_model.unispeech_sat.feature_extractor

 for name, value in fairseq_dict.items():
  __lowercase							  = False
  if "conv_layers" in name:
   load_conv_layer(
       A__     ,				A__     ,				A__     ,				A__     ,				hf_model.config.feat_extract_norm == '''group'''     ,				)
   __lowercase							  = True
  else:
   for key, mapped_key in MAPPING.items():
    __lowercase							  = '''unispeech_sat.''' + 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]:
     if "layer_norm_for_extract" in name and (".".join(name.split('''.'''      )[:-1]      ) != key):
      # special case since naming is very similar
      continue
     __lowercase							  = True
     if "*" in mapped_key:
      __lowercase							  = name.split(A__      )[0].split('''.'''      )[-2]
      __lowercase							  = mapped_key.replace('''*'''     ,				A__      )
     if "weight_g" in name:
      __lowercase							  = '''weight_g'''
     elif "weight_v" in name:
      __lowercase							  = '''weight_v'''
     elif "bias" in name:
      __lowercase							  = '''bias'''
     elif "weight" in name:
      # TODO: don't match quantizer.weight_proj
      __lowercase							  = '''weight'''
     else:
      __lowercase							  = 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 		_A     (    A__     ,				A__     ,				A__     ,				A__     ,				A__      ):






 """simple docstring"""



 __lowercase							  = full_name.split('''conv_layers.'''      )[-1]
 __lowercase							  = name.split('''.'''      )
 __lowercase							  = int(items[0]      )
 __lowercase							  = 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."      )
   __lowercase							  = 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."      )
   __lowercase							  = 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[layer_id].layer_norm.bias.data.shape} was found."      )
   __lowercase							  = 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[layer_id].layer_norm.weight.data.shape} was found."      )
   __lowercase							  = 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 		_A     (    A__     ,				A__     ,				A__=None     ,				A__=None     ,				A__=True      ):






 """simple docstring"""



 if config_path is not None:
  __lowercase							  = UniSpeechSatConfig.from_pretrained(A__      )
 else:
  __lowercase							  = UniSpeechSatConfig()

 __lowercase							  = ''''''

 if is_finetuned:
  __lowercase							  = UniSpeechSatForCTC(A__      )
 else:
  __lowercase							  = UniSpeechSatForPreTraining(A__      )

 __lowercase  ,	__lowercase  ,	__lowercase							  = fairseq.checkpoint_utils.load_model_ensemble_and_task(
     [checkpoint_path]     ,				arg_overrides={'''data''': '''/'''.join(dict_path.split('''/'''      )[:-1]      )}      )
 __lowercase							  = model[0].eval()

 recursively_load_weights(A__     ,				A__      )

 hf_wavavec.save_pretrained(A__      )


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_sat_checkpoint(
     args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, not args.not_finetuned
 )

