code: def build_encoders(self):
      self.encoders = nn.ModuleDict()
  
      for modality in self.config.modalities:
          if "encoder" not in modality:
              # Support "image_encoder" attribute in config if directly provided
              if (
                  modality.type == "image"
                  and "image_encoder" in self.config
              ):
                  encoder_config = self.config.image_encoder
              else:
                  # 100 is a random number added to satisfy identity encoder
                  # Set encoder to identity
                  encoder_config = OmegaConf.create(
                      {"type": "identity", "params": {"in_dim": 100}}
                  )
          else:
              encoder_config = modality.encoder
  
          encoder = build_encoder(encoder_config)
          self.encoders[modality.key] = encoder
  
          if modality.type == "image" and self.config.get(
              "freeze_image_encoder", False
          ):
              logger.info("Freezing image encoder...")
              for param in encoder.parameters():
                  param.requires_grad = False
  
          if modality.type == "text" and self.config.get(
              "freeze_text_encoder", False
          ):
              logger.info("Freezing text encoder...")
              for param in encoder.parameters():
                  param.requires_grad = False
  
imports: import logging
  from dataclasses import dataclass, field
  from typing import Dict, List, Optional
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformer, BaseTransformerBackendConfig, BaseTransformerHead, BaseTransformerModalityConfig
  from mmf.models.transformers.heads.mlp import MLP
  from mmf.modules.encoders import ResNet152ImageEncoder
  from mmf.utils.build import build_encoder
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 4 for calling the MMFTransformer obj's underlying member method code with example usage: obj.build_encoders() without return types