class_docstr: This lobe enables the integration of HuggingFace
   wav2vec2.0 models to be pretrained.
  
  Source paper: https://arxiv.org/abs/2006.11477
  Transformer from HuggingFace needs to be installed:
  https://huggingface.co/transformers/installation.html
  
  The return is an HuggingFace format and the mask indices that contains:
  https://huggingface.co/transformers/model_doc/wav2vec2.html#wav2vec2forpretraining
  
  For instance, it returns the loss that can be accessed with .loss
  
  Arguments
  ---------
  source : str
      HuggingFace hub name: e.g "facebook/wav2vec2-large-lv60"
  save_path : str
      Path (dir) of the downloaded model.
  mask_prob : float (default: 0.65)
      Probability of masking a given frame. Default is taken from the paper.
  mask_length : float (default: 10)
      Length (i.e. number of consecutive masked frames). Default is taken from
      the paper.
  
  Example
  -------
  >>> inputs = torch.rand([10, 32000])
  >>> model_hub = "facebook/wav2vec2-base-960h"
  >>> save_path = "savedir"
  >>> model = Wav2Vec2Pretrain(model_hub, save_path)
  >>> outputs, _ = model(inputs, wav_lens=None)
class_docstr_tok: ["This","lobe","enables","the","integration","of","HuggingFace","wav2vec2.0","models","to","be","pretrained",".","Source","paper",":","https",":","\/\/arxiv.org\/abs\/2006.11477","Transformer","from","HuggingFace","needs","to","be","installed",":","https",":","\/\/huggingface.co\/transformers\/installation.html","The","return","is","an","HuggingFace","format","and","the","mask","indices","that","contains",":","https",":","\/\/huggingface.co\/transformers\/model_doc\/wav2vec2.html","#","wav2vec2forpretraining","For","instance",",","it","returns","the","loss","that","can","be","accessed","with",".loss","Arguments","--","--","--","--","-","source",":","str","HuggingFace","hub","name",":","e.g","``","facebook\/wav2vec2-large-lv60","''","save_path",":","str","Path","(","dir",")","of","the","downloaded","model",".","mask_prob",":","float","(","default",":","0.65",")","Probability","of","masking","a","given","frame",".","Default","is","taken","from","the","paper",".","mask_length",":","float","(","default",":","10",")","Length","(","i.e",".","number","of","consecutive","masked","frames",")",".","Default","is","taken","from","the","paper",".","Example","--","--","--","-",">",">",">","inputs","=","torch.rand","(","[","10",",","32000","]",")",">",">",">","model_hub","=","``","facebook\/wav2vec2-base-960h","''",">",">",">","save_path","=","``","savedir","''",">",">",">","model","=","Wav2Vec2Pretrain","(","model_hub",",","save_path",")",">",">",">","outputs",",","_","=","model","(","inputs",",","wav_lens=None",")"]
code: def __init__(
      self,
      source,
      save_path,
      mask_prob=0.65,
      mask_length=10,
      normalize_wav=True,
  ):
      super().__init__(
          source=source, save_path=save_path, for_pretraining=True
      )
  
      self.mask_prob = mask_prob
      self.mask_length = mask_length
      self.normalize_wav = normalize_wav
  
file_path: speechbrain/speechbrain/lobes/models/huggingface_transformers/wav2vec2.py
imports: import torch
  import logging
  import numpy
  import torch.nn.functional
  from speechbrain.lobes.models.huggingface_transformers.huggingface import HFTransformersInterface
  from speechbrain.lobes.models.huggingface_transformers.huggingface import make_padding_masks
  import transformers
  from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices
label_desc: Use image node_id 1 to create a new Wav2Vec2Pretrain object from inherited base classes: HFTransformersInterface with example: obj = Wav2Vec2Pretrain(source, save_path, mask_prob, mask_length, normalize_wav)