class_docstr: The ``TextEmbedder`` is a :class:`~flash.Task` for generating sentence embeddings, training and validation. For
  more details, see `embeddings`.
  
  You can change the backbone to any question answering model from `UKPLab/sentence-transformers
  <https://github.com/UKPLab/sentence-transformers>`_ using the ``backbone``
  argument.
  
  Args:
      backbone: backbone model to use for the task.
      enable_ort: Enable Torch ONNX Runtime Optimization: https://onnxruntime.ai/docs/#onnx-runtime-for-training
docstr: Adapted from sentence-transformers:
  
  https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/models/Transformer.py#L45
docstr_tok: ["Adapted","from","sentence-transformers",":","https",":","\/\/github.com\/UKPLab\/sentence-transformers\/blob\/master\/sentence_transformers\/models\/Transformer.py","#","L45"]
code: def forward(self, batch: Dict[str, Tensor]) -> Tensor:
      """Adapted from sentence-transformers:
  
      https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/models/Transformer.py#L45
      """
      attention_mask = batch.get("attention_mask", None)
      if attention_mask is None:
          attention_mask = torch.ones_like(batch["input_ids"])
  
      trans_features = {
          "input_ids": batch["input_ids"],
          "attention_mask": attention_mask,
      }
      if "token_type_ids" in batch:
          trans_features["token_type_ids"] = batch["token_type_ids"]
  
      output_states = self.model(**trans_features, return_dict=False)
      output_tokens = output_states[0]
  
      batch.update(
          {
              "token_embeddings": output_tokens,
              "attention_mask": attention_mask,
          }
      )
  
      return self.pooling(batch)["sentence_embedding"]
  
imports: import logging
  import os
  import warnings
  from typing import Any, Dict, List, Optional
  import torch
  from pytorch_lightning import Callback
  from torch import Tensor
  from flash.core.model import Task
  from flash.core.registry import FlashRegistry, print_provider_info
  from flash.core.utilities.imports import _TOPIC_TEXT_AVAILABLE
  from flash.core.utilities.providers import _SENTENCE_TRANSFORMERS
  from flash.text.classification.collate import TextClassificationCollate
  from flash.text.embedding.backbones import HUGGINGFACE_BACKBONES
  from flash.text.ort_callback import ORTCallback
label_desc: Use image node_id 5 for calling the TextEmbedder obj's underlying member method code with example usage: obj.forward(batch) and returns: self