code: def __init__(
      self,
      random_init: bool = True,
      bert_model_name: str = "bert-base-uncased",
      hidden_size: Optional[int] = None,
      max_position_embeddings: Optional[int] = None,
      *args,
      **kwargs,
  ):
      super().__init__()
      config = OmegaConf.create(
          {
              "bert_model_name": bert_model_name,
              "random_init": random_init,
          }
      )
      if hidden_size is not None:
          config.hidden_size = hidden_size
      if max_position_embeddings is not None:
          config.max_position_embeddings = max_position_embeddings
  
      text_encoder = TransformerEncoder(config)
      self.text_embeddings = text_encoder.embeddings
      # the hidden_size param enables hidden_size overrides
      # if hidden_size is None, hidden_size is loaded
      # from the default hf config for the model
      # the actual size of the embeddings will always be in the encoder configs
      hidden_size = text_encoder.config.hidden_size
      self.token_type_embeddings = nn.Embedding(2, hidden_size)
  
imports: import collections.abc
  import logging
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.models.transformers.heads.utils import build_heads_dict
  from mmf.modules.encoders import TransformerEncoder, ViTEncoder
  from mmf.modules.losses import MMFLoss
  from mmf.utils.build import build_encoder
  from mmf.utils.modeling import get_bert_configured_parameters
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 1 to create a new ViLTTextEmbedding object from inherited base classes: nn with example: obj = ViLTTextEmbedding(random_init, bert_model_name, hidden_size, max_position_embeddings)