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 }
}