class_docstr: Base class for text encoder
class_docstr_tok: ["Base","class","for","text","encoder"]
code: def __init__(
      self, opts, projection_dim: int, *args, **kwargs
  ) -> None:
      is_master_node = is_master(opts)
      vocab_size = getattr(opts, "dataset.text_vocab_size")
      if getattr(opts, "common.debug_mode", False):
          vocab_size = 100
      if vocab_size is None and is_master_node:
          logger.error(
              "Vocabulary size can't be None or -1 in {}. Got: {}".format(
                  self.__class__.__name__, vocab_size
              )
          )
  
      super(BaseTextEncoder, self).__init__()
      self.opts = opts
      self.projection_dim = projection_dim
      self.is_master_node = is_master_node
      self.vocab_size = vocab_size
  
file_path: ml-cvnets/cvnets/text_encoders/base_text_encoder.py
imports: import argparse
  from typing import Any, Dict, Optional
  import torch
  from torch import Tensor, nn
  from cvnets import parameter_list
  from cvnets.layers import norm_layers_tuple
  from cvnets.misc.init_utils import initialize_weights
  from utils import logger
  from utils.ddp_utils import is_master
label_desc: Use image node_id 1 to create a new BaseTextEncoder object from inherited base classes: nn with example: obj = BaseTextEncoder(opts, projection_dim)