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並執行它。
在這項工作中,我們專注於時間約束的質量檢查。但是,我們可以修改我們的框架以推廣到其他基於受限的質量質量質量標準任務。關鍵是將約束定義為python類,應該能夠測量約束的滿足程度,並重新定義calc_metrics_with_check_and_match.py中的match函數。
我們使用gpt-3.5-turbo-0301運行所有實驗。但是,我們發現更新的版本(例如gpt-3.5-turbo-0613和gpt-3.5-turbo-1106具有不同的行為,其中下文學習能力被降低並且無法正確執行任務。
請引用紙張,並在此倉庫中出演QAAP有趣或有用的話,謝謝!如果您有任何疑問,請隨時聯繫[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 }
}