def decoding_eval(logger, sample_result, sample_size, random_seed, global_step, epoch):
    np.random.seed(random_seed)
    sample_ids = np.random.randint(0, (len(sample_result) - 1), size=sample_size)
    sample_data = [sample_result[sample_id] for sample_id in sample_ids]
    eval_result_list = []
    for sample in sample_data:
        sample_input = sample
        sample_output = sample['predict']['text']
        sample_reference_list = []
        for answer in sample['answers']:
            sample_reference = answer['text']
            sample_reference_list.append(sample_reference)
        eval_result = DecodingEvalLog(sample_input=sample_input, sample_output=sample_output, sample_reference=sample_reference_list)
        eval_result_list.append(eval_result)
    basic_info = BasicInfoEvalLog(epoch=epoch, global_step=global_step)
    logger.update_decoding_eval(eval_result_list, basic_info)
    logger.check_decoding_eval()
def decoding_eval(logger, sample_result, sample_size, random_seed, global_step, epoch):
    np.random.seed(random_seed)
    sample_ids = np.random.randint(0, (len(sample_result) - 1), size=sample_size)
    sample_data = [sample_result[sample_id] for sample_id in sample_ids]
    eval_result_list = []
    for sample in sample_data:
        sample_input = sample
        sample_output = sample['predict']['text']
        sample_reference_list = []
        for answer in sample['answers']:
            sample_reference = answer['text']
            sample_reference_list.append(sample_reference)
        eval_result = DecodingEvalLog(sample_input=sample_input, sample_output=sample_output, sample_reference=sample_reference_list)
        eval_result_list.append(eval_result)
    basic_info = BasicInfoEvalLog(epoch=epoch, global_step=global_step)
    logger.update_decoding_eval(eval_result_list, basic_info)
    logger.check_decoding_eval()