class_docstr: Construct the embeddings from word and position embeddings.
class_docstr_tok: ["Construct","the","embeddings","from","word","and","position","embeddings","."]
code: def __init__(self, config):
      super().__init__()
      self.word_embeddings = nn.Embedding(
          config.vocab_size,
          config.hidden_size,
          padding_idx=config.pad_token_id,
      )
      self.position_embeddings = nn.Embedding(
          config.max_position_embeddings, config.hidden_size
      )
  
      # self.LayerNorm is not snake-cased to stick with TensorFlow model variable name and be able to load
      # any TensorFlow checkpoint file
      self.LayerNorm = nn.LayerNorm(
          config.hidden_size, eps=config.layer_norm_eps
      )
      self.dropout = nn.Dropout(config.hidden_dropout_prob)
  
      # position_ids (1, len position emb) is contiguous in memory and exported when serialized
      self.register_buffer(
          "position_ids",
          torch.arange(config.max_position_embeddings).expand((1, -1)),
      )
      self.position_embedding_type = getattr(
          config, "position_embedding_type", "absolute"
      )
  
      self.config = config
  
imports: from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from transformers import BertTokenizer
  from transformers.activations import QuickGELUActivation
  from transformers.modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions
  from transformers.models.blip_2.configuration_blip_2 import Blip2Config, Blip2VisionConfig
  from transformers.models.blip_2.modeling_blip_2 import Blip2Encoder, Blip2PreTrainedModel, Blip2QFormerAttention, Blip2QFormerIntermediate, Blip2QFormerOutput
  from transformers.pytorch_utils import apply_chunking_to_forward
  from transformers.utils import logging, replace_return_docstrings
label_desc: Use image node_id 1 to create a new Blip2TextEmbeddings object from inherited base classes: nn with example: obj = Blip2TextEmbeddings(config)