def METHOD_NAME(args, tokenizer, is_test):
    """Provide metrics callback function."""
    def single_dataset_provider(split):
        if args.task.lower() == 'blank':
            return BlankLMDataset(args, split=split, tokenizer=tokenizer)
        elif args.task.lower() == 'extraction':
            return ExtractionDataset(args, split=split, tokenizer=tokenizer)
        else:
            return Seq2SeqDataset(args, split=split, tokenizer=tokenizer)
    if args.task.lower() in ['blank', 'extraction']:
        evaluater = BlankLMEvaluater(args, tokenizer)
        eval_func = evaluater.evaluate
        metric_dict = {}
    else:
        evaluater = DecoderEvaluater(args, tokenizer)
        eval_func = evaluater.evaluate
        if args.tokenizer_type == 'BertWordPieceTokenizer':
            dataset = 'cnn_dm'
        elif args.task.lower() == 'gigaword':
            dataset = 'gigaword'
        else:
            dataset = 'cnn_dm_org'
        metric_dict = OrderedDict({
            'rouge-1':
            functools.partial(rouge_metric, metric='rouge-1', dataset=dataset),
            'rouge-2':
            functools.partial(rouge_metric, metric='rouge-2', dataset=dataset),
            'rouge-l':
            functools.partial(rouge_metric, metric='rouge-l', dataset=dataset)
        })
    def output_func(predictions, examples, output_file):
        with open(output_file + '.hyps', 'w', encoding='utf-8') as output:
            for prediction in predictions:
                output.write(prediction)
                output.write('\n')
        with open(output_file + '.refs', 'w', encoding='utf-8') as output:
            for example in examples:
                output.write(example.meta['ref'])
                output.write('\n')
        if args.task.lower() == 'squad_generation':
            with open(
                    output_file + '.source', 'w', encoding='utf-8') as output:
                for example in examples:
                    output.write(
                        example.text_a.replace('\n', ' ') + ' Answer: '
                        + example.meta['answer'])
                    output.write('\n')
    return accuracy_func_provider(
        single_dataset_provider,
        metric_dict,
        args,
        is_test=is_test,
        eval_func=eval_func,
        output_func=output_func,
        only_rank0=False)