code: def main():
      global global_config
      all_config = load_slim_config(FLAGS.config_path)
      assert (
          "Global" in all_config
      ), "Key 'Global' not found in config file."
      global_config = all_config["Global"]
      reader_cfg = load_config(global_config["reader_config"])
  
      train_loader = create("EvalReader")(
          reader_cfg["TrainDataset"],
          reader_cfg["worker_num"],
          return_list=True,
      )
      if global_config.get("input_list") is None:
          global_config["input_list"] = get_feed_vars(
              global_config["model_dir"],
              global_config["model_filename"],
              global_config["params_filename"],
          )
      train_loader = reader_wrapper(
          train_loader, global_config["input_list"]
      )
  
      if (
          "Evaluation" in global_config.keys()
          and global_config["Evaluation"]
          and paddle.distributed.get_rank() == 0
      ):
          eval_func = eval_function
          dataset = reader_cfg["EvalDataset"]
          global val_loader
          _eval_batch_sampler = paddle.io.BatchSampler(
              dataset, batch_size=reader_cfg["EvalReader"]["batch_size"]
          )
          val_loader = create("EvalReader")(
              dataset,
              reader_cfg["worker_num"],
              batch_sampler=_eval_batch_sampler,
              return_list=True,
          )
          metric = None
          if reader_cfg["metric"] == "COCO":
              clsid2catid = {
                  v: k for k, v in dataset.catid2clsid.items()
              }
              anno_file = dataset.get_anno()
              metric = COCOMetric(
                  anno_file=anno_file,
                  clsid2catid=clsid2catid,
                  IouType="bbox",
              )
          elif reader_cfg["metric"] == "VOC":
              metric = VOCMetric(
                  label_list=dataset.get_label_list(),
                  class_num=reader_cfg["num_classes"],
                  map_type=reader_cfg["map_type"],
              )
          elif reader_cfg["metric"] == "KeyPointTopDownCOCOEval":
              anno_file = dataset.get_anno()
              metric = KeyPointTopDownCOCOEval(
                  anno_file, len(dataset), 17, "output_eval"
              )
          else:
              raise ValueError(
                  "metric currently only supports COCO and VOC."
              )
          global_config["metric"] = metric
      else:
          eval_func = None
  
      ac = AutoCompression(
          model_dir=global_config["model_dir"],
          model_filename=global_config["model_filename"],
          params_filename=global_config["params_filename"],
          save_dir=FLAGS.save_dir,
          config=all_config,
          train_dataloader=train_loader,
          eval_callback=eval_func,
      )
      ac.compress()
  
file_path: PaddleDetection/deploy/auto_compression/run.py
imports: import os
  import sys
  import numpy
  import argparse
  import paddle
  from ppdet.core.workspace import load_config, merge_config
  from ppdet.core.workspace import create
  from ppdet.metrics import COCOMetric, VOCMetric, KeyPointTopDownCOCOEval
  from paddleslim.auto_compression.config_helpers import load_config
  from paddleslim.auto_compression import AutoCompression
  from post_process import PPYOLOEPostProcess
  from paddleslim.common.dataloader import get_feed_vars
label_desc: Use image node_id 5 for calling a global function with example usage: main() without return types