class_docstr: HuBERTPretrainModel()
  
  HuBERT model used for pretraining in *HuBERT* :cite:`hsu2021hubert`.
  
  Note:
      To build the model, please use one of the factory functions.
  
  See Also:
      `HuBERT Pre-training and Fine-tuning Recipes
      <https://github.com/pytorch/audio/tree/main/examples/hubert>`__
  
  Args:
      wav2vec2 (Wav2Vec2Model):
          Wav2Vec2 encoder that generates the transformer outputs.
  
      mask_generator (torch.nn.Module):
          Mask generator that generates the mask for masked prediction during the training.
  
      logit_generator (torch.nn.Module):
          Logit generator that predicts the logits of the masked and unmasked inputs.
  
      feature_grad_mult (float or None):
          The factor to scale the convolutional feature extraction layer gradients by.
          If ``None``, the gradients of feature extraction layers are not affected.
          The scale factor will not affect the forward pass.
class_docstr_tok: ["HuBERTPretrainModel","(",")","HuBERT","model","used","for","pretraining","in","*","HuBERT","*",":","cite",":","`","hsu2021hubert","`",".","Note",":","To","build","the","model",",","please","use","one","of","the","factory","functions",".","See","Also",":","`","HuBERT","Pre-training","and","Fine-tuning","Recipes","<","https",":","\/\/github.com\/pytorch\/audio\/tree\/main\/examples\/hubert",">","`","__","Args",":","wav2vec2","(","Wav2Vec2Model",")",":","Wav2Vec2","encoder","that","generates","the","transformer","outputs",".","mask_generator","(","torch.nn.Module",")",":","Mask","generator","that","generates","the","mask","for","masked","prediction","during","the","training",".","logit_generator","(","torch.nn.Module",")",":","Logit","generator","that","predicts","the","logits","of","the","masked","and","unmasked","inputs",".","feature_grad_mult","(","float","or","None",")",":","The","factor","to","scale","the","convolutional","feature","extraction","layer","gradients","by",".","If","``","None","``",",","the","gradients","of","feature","extraction","layers","are","not","affected",".","The","scale","factor","will","not","affect","the","forward","pass","."]
code: def __init__(
      self,
      wav2vec2: Wav2Vec2Model,
      mask_generator: Module,
      logit_generator: Module,
      feature_grad_mult: Optional[float],
  ):
      super().__init__()
      self.wav2vec2 = wav2vec2
      self.mask_generator = mask_generator
      self.logit_generator = logit_generator
      if (
          feature_grad_mult is not None
          and not 0.0 < feature_grad_mult < 1.0
      ):
          raise ValueError(
              f"The value of `feature_grad_mult` must be ``None``or between (0, 1). Found {feature_grad_mult}"
          )
      self.feature_grad_mult = feature_grad_mult
  
imports: import math
  from typing import List, Optional, Tuple
  import torch
  from torch import Tensor
  from torch.nn import Module
  from .None import components
label_desc: Use image node_id 1 to create a new HuBERTPretrainModel object from inherited base classes: Module with example: obj = HuBERTPretrainModel(wav2vec2, mask_generator, logit_generator, feature_grad_mult)