class_docstr: This lobe enables the integration of fairseq pretrained wav2vec2.0 models.
  
  Source paper: https://arxiv.org/abs/2006.11477
  FairSeq >= 0.10.0 needs to be installed:
  https://fairseq.readthedocs.io/en/latest/
  
  The model can be used as a fixed features extractor or can be finetuned. It
  will download automatically the model if a url is given (e.g FairSeq
  repository from GitHub).
  
  Arguments
  ---------
  pretrained_path : str
      Path of the pretrained wav2vec2 model. It can be a url or a local path.
  save_path : str
      Path and filename of the downloaded model.
  input_norm : bool (default: None)
      If True, a layer_norm (affine) will be applied to the input waveform.
      By default, it is extracted from the checkpoint of the downloaded model
      in order to match the pretraining conditions. However, if this information
      is not given in the checkpoint, it has to be given manually.
  output_norm : bool (default: True)
      If True, a layer_norm (affine) will be applied to the output obtained
      from the wav2vec model.
  freeze : bool (default: True)
      If True, the model is frozen. If False, the model will be trained
      alongside with the rest of the pipeline.
  pretrain : bool (default: True)
      If True, the model is pretrained with the specified source.
      If False, the randomly-initialized model is instantiated.
  dropout : float (default: None)
      If different from None (0.0 to 1.0), it will override the given fairseq
      dropout rates. This is useful if the wav2vec2 model has been trained
      without dropout and one wants to reactivate it for downstream task
      fine-tuning (better performance observed).
  layer_drop : float (default: None)
      If different from None (0.0 to 1.0), it will override the given fairseq
      layer_drop rate. This is useful if the wav2vec2 model has been trained
      without layer_drop and one wants to reactivate it for downstream task
      fine-tuning.
  
  Example
  -------
  >>> inputs = torch.rand([10, 600])
  >>> model_url = "https://dl.fbaipublicfiles.com/fairseq/wav2vec/wav2vec_small.pt"
  >>> save_path = "models_checkpoints/wav2vec2.pt"
  >>> model = FairseqWav2Vec2(model_url, save_path)
  >>> outputs = model(inputs)
  >>> outputs.shape
  torch.Size([10, 100,  768])
class_docstr_tok: ["This","lobe","enables","the","integration","of","fairseq","pretrained","wav2vec2.0","models",".","Source","paper",":","https",":","\/\/arxiv.org\/abs\/2006.11477","FairSeq",">","=","0.10.0","needs","to","be","installed",":","https",":","\/\/fairseq.readthedocs.io\/en\/latest\/","The","model","can","be","used","as","a","fixed","features","extractor","or","can","be","finetuned",".","It","will","download","automatically","the","model","if","a","url","is","given","(","e.g","FairSeq","repository","from","GitHub",")",".","Arguments","--","--","--","--","-","pretrained_path",":","str","Path","of","the","pretrained","wav2vec2","model",".","It","can","be","a","url","or","a","local","path",".","save_path",":","str","Path","and","filename","of","the","downloaded","model",".","input_norm",":","bool","(","default",":","None",")","If","True",",","a","layer_norm","(","affine",")","will","be","applied","to","the","input","waveform",".","By","default",",","it","is","extracted","from","the","checkpoint","of","the","downloaded","model","in","order","to","match","the","pretraining","conditions",".","However",",","if","this","information","is","not","given","in","the","checkpoint",",","it","has","to","be","given","manually",".","output_norm",":","bool","(","default",":","True",")","If","True",",","a","layer_norm","(","affine",")","will","be","applied","to","the","output","obtained","from","the","wav2vec","model",".","freeze",":","bool","(","default",":","True",")","If","True",",","the","model","is","frozen",".","If","False",",","the","model","will","be","trained","alongside","with","the","rest","of","the","pipeline",".","pretrain",":","bool","(","default",":","True",")","If","True",",","the","model","is","pretrained","with","the","specified","source",".","If","False",",","the","randomly-initialized","model","is","instantiated",".","dropout",":","float","(","default",":","None",")","If","different","from","None","(","0.0","to","1.0",")",",","it","will","override","the","given","fairseq","dropout","rates",".","This","is","useful","if","the","wav2vec2","model","has","been","trained","without","dropout","and","one","wants","to","reactivate","it","for","downstream","task","fine-tuning","(","better","performance","observed",")",".","layer_drop",":","float","(","default",":","None",")","If","different","from","None","(","0.0","to","1.0",")",",","it","will","override","the","given","fairseq","layer_drop","rate",".","This","is","useful","if","the","wav2vec2","model","has","been","trained","without","layer_drop","and","one","wants","to","reactivate","it","for","downstream","task","fine-tuning",".","Example","--","--","--","-",">",">",">","inputs","=","torch.rand","(","[","10",",","600","]",")",">",">",">","model_url","=","``","https",":","\/\/dl.fbaipublicfiles.com\/fairseq\/wav2vec\/wav2vec_small.pt","''",">",">",">","save_path","=","``","models_checkpoints\/wav2vec2.pt","''",">",">",">","model","=","FairseqWav2Vec2","(","model_url",",","save_path",")",">",">",">","outputs","=","model","(","inputs",")",">",">",">","outputs.shape","torch.Size","(","[","10",",","100",",","768","]",")"]
docstr: Remove uneeded modules. Inspired by the same fairseq function.
docstr_tok: ["Remove","uneeded","modules",".","Inspired","by","the","same","fairseq","function","."]
code: def remove_pretraining_modules(self):
      """Remove uneeded modules. Inspired by the same fairseq function."""
  
      self.model.quantizer = None
      self.model.project_q = None
      self.model.target_glu = None
      self.model.final_proj = None
  
imports: import torch
  import logging
  import torch.nn.functional
  from torch import nn
  from speechbrain.utils.data_utils import download_file
  from speechbrain.dataio.dataio import length_to_mask
label_desc: Use image node_id 5 for calling the FairseqWav2Vec2 obj's underlying member method code with example usage: obj.remove_pretraining_modules() without return types