qaap
1.0.0

pip install -r requirements.txtmain.py 에서 OpenAI API 키를 설정하십시오TimeQA 실험을 실행하십시오
python main.py
--prompt_file timeqa.json
--given_context 1
--dataset timeqa
--data_file test_hard.jsonl
--max_slice_length 512
--slice_stride 384
--return_search_passage content
--model_name gpt-3.5-turbo
--resume_id -1
실행 실험 및 시간 퀘스트 실험을 실행하십시오
python main.py
--prompt_file timequestions.json
--given_context 0
--dataset tempquestion
--data_file test.jsonl
--max_slice_length 512
--slice_stride 384
--return_search_passage content
--model_name gpt-3.5-turbo
--resume_id -1
출력은 모양이되어야합니다
0 Joachim Löw was the coach of which team between Jan 1997 and Aug 1997?
'''python
query = {"subject": "Joachim Löw", "relation": "coach of", "object": None, "time": {"start": datetime(1997, 1, 1), "end": datetime(1997, 8, 31)}}
answer_key = "object"
'''
Search:
'''python
entities_to_search = ["Joachim Löw"]
'''
--------------------------------------------------
Generate a background document from Wikipedia to answer the given question:Joachim Löw is a German football coach and former player. He was the head coach of VfB Stuttgart from July 1996 to October 1998.
Extract information relevant to the query:
'''python
information.append({"subject": "Joachim Löw", "relation": "coach of", "object": "VfB Stuttgart", "time": {"start": datetime(1996, 7, 1), "end": datetime(1998, 10, 31)}})
'''
**************************************************
Extract information relevant to the query:
'''python
information.append({"subject": "Joachim Löw", "relation": "coach of", "object": None, "time": {"start": datetime(1997, 1, 1), "end": datetime(1997, 8, 31)}})
'''
...
calc_metrics_with_check_and_match.py 에서 file_path 설정하고 실행하십시오.
이 작업에서 우리는 시간이 제한된 QA에 중점을 둡니다. 그러나 우리의 프레임 워크를 수정하여 다른 제한된 기반 QA 작업으로 일반화 할 수 있습니다. 열쇠는 제약 조건을 파이썬 클래스로 정의하는 것입니다.이 조건은 제약 조건이 얼마나 잘 충족되는지를 측정하고 calc_metrics_with_check_and_match.py 에서 match 함수를 재정의하는 방법을 측정 할 수 있어야합니다.
gpt-3.5-turbo-0301 로 모든 실험을 실행합니다. 그러나 gpt-3.5-turbo-0613 및 gpt-3.5-turbo-1106 과 같은 업데이트 된 버전은 다른 동작을 가지고 있으며, 텍스트 내 학습 능력이 저하되어 작업을 올바르게 수행 할 수 없습니다.
QAAP가 흥미 롭거나 유용하다고 생각되면 신문을 인용 하고이 repo를 별표로 해주세요. 감사합니다! [email protected]에 문의하거나 궁금한 점이 있으면 문제를여십시오.
@article { zhu2023qaap ,
title = { Question Answering as Programming for Solving Time-Sensitive Questions } ,
author = { Zhu, Xinyu and Yang, Cheng and Chen, Bei and Li, Siheng and Lou, Jian-Guang and Yang, Yujiu } ,
journal = { arXiv preprint arXiv:2305.14221 } ,
year = { 2023 }
}