code: def train_embedding(*args):
      assert (
          not shared.cmd_opts.lowvram
      ), "Training models with lowvram not possible"
  
      apply_optimizations = (
          shared.opts.training_xattention_optimizations
      )
      try:
          if not apply_optimizations:
              sd_hijack.undo_optimizations()
  
          (
              embedding,
              filename,
          ) = modules.textual_inversion.textual_inversion.train_embedding(
              *args
          )
  
          res = f"""
  Training {'interrupted' if shared.state.interrupted else 'finished'} at {embedding.step} steps.
  Embedding saved to {html.escape(filename)}
  """
          return res, ""
      except Exception:
          raise
      finally:
          if not apply_optimizations:
              sd_hijack.apply_optimizations()
  
imports: import html
  import gradio
  import modules.textual_inversion.textual_inversion
  from modules import sd_hijack, shared
label_desc: Use image node_id 2 for calling a global function with example usage: train_embedding() and returns: res,  str