def METHOD_NAME():
    rank_id = paddle.distributed.get_rank()
    if args.devices == 'gpu':
        paddle.CUDAPlace(rank_id)
        device = paddle.set_device('gpu')
    else:
        paddle.CPUPlace()
        device = paddle.set_device('cpu')
    global global_config
    all_config = load_slim_config(args.config_path)
    assert "Global" in all_config, f"Key 'Global' not found in config file. \n{all_config}"
    global_config = all_config["Global"]
    gpu_num = paddle.distributed.get_world_size()
    if isinstance(all_config['TrainConfig']['learning_rate'],
                  dict) and all_config['TrainConfig']['learning_rate'][
                      'type'] == 'CosineAnnealingDecay':
        step = int(
            math.ceil(
                float(args.total_images) / (global_config['batch_size'] *
                                            gpu_num)))
        all_config['TrainConfig']['learning_rate']['T_max'] = step
        print('total training steps:', step)
    init_logger()
    data_config = config.get_config(global_config['reader_config'], show=False)
    train_loader = build_dataloader(data_config["DataLoader"], "Train", device,
                                    False)
    train_dataloader = reader_wrapper(train_loader, global_config['input_name'])
    global eval_loader
    eval_loader = build_dataloader(data_config["DataLoader"], "Eval", device,
                                   False)
    ac = AutoCompression(
        model_dir=global_config['model_dir'],
        model_filename=global_config['model_filename'],
        params_filename=global_config['params_filename'],
        save_dir=args.save_dir,
        config=all_config,
        train_dataloader=train_dataloader,
        eval_callback=eval_function if rank_id == 0 else None,
        eval_dataloader=reader_wrapper(eval_loader,
                                       global_config['input_name']))
    ac.compress()