class_docstr: Builds modules of a w2v-BERT model as described in
  :cite:t`https://doi.org/10.48550/arxiv.2108.06209`.
  
  To tweak the architecture, you can derive from this class and override the
  corresponding methods.
class_docstr_tok: ["Builds","modules","of","a","w2v-BERT","model","as","described","in",":","cite",":","t","`","https",":","\/\/doi.org\/10.48550\/arxiv.2108.06209","`",".","To","tweak","the","architecture",",","you","can","derive","from","this","class","and","override","the","corresponding","methods","."]
docstr: :param config:
      The configuration.
  :param w2v2_builder:
      The wav2vec 2.0 builder.
  :param device:
      The device on which to initialize modules.
  :param dtype:
      The data type of module parameters and buffers.
docstr_tok: [":","param","config",":","The","configuration",".",":","param","w2v2_builder",":","The","wav2vec","2.0","builder",".",":","param","device",":","The","device","on","which","to","initialize","modules",".",":","param","dtype",":","The","data","type","of","module","parameters","and","buffers","."]
code: def __init__(
      self,
      config: W2VBertConfig,
      w2v2_builder: Wav2Vec2Builder,
      *,
      device: Optional[Device] = None,
      dtype: Optional[DataType] = None,
  ) -> None:
      """
      :param config:
          The configuration.
      :param w2v2_builder:
          The wav2vec 2.0 builder.
      :param device:
          The device on which to initialize modules.
      :param dtype:
          The data type of module parameters and buffers.
      """
      encoder_builder = w2v2_builder.encoder_builder
  
      if encoder_builder.config.layer_drop_p != 0.0:
          raise ValueError("w2v-BERT does not support LayerDrop.")
  
      if (
          config.num_bert_encoder_layers
          >= encoder_builder.config.num_encoder_layers
      ):
          raise ValueError(
              f"`config.num_bert_encoder_layers` must be less than the number of Transformer encoder layers ({encoder_builder.config.num_encoder_layers}), but is {config.num_bert_encoder_layers} instead."
          )
  
      if (
          config.num_target_codebooks
          > w2v2_builder.config.num_codebooks
      ):
          raise ValueError(
              f"`config.num_target_codebooks` must be less than the number of codebooks ({w2v2_builder.config.num_codebooks}), but is {config.num_target_codebooks} instead."
          )
  
      self.config = config
  
      self.w2v2_builder = w2v2_builder
  
      self.device, self.dtype = device, dtype
  
file_path: fairseq2/src/fairseq2/models/w2vbert/builder.py
imports: from dataclasses import dataclass
  from typing import Optional
  from fairseq2.models.utils import ArchitectureRegistry
  from fairseq2.models.w2vbert.model import W2VBertModel
  from fairseq2.models.wav2vec2 import Wav2Vec2Config, Wav2Vec2EncoderConfig
  from fairseq2.models.wav2vec2.builder import Wav2Vec2Builder, Wav2Vec2EncoderBuilder
  from fairseq2.nn.transformer import TransformerNormOrder
  from fairseq2.typing import DataType, Device
label_desc: Use image node_id 1 to create a new W2VBertBuilder object  with example: obj = W2VBertBuilder(config, w2v2_builder)