code: def run(dataset: Dataset, config: TaskConfig):
      validate_config(config)
      tuner = NNITuner(config)
      if config.framework_params["limit_type"] == "time":
          log.info(
              "Tuning {} with NNI {} with a maximum time of {}s\n".format(
                  config.framework_params["arch_type"],
                  tuner.description,
                  config.max_runtime_seconds,
              )
          )
      elif config.framework_params["limit_type"] == "ntrials":
          log.info(
              "Tuning {} with NNI {} with a maximum number of trials of {}\n".format(
                  config.framework_params["arch_type"],
                  tuner.description,
                  config.framework_params["trial_limit"],
              )
          )
          log.info("Note: any time constraints are ignored.")
  
      (
          probabilities,
          predictions,
          train_timer,
          y_test,
          intermediate_scores,
          intermediate_best_scores,
      ) = run_experiment(dataset, config, tuner, log)
  
      save_predictions_to_file(
          dataset=dataset,
          output_file=config.output_predictions_file,
          probabilities=probabilities,
          predictions=predictions,
          truth=y_test,
      )
  
      scores_file = (
          "/".join(config.output_predictions_file.split("/")[:-3])
          + "/scorelogs/"
          + config.output_predictions_file.split("/")[-1]
      )
      assert len(intermediate_scores) == len(intermediate_best_scores)
      save_scores_to_file(
          intermediate_scores, intermediate_best_scores, scores_file
      )
  
      return dict(
          models_count=1, training_duration=train_timer.duration
      )
  
file_path: nni/examples/trials/benchmarking/automlbenchmark/nni/extensions/NNI/exec.py
imports: import logging
  from .tuners import NNITuner
  from .run_experiment import *
  from amlb.benchmark import TaskConfig
  from amlb.data import Dataset
  from amlb.results import save_predictions_to_file
  from amlb.utils import Timer
label_desc: Use image node_id 3 for calling a global function with example usage: run(dataset, config) and returns: dict