code: def auto_generator(config_obj):
      r"""
      Automatic create task generator to apply transformations, subpopulations
      and adversarial attacks.
  
      :param textflint.Config config_obj: Config instance.
      :return: textflint.Generator
  
      """
      # get references of different nlp task Configs
      assert isinstance(
          config_obj, Config
      ), f"Cant initialize generator with {config_obj}"
      generator_map = task_class_load(
          GENERATOR_PATH, nlp_tasks, Generator, filter_str="_generator"
      )
      task = config_obj.task
  
      if task.upper() not in generator_map:
          logger.warning(
              f"Do not support task: {task}, "
              f"default utilize UT generator."
          )
          generator_obj = UTGenerator(**config_obj.to_dict())
      else:
          generator_obj = generator_map[task.upper()](
              **config_obj.to_dict()
          )
  
      return generator_obj
  
file_path: textflint/textflint/adapter.py
imports: import os
  from .input.config import Config
  from .common import logger
  from .input.dataset import Dataset
  from .input.model import FlintModel
  from .common.utils import task_class_load
  from .common.utils.load import load_module_from_file
  from .generation.generator import Generator, UTGenerator
  from .common.settings import GENERATOR_PATH, NLP_TASK_MAP
  from .report.report_generator import ReportGenerator
label_desc: Use image node_id 2 for calling a global function with example usage: auto_generator(config_obj) and returns: generator_obj