def METHOD_NAME(args):
    # parse config
    config = parse_config(args.config)
    test_config = merge_configs(config, 'test', vars(args))
    print_configs(test_config, "Test")
    use_dali = test_config['TEST'].get('use_dali', False)
    # build model
    test_model = models.get_model(args.model_name, test_config, mode='test')
    test_model.build_input(use_dataloader=False)
    test_model.build_model()
    test_feeds = test_model.feeds()
    test_fetch_list = test_model.fetches()
    place = paddle.CUDAPlace(0) if args.use_gpu else paddle.CPUPlace()
    exe = static.Executor(place)
    exe.run(static.default_startup_program())
    if args.weights:
        assert os.path.exists(
            args.weights), "Given weight dir {} not exist.".format(args.weights)
    weights = args.weights or test_model.get_weights()
    logger.info('load test weights from {}'.format(weights))
    test_model.load_test_weights(exe, weights, static.default_main_program())
    # get reader and metrics
    test_reader = get_reader(args.model_name.upper(), 'test', test_config)
    test_metrics = get_metrics(args.model_name.upper(), 'test', test_config)
    test_feeder = paddle.fluid.DataFeeder(place=place, feed_list=test_feeds)
    epoch_period = []
    for test_iter, data in enumerate(test_reader()):
        cur_time = time.time()
        test_outs = exe.run(fetch_list=test_fetch_list,
                            feed=test_feeder.feed(data))
        period = time.time() - cur_time
        epoch_period.append(period)
        test_metrics.accumulate(test_outs)
        # metric here
        if args.log_interval > 0 and test_iter % args.log_interval == 0:
            info_str = '[EVAL] Batch {}'.format(test_iter)
            test_metrics.calculate_and_log_out(test_outs, info_str)
    if not os.path.isdir(args.save_dir):
        os.makedirs(args.save_dir)
    test_metrics.finalize_and_log_out("[EVAL] eval finished. ", args.save_dir)