예제 #1
0
def main(qa_path, relations_filepath, data_directory, batch_size,
         must_choose_answer, device, trained_to_reject, error_path):
    runner = QARunner(qa_path, relations_filepath, data_directory, batch_size,
                      must_choose_answer, device, trained_to_reject)
    em, f1, per_relation_metrics = runner.predict()
    save_se_list(runner.se_list, error_path)
    return {'em': em, 'f1': f1, 'per_relation_metrics': per_relation_metrics}
예제 #2
0
def main(qa_path, relations_filepath, data_directory, batch_size,
         must_choose_answer, device, trained_to_reject):
    runner = QARunner(qa_path,
                      relations_filepath,
                      data_directory,
                      batch_size,
                      must_choose_answer,
                      device,
                      trained_to_reject,
                      calculate_single_error=False)
    em, f1, per_relation_metrics = runner.predict()
    print(f'Total samples: {runner.total_samples}')
    return {'em': em, 'f1': f1, 'per_relation_metrics': per_relation_metrics}
예제 #3
0
파일: zsre.py 프로젝트: ankur-gos/RE-Flex
def main(qa_path, relations_filepath, data_directory, batch_size,
         must_choose_answer, device, trained_to_reject):
    runner = QARunner(qa_path,
                      relations_filepath,
                      data_directory,
                      batch_size,
                      must_choose_answer,
                      device,
                      trained_to_reject,
                      calculate_single_error=False)
    em, f1, per_relation_metrics = runner.predict()
    with open('BERTZSREZSRE.pkl', 'wb') as wf:
        pickle.dump(per_relation_metrics, wf)
    return {'em': em, 'f1': f1, 'per_relation_metrics': per_relation_metrics}
예제 #4
0
def main(qa_path, relations_filepath, data_directory, batch_size,
         must_choose_answer):
    runner = QARunner(qa_path, relations_filepath, data_directory, batch_size,
                      must_choose_answer)
    em, f1, per_relation_metrics = runner.predict()
    return {'em': em, 'f1': f1, 'per_relation_metrics': per_relation_metrics}