docstr: Embed a single text string.
  
  Primarily used for on-the-fly embeddings, particularly during
  analysis or debugging. For large scale, use 'embed_text_dataset()'.
docstr_tok: ["Embed","a","single","text","string",".","Primarily","used","for","on-the-fly","embeddings",",","particularly","during","analysis","or","debugging",".","For","large","scale",",","use","'embed_text_dataset","(",")","'","."]
code: def embed_text(self, text):
      """Embed a single text string.
  
      Primarily used for on-the-fly embeddings, particularly during
      analysis or debugging. For large scale, use 'embed_text_dataset()'.
      """
  
      class SingleTextDataset(torch.utils.data.Dataset):
          """Dataset that holds single string."""
  
          def __init__(self, text):
              assert isinstance(text, str)
              self.text = text
  
          def __len__(self):
              return 1
  
          def __getitem__(self, i):
              return {"text": self.text}
  
      # Embed text.
      text_ds = SingleTextDataset(text)
      embed = self.embed_text_dataset(text_ds, verbose=False)[0]
  
      return embed
  
file_path: megatron-lm/tools/bert_embedding/huggingface.py
imports: import numpy
  import torch
  from tqdm import tqdm
  from .external_libs import transformers
label_desc: Use image node_id 3 for calling the HuggingfaceEmbedder obj's underlying member method code with example usage: obj.embed_text(text) and returns: embed, int, dict