code: def __init__(
      self,
      cfg: BEATsConfig,
  ) -> None:
      super().__init__()
      logger.info(f"BEATs Config: {cfg.__dict__}")
  
      self.cfg = cfg
  
      self.embed = cfg.embed_dim
      self.post_extract_proj = (
          nn.Linear(self.embed, cfg.encoder_embed_dim)
          if self.embed != cfg.encoder_embed_dim
          else None
      )
  
      self.input_patch_size = cfg.input_patch_size
      self.patch_embedding = nn.Conv2d(
          1,
          self.embed,
          kernel_size=self.input_patch_size,
          stride=self.input_patch_size,
          bias=cfg.conv_bias,
      )
  
      self.dropout_input = nn.Dropout(cfg.dropout_input)
  
      assert not cfg.deep_norm or not cfg.layer_norm_first
      self.encoder = TransformerEncoder(cfg)
      self.layer_norm = LayerNorm(self.embed)
  
      if cfg.finetuned_model:
          self.predictor_dropout = nn.Dropout(cfg.predictor_dropout)
          self.predictor = nn.Linear(
              cfg.encoder_embed_dim, cfg.predictor_class
          )
      else:
          self.predictor = None
  
file_path: lavis/lavis/models/beats/BEATs.py
imports: import torch
  import torch.nn
  from torch.nn import LayerNorm
  import torchaudio.compliance.kaldi
  from lavis.models.beats.backbone import TransformerEncoder
  import logging
  from typing import Optional
label_desc: Use image node_id 1 to create a new BEATs object from inherited base classes: nn with example: obj = BEATs(cfg)