code: def get_text_embeddings(
      self, sample_list
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      text, mask, segment = self.preprocess_text(sample_list)
  
      text_enc = self.text_encoder(text, mask, segment)
  
      # Text embedding
      text_proj = self.text_proj(text_enc[0]).permute(1, 0, 2)
      text_ebd = text_proj
  
      # Shared transformer
      text_proj_sec = self.shared_transformer(
          text_ebd, src_key_padding_mask=mask.eq(0)
      )
  
      # Project to shared space
      text_proj_sec = text_proj_sec.permute(1, 0, 2)
      text_pool = self.text_pool(
          text_proj_sec, text_proj_sec, mask.eq(0)
      ).squeeze(1)
  
      if self.config.norm_text_embeddings:
          text_pool = torch.nn.functional.normalize(text_pool, 2, dim=1)
  
      return text_pool
  
imports: import math
  from copy import deepcopy
  from dataclasses import dataclass
  from typing import Any, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.modules.encoders import IdentityEncoder
  from mmf.modules.layers import AttnPool1d
  from mmf.utils.build import build_classifier_layer, build_image_encoder, build_text_encoder
  from mmf.utils.general import filter_grads
  from mmf.utils.modeling import get_bert_configured_parameters
  from mmf.utils.transform import transform_to_batch_sequence
  from omegaconf import MISSING
label_desc: Use image node_id 8 for calling the CMSharedTransformer obj's underlying member method code with example usage: obj.get_text_embeddings(sample_list) and returns: text_pool