code: 
  
  
  import argparse
  
  import torch
  from torch import nn
  
  from transformers import PLBartConfig, PLBartForConditionalGeneration, PLBartForSequenceClassification
  
  
  
  
  def   lowerCamelCase_       (					UpperCAmelCase__      ):
  
  
  
  						"""simple docstring"""
  
  
  
  
  						a_					=		[
  						    """encoder.version""",
  						    """decoder.version""",
  						    """model.encoder.version""",
  						    """model.decoder.version""",
  						    """_float_tensor""",
  						    """decoder.output_projection.weight""",
  						]
  						for k in ignore_keys:
  												state_dict.pop(UpperCAmelCase__       ,    UpperCAmelCase__      )
  
  
  
  
  def   lowerCamelCase_       (					UpperCAmelCase__      ):
  
  
  
  						"""simple docstring"""
  
  
  
  
  						a_			,   a_					=		emb.weight.shape
  						a_					=		nn.Linear(UpperCAmelCase__       ,    UpperCAmelCase__       ,    bias=UpperCAmelCase__      )
  						a_					=		emb.weight.data
  						return lin_layer
  
  
  
  
  def   lowerCamelCase_       (					UpperCAmelCase__       ,    UpperCAmelCase__="uclanlp/plbart-base"       ,    UpperCAmelCase__=False       ,    UpperCAmelCase__=False      ):
  
  
  
  						"""simple docstring"""
  
  
  
  
  						a_					=		torch.load(UpperCAmelCase__       ,    map_location="""cpu"""      )["""model"""]
  						remove_ignore_keys_(UpperCAmelCase__      )
  						a_					=		state_dict["""encoder.embed_tokens.weight"""].shape[0]
  
  						a_					=		PLBartConfig.from_pretrained(UpperCAmelCase__       ,    vocab_size=UpperCAmelCase__      )
  
  						a_					=		state_dict["""decoder.embed_tokens.weight"""]
  						if not classification:
  												a_					=		PLBartForConditionalGeneration(UpperCAmelCase__      )
  												model.model.load_state_dict(UpperCAmelCase__      )
  												if finetuned:
  																		a_					=		make_linear_from_emb(model.model.shared      )
  
  						else:
  												a_					=		{}
  												for key, value in state_dict.copy().items():
  																		if key.startswith("""classification_heads.sentence_classification_head"""      ):
  																								a_					=		value
  																								state_dict.pop(UpperCAmelCase__      )
  												a_					=		PLBartForSequenceClassification(UpperCAmelCase__      )
  												model.model.load_state_dict(UpperCAmelCase__      )
  												model.classification_head.load_state_dict(UpperCAmelCase__      )
  
  						return model
  
  
  if __name__ == "__main__":
  	A_    :					Optional[Any]             =argparse.ArgumentParser()
  	# Required parameters
  	parser.add_argument("""fairseq_path""", type=str, help="""model.pt on local filesystem.""")
  	parser.add_argument("""pytorch_dump_folder_path""", default=None, type=str, help="""Path to the output PyTorch model.""")
  	parser.add_argument(
  	    """--hf_config""",
  	    default="""uclanlp/plbart-base""",
  	    type=str,
  	    help="""Which huggingface architecture to use: plbart-base""",
  	)
  	parser.add_argument("""--finetuned""", action="""store_true""", help="""whether the model is a fine-tuned checkpoint""")
  	parser.add_argument(
  	    """--classification""", action="""store_true""", help="""whether the model is a classification checkpoint"""
  	)
  	A_    :					Optional[Any]             =parser.parse_args()
  	A_    :					Optional[Any]             =convert_fairseq_plbart_checkpoint_from_disk(
  	    args.fairseq_path,
  	    hf_config_path=args.hf_config,
  	    finetuned=args.finetuned,
  	    classification=args.classification,
  	)
  	model.save_pretrained(args.pytorch_dump_folder_path)
style_context: 
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
  
  
  A_    :					Optional[Any]             ={
      """configuration_wav2vec2_conformer""": [
          """WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
          """Wav2Vec2ConformerConfig""",
      ],
  }
  
  
  try:
  	if not is_torch_available():
  		raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
  	pass
  else:
  	A_    :					Union[str, Any]             =[
  	    """WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
  	    """Wav2Vec2ConformerForAudioFrameClassification""",
  	    """Wav2Vec2ConformerForCTC""",
  	    """Wav2Vec2ConformerForPreTraining""",
  	    """Wav2Vec2ConformerForSequenceClassification""",
  	    """Wav2Vec2ConformerForXVector""",
  	    """Wav2Vec2ConformerModel""",
  	    """Wav2Vec2ConformerPreTrainedModel""",
  	]
  
  if TYPE_CHECKING:
  	from .configuration_wavaveca_conformer import (
  	    WAV2VEC2_CONFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
  	    WavaVecaConformerConfig,
  	)
  
  	try:
  		if not is_torch_available():
  			raise OptionalDependencyNotAvailable()
  	except OptionalDependencyNotAvailable:
  		pass
  	else:
  		from .modeling_wavaveca_conformer import (
  		    WAV2VEC2_CONFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
  		    WavaVecaConformerForAudioFrameClassification,
  		    WavaVecaConformerForCTC,
  		    WavaVecaConformerForPreTraining,
  		    WavaVecaConformerForSequenceClassification,
  		    WavaVecaConformerForXVector,
  		    WavaVecaConformerModel,
  		    WavaVecaConformerPreTrainedModel,
  		)
  
  else:
  	import sys
  
  	A_    :					Union[str, Any]             =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)