code: def build_text_encoder(
      opts, projection_dim: int, *args, **kwargs
  ) -> BaseTextEncoder:
      """Helper function to build the text encoder from command-line arguments.
  
      Args:
          opts: Command-line arguments
          projection_dim: The dimensionality of the projection head after text encoder.
  
      Returns:
          Text encoder module.
      """
      text_encoder_name = getattr(opts, "model.text.name")
  
      # We registered the base class using a special `name` (i.e., `__base__`)
      # in order to access the arguments defined inside those classes. However, these classes are not supposed to
      # be used. Therefore, we raise an error for such cases
      if text_encoder_name == "__base__":
          logger.error(
              "__base__ can't be used as a projection name. Please check."
          )
  
      text_encoder = TEXT_ENCODER_REGISTRY[text_encoder_name](
          opts, projection_dim, *args, **kwargs
      )
      return text_encoder
  
imports: import argparse
  from cvnets.text_encoders.base_text_encoder import BaseTextEncoder
  from utils import logger
  from utils.registry import Registry
label_desc: Use image node_id 2 for calling a global function with example usage: build_text_encoder(opts, projection_dim) and returns: text_encoder