MedRAG/wikipedia
收藏The Wikipedia Corpus in MedRAG
数据集描述
该数据集包含从维基百科语料库中提取的片段,用于MedRAG中的医疗检索增强生成(RAG)任务。维基百科作为一个大规模的开源百科全书,常用于信息检索任务。我们选择维基百科作为语料库之一,以探索通用领域数据库是否能提升医疗问答的能力。我们从HuggingFace下载了处理过的维基百科数据,并使用LangChain将文本分割成不超过1000个字符的片段。该数据集包含29,913,202个片段,平均每个片段包含162个词。
数据集结构
每个片段包含以下特征:
- id: 片段的唯一标识符
- title: 片段来源的维基百科文章标题
- content: 片段内容
- contents: title和content的连接,将用于BM25检索器
使用方法
直接使用
可以通过以下命令克隆数据集: shell git clone https://huggingface.co/datasets/MedRAG/wikipedia
在MedRAG中使用
示例代码如下: python
from src.medrag import MedRAG
question = "A lesion causing compression of the facial nerve at the stylomastoid foramen will cause ipsilateral" options = { "A": "paralysis of the facial muscles.", "B": "paralysis of the facial muscles and loss of taste.", "C": "paralysis of the facial muscles, loss of taste and lacrimation.", "D": "paralysis of the facial muscles, loss of taste, lacrimation and decreased salivation." }
medrag = MedRAG(llm_name="OpenAI/gpt-3.5-turbo-16k", rag=True, retriever_name="MedCPT", corpus_name="Wikipedia") answer, snippets, scores = medrag.answer(question=question, options=options, k=32) # scores are given by the retrieval system
引用
shell @article{xiong2024benchmarking, title={Benchmarking Retrieval-Augmented Generation for Medicine}, author={Guangzhi Xiong and Qiao Jin and Zhiyong Lu and Aidong Zhang}, journal={arXiv preprint arXiv:2402.13178}, year={2024} }




