code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "input_dir", help="Path to extracted NDS data dir."
      )
      args = parser.parse_args()
  
      sweep_list = [
          "Amoeba.json",
          "Amoeba_in.json",
          "DARTS.json",
          "DARTS_fix-w-d.json",
          "DARTS_in.json",
          "DARTS_lr-wd.json",
          "DARTS_lr-wd_in.json",
          "ENAS.json",
          "ENAS_fix-w-d.json",
          "ENAS_in.json",
          "NASNet.json",
          "NASNet_in.json",
          "PNAS.json",
          "PNAS_fix-w-d.json",
          "PNAS_in.json",
          "ResNeXt-A.json",
          "ResNeXt-A_in.json",
          "ResNeXt-B.json",
          "ResNeXt-B_in.json",
          "ResNet-B.json",
          "ResNet.json",
          "ResNet_lr-wd.json",
          "ResNet_lr-wd_in.json",
          "ResNet_reruns.json",
          "ResNet_rng1.json",
          "ResNet_rng2.json",
          "ResNet_rng3.json",
          "Vanilla.json",
          "Vanilla_lr-wd.json",
          "Vanilla_lr-wd_in.json",
          "Vanilla_reruns.json",
          "Vanilla_rng1.json",
          "Vanilla_rng2.json",
          "Vanilla_rng3.json",
      ]
  
      db = load_benchmark("nds")
  
      with db:
          db.create_tables(
              [NdsTrialConfig, NdsTrialStats, NdsIntermediateStats]
          )
          for json_idx, json_file in enumerate(sweep_list, start=1):
              if "fix-w-d" in json_file:
                  generator = "fix_w_d"
              elif "lr-wd" in json_file:
                  generator = "tune_lr_wd"
              else:
                  generator = "random"
              if "_in" in json_file:
                  dataset = "imagenet"
              else:
                  dataset = "cifar10"
              proposer = json_file.split(".")[0].split("_")[0].lower()
              with open(
                  os.path.join(args.input_dir, json_file), "r"
              ) as f:
                  data = json.load(f)
              if "top" in data and "mid" in data:
                  for t in tqdm.tqdm(
                      data["top"],
                      desc="[{}/{}] Processing {} (top)".format(
                          json_idx, len(sweep_list), json_file
                      ),
                  ):
                      inject_item(db, t, proposer, dataset, generator)
                  for t in tqdm.tqdm(
                      data["mid"],
                      desc="[{}/{}] Processing {} (mid)".format(
                          json_idx, len(sweep_list), json_file
                      ),
                  ):
                      inject_item(db, t, proposer, dataset, generator)
              else:
                  for job in tqdm.tqdm(
                      data,
                      desc="[{}/{}] Processing {}".format(
                          json_idx, len(sweep_list), json_file
                      ),
                  ):
                      inject_item(db, job, proposer, dataset, generator)
  
file_path: nni/nni/nas/benchmark/nds/db_gen.py
imports: import json
  import argparse
  import os
  import numpy
  import tqdm
  from nni.nas.benchmark.utils import load_benchmark
  from .schema import NdsTrialConfig, NdsTrialStats, NdsIntermediateStats
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types