コード例 #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}