code: def run_training(params, task_id, local=False, wait=False):
      params = json.loads(params)
      logger.info(params)
      if isinstance(params, str):
          params = json.loads(params)
      if task_id == 9:
          params = LLMTrainingParams(**params)
      elif task_id == 28:
          params = Seq2SeqParams(**params)
      elif task_id in (1, 2):
          params = TextClassificationParams(**params)
      elif task_id in (13, 14, 15, 16, 26):
          params = TabularParams(**params)
      elif task_id == 27:
          params = GenericParams(**params)
      elif task_id == 25:
          params = DreamBoothTrainingParams(**params)
      elif task_id == 18:
          params = ImageClassificationParams(**params)
      else:
          raise NotImplementedError
  
      if not local:
          params.project_name = "/tmp/model"
      params.save(output_dir=params.project_name)
      cmd = launch_command(params=params)
  
      cmd = [str(c) for c in cmd]
      logger.info(cmd)
      env = os.environ.copy()
      process = subprocess.Popen(" ".join(cmd), shell=True, env=env)
      if wait:
          process.wait()
      return process.pid
  
imports: import json
  import os
  import signal
  import socket
  import subprocess
  import psutil
  import requests
  from autotrain import config, logger
  from autotrain.commands import launch_command
  from autotrain.trainers.clm.params import LLMTrainingParams
  from autotrain.trainers.dreambooth.params import DreamBoothTrainingParams
  from autotrain.trainers.generic.params import GenericParams
  from autotrain.trainers.image_classification.params import ImageClassificationParams
  from autotrain.trainers.seq2seq.params import Seq2SeqParams
  from autotrain.trainers.tabular.params import TabularParams
  from autotrain.trainers.text_classification.params import TextClassificationParams
label_desc: Use image node_id 9 for calling a global function with example usage: run_training(params, task_id, local, wait) and returns: process