



'''simple docstring'''






from __future__ import annotations

import unittest

from transformers import MobileBertConfig, is_tf_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import (
         TF_MODEL_FOR_PRETRAINING_MAPPING,
         TFMobileBertForMaskedLM,
         TFMobileBertForMultipleChoice,
         TFMobileBertForNextSentencePrediction,
         TFMobileBertForPreTraining,
         TFMobileBertForQuestionAnswering,
         TFMobileBertForSequenceClassification,
         TFMobileBertForTokenClassification,
         TFMobileBertModel,
     )

@require_tf
class 							a__(      lowerCamelCase__	,				lowerCamelCase__	,				unittest.TestCase			):
    lowercase__				=					(
        (
            TFMobileBertModel,
            TFMobileBertForMaskedLM,
            TFMobileBertForNextSentencePrediction,
            TFMobileBertForPreTraining,
            TFMobileBertForQuestionAnswering,
            TFMobileBertForSequenceClassification,
            TFMobileBertForTokenClassification,
            TFMobileBertForMultipleChoice,
        )
        if is_tf_available()
        else ()
    )
    lowercase__				=					(
        {
            """feature-extraction""": TFMobileBertModel,
            """fill-mask""": TFMobileBertForMaskedLM,
            """question-answering""": TFMobileBertForQuestionAnswering,
            """text-classification""": TFMobileBertForSequenceClassification,
            """token-classification""": TFMobileBertForTokenClassification,
            """zero-shot""": TFMobileBertForSequenceClassification,
        }
        if is_tf_available()
        else {}
    )
    lowercase__				=					False
    lowercase__				=					False







    def     lowercase_ (   self				:						Dict		,    __snake_case				:						Any		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[int]=False			):
      a		:      Tuple       =  super()._prepare_for_class(__snake_case		,    __snake_case		,    return_labels=__snake_case			)

      if return_labels:
        if model_class in get_values(__snake_case			):
          a		:      Dict       =  tf.zeros(self.model_tester.batch_size		,    dtype=tf.intaa			)

      return inputs_dict

    class 							a__(      lowerCamelCase__			):







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







        def     lowercase_ (   self				:						Optional[int]			):
          a		:      Optional[Any]       =  ids_tensor([self.batch_size, self.seq_length]		,    self.vocab_size			)

          a		:      Optional[Any]       =  None
          if self.use_input_mask:
            a		:      List[str]       =  random_attention_mask([self.batch_size, self.seq_length]			)

          a		:      Tuple       =  None
          if self.use_token_type_ids:
            a		:      Optional[Any]       =  ids_tensor([self.batch_size, self.seq_length]		,    self.type_vocab_size			)

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

          a		:      List[Any]       =  MobileBertConfig(
              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		,    embedding_size=self.embedding_size		,    )

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







        def     lowercase_ (   self				:						str		,    __snake_case				:						Optional[int]		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						int		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						int		,    __snake_case				:						int			):
          a		:      Tuple       =  TFMobileBertModel(config=__snake_case			)
          a		:      Optional[Any]       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      Union[str, Any]       =  model(__snake_case			)

          a		:      Any       =  [input_ids, input_mask]
          a		:      List[Any]       =  model(__snake_case			)

          a		:      Tuple       =  model(__snake_case			)

          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     lowercase_ (   self				:						Any		,    __snake_case				:						List[Any]		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						Dict		,    __snake_case				:						int		,    __snake_case				:						Tuple		,    __snake_case				:						List[str]		,    __snake_case				:						Union[str, Any]			):
          a		:      Optional[int]       =  TFMobileBertForMaskedLM(config=__snake_case			)
          a		:      Optional[int]       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      List[Any]       =  model(__snake_case			)
          self.parent.assertEqual(result.logits.shape		,    (self.batch_size, self.seq_length, self.vocab_size)			)







        def     lowercase_ (   self				:						Dict		,    __snake_case				:						Dict		,    __snake_case				:						Tuple		,    __snake_case				:						List[str]		,    __snake_case				:						Optional[int]		,    __snake_case				:						Tuple		,    __snake_case				:						Any		,    __snake_case				:						Tuple			):
          a		:      Optional[int]       =  TFMobileBertForNextSentencePrediction(config=__snake_case			)
          a		:      Optional[Any]       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      Optional[int]       =  model(__snake_case			)
          self.parent.assertEqual(result.logits.shape		,    (self.batch_size, 2)			)







        def     lowercase_ (   self				:						Union[str, Any]		,    __snake_case				:						Any		,    __snake_case				:						str		,    __snake_case				:						List[Any]		,    __snake_case				:						str		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[Any]		,    __snake_case				:						int			):
          a		:      int       =  TFMobileBertForPreTraining(config=__snake_case			)
          a		:      Dict       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      List[str]       =  model(__snake_case			)
          self.parent.assertEqual(
              result.prediction_logits.shape		,    (self.batch_size, self.seq_length, self.vocab_size)			)
          self.parent.assertEqual(result.seq_relationship_logits.shape		,    (self.batch_size, 2)			)







        def     lowercase_ (   self				:						Any		,    __snake_case				:						Tuple		,    __snake_case				:						Optional[int]		,    __snake_case				:						Optional[int]		,    __snake_case				:						Optional[int]		,    __snake_case				:						Union[str, Any]		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[Any]			):
          a		:      Union[str, Any]       =  self.num_labels
          a		:      List[Any]       =  TFMobileBertForSequenceClassification(config=__snake_case			)
          a		:      int       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      List[str]       =  model(__snake_case			)
          self.parent.assertEqual(result.logits.shape		,    (self.batch_size, self.num_labels)			)







        def     lowercase_ (   self				:						int		,    __snake_case				:						List[str]		,    __snake_case				:						Optional[Any]		,    __snake_case				:						Optional[int]		,    __snake_case				:						Any		,    __snake_case				:						Tuple		,    __snake_case				:						Any		,    __snake_case				:						Any			):
          a		:      List[Any]       =  self.num_choices
          a		:      str       =  TFMobileBertForMultipleChoice(config=__snake_case			)
          a		:      Optional[int]       =  tf.tile(tf.expand_dims(__snake_case		,    1			)		,    (1, self.num_choices, 1)			)
          a		:      Optional[int]       =  tf.tile(tf.expand_dims(__snake_case		,    1			)		,    (1, self.num_choices, 1)			)
          a		:      Optional[Any]       =  tf.tile(tf.expand_dims(__snake_case		,    1			)		,    (1, self.num_choices, 1)			)
          a		:      Tuple       =  {
              'input_ids': multiple_choice_inputs_ids,
              'attention_mask': multiple_choice_input_mask,
              'token_type_ids': multiple_choice_token_type_ids,
          }
          a		:      Optional[Any]       =  model(__snake_case			)
          self.parent.assertEqual(result.logits.shape		,    (self.batch_size, self.num_choices)			)







        def     lowercase_ (   self				:						Tuple		,    __snake_case				:						List[Any]		,    __snake_case				:						List[str]		,    __snake_case				:						List[Any]		,    __snake_case				:						List[str]		,    __snake_case				:						List[Any]		,    __snake_case				:						Tuple		,    __snake_case				:						Tuple			):
          a		:      Optional[int]       =  self.num_labels
          a		:      List[str]       =  TFMobileBertForTokenClassification(config=__snake_case			)
          a		:      Optional[int]       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      Union[str, Any]       =  model(__snake_case			)
          self.parent.assertEqual(result.logits.shape		,    (self.batch_size, self.seq_length, self.num_labels)			)







        def     lowercase_ (   self				:						List[Any]		,    __snake_case				:						Optional[int]		,    __snake_case				:						int		,    __snake_case				:						Optional[Any]		,    __snake_case				:						List[Any]		,    __snake_case				:						str		,    __snake_case				:						List[Any]		,    __snake_case				:						Dict			):
          a		:      List[str]       =  TFMobileBertForQuestionAnswering(config=__snake_case			)
          a		:      str       =  {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
          a		:      Union[str, Any]       =  model(__snake_case			)
          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     lowercase_ (   self				:						Optional[int]			):
          a		:      Dict       =  self.prepare_config_and_inputs()
          (
              (
              a
          )     ,			(
              a
          )     ,			(
              a
          )     ,			(
              a
          )     ,			(
              a
          )     ,			(
              a
          )     ,			(
              a
          )     ,			
          )		:      Union[str, Any]       =  config_and_inputs
          a		:      List[str]       =  {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
          return config, inputs_dict







    def     lowercase_ (   self				:						Tuple			):
      a		:      List[str]       =  TFMobileBertModelTest.TFMobileBertModelTester(self			)
      a		:      Any       =  ConfigTester(self		,    config_class=__snake_case		,    hidden_size=37			)







    def     lowercase_ (   self				:						List[str]			):
      self.config_tester.run_common_tests()







    def     lowercase_ (   self				:						List[str]			):
      a		:      Optional[int]       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_model(*__snake_case			)







    def     lowercase_ (   self				:						Optional[int]			):
      a		:      Tuple       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_masked_lm(*__snake_case			)







    def     lowercase_ (   self				:						Optional[Any]			):
      a		:      Optional[int]       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_multiple_choice(*__snake_case			)







    def     lowercase_ (   self				:						Dict			):
      a		:      str       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*__snake_case			)







    def     lowercase_ (   self				:						Tuple			):
      a		:      Union[str, Any]       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_pretraining(*__snake_case			)







    def     lowercase_ (   self				:						Tuple			):
      a		:      str       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_question_answering(*__snake_case			)







    def     lowercase_ (   self				:						str			):
      a		:      Optional[Any]       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_sequence_classification(*__snake_case			)







    def     lowercase_ (   self				:						Optional[Any]			):
      a		:      int       =  self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_mobilebert_for_token_classification(*__snake_case			)







    @slow
    def     lowercase_ (   self				:						Union[str, Any]			):
      # for model_name in TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      for model_name in ["google/mobilebert-uncased"]:
        a		:      List[str]       =  TFMobileBertModel.from_pretrained(__snake_case			)
        self.assertIsNotNone(__snake_case			)

@require_tf
class 							a__(      unittest.TestCase			):







    @slow
    def     lowercase_ (   self				:						List[Any]			):
      a		:      int       =  TFMobileBertForPreTraining.from_pretrained('google/mobilebert-uncased'			)
      a		:      Union[str, Any]       =  tf.constant([[0, 1, 2, 3, 4, 5]]			)
      a		:      int       =  model(__snake_case			)[0]

      a		:      str       =  [1, 6, 3_05_22]
      self.assertEqual(output.shape		,    __snake_case			)

      a		:      Optional[Any]       =  tf.constant(
          [
              [
                  [-4.5919547, -9.248295, -9.645256],
                  [-6.7306175, -6.440284, -6.6052837],
                  [-7.2743506, -6.7847915, -6.024673],
              ]
          ]			)
      tf.debugging.assert_near(output[:, :3, :3]		,    __snake_case		,    atol=1e-4			)




'''simple docstring'''






import argparse

import fairseq
import torch

from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging


logging.set_verbosity_info()
lowerCAmelCase:      Optional[int]		 =		logging.get_logger(__name__)

lowerCAmelCase:      Union[str, Any]		 =		{
    '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:      int		 =		[
    'lm_head',
    'quantizer.weight_proj',
    'quantizer.codevectors',
    'project_q',
    'project_hid',
    'label_embeddings_concat',
    'speaker_proj',
    'layer_norm_for_extract',
]
def    lowerCamelCase__ (		_A				,    _A				,    _A				,    _A				,    _A       ):
  for attribute in key.split('.'       ):
    a		:      Tuple       =  getattr(_A				,    _A       )

  if weight_type is not None:
    a		:      Union[str, Any]       =  getattr(_A				,    _A       ).shape
  else:
    a		:      Optional[Any]       =  hf_pointer.shape

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

  if weight_type == "weight":
    a		:      str       =  value
  elif weight_type == "weight_g":
    a		:      Optional[int]       =  value
  elif weight_type == "weight_v":
    a		:      List[Any]       =  value
  elif weight_type == "bias":
    a		:      Any       =  value
  else:
    a		:      Optional[Any]       =  value

  logger.info(f"""{key + "." + weight_type if weight_type is not None else ""} was initialized from {full_name}."""       )
def    lowerCamelCase__ (		_A				,    _A       ):
  a		:      Optional[int]       =  []
  a		:      Tuple       =  fairseq_model.state_dict()

  a		:      List[Any]       =  hf_model.unispeech_sat.feature_extractor

  for name, value in fairseq_dict.items():
    a		:      Optional[Any]       =  False
    if "conv_layers" in name:
      load_conv_layer(
          _A				,    _A				,    _A				,    _A				,    hf_model.config.feat_extract_norm == 'group'				,    )
      a		:      int       =  True
    else:
      for key, mapped_key in MAPPING.items():
        a		:      Any       =  '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
          a		:      str       =  True
          if "*" in mapped_key:
            a		:      Union[str, Any]       =  name.split(_A       )[0].split('.'       )[-2]
            a		:      List[str]       =  mapped_key.replace('*'				,    _A       )
          if "weight_g" in name:
            a		:      Optional[int]       =  'weight_g'
          elif "weight_v" in name:
            a		:      Any       =  'weight_v'
          elif "bias" in name:
            a		:      str       =  'bias'
          elif "weight" in name:
            # TODO: don't match quantizer.weight_proj
            a		:      List[Any]       =  '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    lowerCamelCase__ (		_A				,    _A				,    _A				,    _A				,    _A       ):
  a		:      List[str]       =  full_name.split('conv_layers.'       )[-1]
  a		:      Any       =  name.split('.'       )
  a		:      Optional[Any]       =  int(items[0]       )
  a		:      Union[str, Any]       =  int(items[1]       )

  if type_id == 0:
    if "bias" in name:
      if value.shape != feature_extractor.conv_layers[layer_id].conv.bias.data.shape:
        raise ValueError(
            f"""{full_name} has size {value.shape}, but"""
            f""" {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found."""       )
      a		:      Optional[int]       =  value
      logger.info(f"""Feat extract conv layer {layer_id} was initialized from {full_name}."""       )
    elif "weight" in name:
      if value.shape != feature_extractor.conv_layers[layer_id].conv.weight.data.shape:
        raise ValueError(
            f"""{full_name} has size {value.shape}, but"""
            f""" {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found."""       )
      a		:      Optional[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:
      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."""       )
      a		:      Union[str, Any]       =  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."""       )
      a		:      Union[str, Any]       =  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       ):
  if config_path is not None:
    a		:      str       =  UniSpeechSatConfig.from_pretrained(_A       )
  else:
    a		:      Dict       =  UniSpeechSatConfig()

  a		:      Any       =  ''

  if is_finetuned:
    a		:      Tuple       =  UniSpeechSatForCTC(_A       )
  else:
    a		:      List[str]       =  UniSpeechSatForPreTraining(_A       )

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

  recursively_load_weights(_A				,    _A       )

  hf_wavavec.save_pretrained(_A       )


if __name__ == "__main__":
     lowerCAmelCase:      Tuple		 =		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:      Optional[int]		 =		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
     )