Duplicate from MedRAG/textbooks
Browse filesCo-authored-by: MedRAG <MedRAG@users.noreply.huggingface.co>
- .gitattributes +56 -0
- README.md +72 -0
- chunk/Anatomy_Gray.jsonl +3 -0
- chunk/Biochemistry_Lippincott.jsonl +3 -0
- chunk/Cell_Biology_Alberts.jsonl +3 -0
- chunk/First_Aid_Step1.jsonl +3 -0
- chunk/First_Aid_Step2.jsonl +3 -0
- chunk/Gynecology_Novak.jsonl +3 -0
- chunk/Histology_Ross.jsonl +3 -0
- chunk/Immunology_Janeway.jsonl +3 -0
- chunk/InternalMed_Harrison.jsonl +3 -0
- chunk/Neurology_Adams.jsonl +3 -0
- chunk/Obstentrics_Williams.jsonl +3 -0
- chunk/Pathology_Robbins.jsonl +3 -0
- chunk/Pathoma_Husain.jsonl +3 -0
- chunk/Pediatrics_Nelson.jsonl +3 -0
- chunk/Pharmacology_Katzung.jsonl +3 -0
- chunk/Physiology_Levy.jsonl +3 -0
- chunk/Psichiatry_DSM-5.jsonl +3 -0
- chunk/Surgery_Schwartz.jsonl +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
# Audio files - uncompressed
|
| 38 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
# Audio files - compressed
|
| 42 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
# Image files - uncompressed
|
| 48 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
# Image files - compressed
|
| 53 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
*.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
task_categories:
|
| 3 |
+
- question-answering
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- medical
|
| 8 |
+
- question answering
|
| 9 |
+
- large language model
|
| 10 |
+
- retrieval-augmented generation
|
| 11 |
+
size_categories:
|
| 12 |
+
- 100K<n<1M
|
| 13 |
+
---
|
| 14 |
+
# The Textbooks Corpus in MedRAG
|
| 15 |
+
|
| 16 |
+
This HF dataset contains the chunked snippets from the Textbooks corpus used in [MedRAG](https://arxiv.org/abs/2402.13178). It can be used for medical Retrieval-Augmented Generation (RAG).
|
| 17 |
+
|
| 18 |
+
## Dataset Details
|
| 19 |
+
|
| 20 |
+
### Dataset Descriptions
|
| 21 |
+
|
| 22 |
+
[Textbooks](https://github.com/jind11/MedQA) is a collection of 18 widely used medical textbooks, which are important references for students taking the United States Medical Licensing Examination (USLME).
|
| 23 |
+
In MedRAG, the textbooks are processed as chunks with no more than 1000 characters.
|
| 24 |
+
We used the RecursiveCharacterTextSplitter from [LangChain](https://www.langchain.com/) to perform the chunking.
|
| 25 |
+
This HF dataset contains our ready-to-use chunked snippets for the Textbooks corpus, including 125,847 snippets with an average of 182 tokens.
|
| 26 |
+
|
| 27 |
+
### Dataset Structure
|
| 28 |
+
Each row is a snippet of Textbooks, which includes the following features:
|
| 29 |
+
|
| 30 |
+
- id: a unique identifier of the snippet
|
| 31 |
+
- title: the title of the textbook from which the snippet is collected
|
| 32 |
+
- content: the content of the snippet
|
| 33 |
+
- contents: a concatenation of 'title' and 'content', which will be used by the [BM25](https://github.com/castorini/pyserini) retriever
|
| 34 |
+
|
| 35 |
+
## Uses
|
| 36 |
+
|
| 37 |
+
<!-- Address questions around how the dataset is intended to be used. -->
|
| 38 |
+
|
| 39 |
+
### Direct Use
|
| 40 |
+
|
| 41 |
+
<!-- This section describes suitable use cases for the dataset. -->
|
| 42 |
+
|
| 43 |
+
```shell
|
| 44 |
+
git clone https://huggingface.co/datasets/MedRAG/textbooks
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Use in MedRAG
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
>> from src.medrag import MedRAG
|
| 51 |
+
|
| 52 |
+
>> question = "A lesion causing compression of the facial nerve at the stylomastoid foramen will cause ipsilateral"
|
| 53 |
+
>> options = {
|
| 54 |
+
"A": "paralysis of the facial muscles.",
|
| 55 |
+
"B": "paralysis of the facial muscles and loss of taste.",
|
| 56 |
+
"C": "paralysis of the facial muscles, loss of taste and lacrimation.",
|
| 57 |
+
"D": "paralysis of the facial muscles, loss of taste, lacrimation and decreased salivation."
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
>> medrag = MedRAG(llm_name="OpenAI/gpt-3.5-turbo-16k", rag=True, retriever_name="MedCPT", corpus_name="Textbooks")
|
| 61 |
+
>> answer, snippets, scores = medrag.answer(question=question, options=options, k=32) # scores are given by the retrieval system
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Citation
|
| 65 |
+
```shell
|
| 66 |
+
@article{xiong2024benchmarking,
|
| 67 |
+
title={Benchmarking Retrieval-Augmented Generation for Medicine},
|
| 68 |
+
author={Guangzhi Xiong and Qiao Jin and Zhiyong Lu and Aidong Zhang},
|
| 69 |
+
journal={arXiv preprint arXiv:2402.13178},
|
| 70 |
+
year={2024}
|
| 71 |
+
}
|
| 72 |
+
```
|
chunk/Anatomy_Gray.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ee624233f9bd0e1db499233dab824e396398f1c9b5b1a9a391be4aa61c1990b
|
| 3 |
+
size 5189523
|
chunk/Biochemistry_Lippincott.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:baeb945f0b84cb073dfe286af5f9eb4c558a029f1c65a519e74ff425d51cabf6
|
| 3 |
+
size 3190628
|
chunk/Cell_Biology_Alberts.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e281aaf151aac1bc2e893e89f5a28bb52c4e0fd29ce94a323940d47b23909f5d
|
| 3 |
+
size 11366263
|
chunk/First_Aid_Step1.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b6b3e1256d09481cd6caacf70732aa1ef58c934ff957a7228efa0f2a3a2af81
|
| 3 |
+
size 1603285
|
chunk/First_Aid_Step2.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:49e1a4436f4c72ec94e890e95e16357d6d07e8a4b89cc6490742d621476396c8
|
| 3 |
+
size 2502076
|
chunk/Gynecology_Novak.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75123830fe5c6293b7af05446926d8dc4cf2d2f14b5fd4fc540ef94365902c3e
|
| 3 |
+
size 13255943
|
chunk/Histology_Ross.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c68dcf3e903e648f79c6ef624b0ddfe23c98d8311d7341a005628d67386e57d
|
| 3 |
+
size 7045917
|
chunk/Immunology_Janeway.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c256fecfb8dfdbc8afad1966ba879994009f623bf2b28beb3caf444cd05f47b
|
| 3 |
+
size 7887983
|
chunk/InternalMed_Harrison.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c0f3523c74e99c152cf51aad91928c811dc30918ca9d1c68a24691525ea6bcbb
|
| 3 |
+
size 52628209
|
chunk/Neurology_Adams.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7fe80c8c8d0dab2c6645a00166fdf8dce73a717e2fcf155736f1ecf5a13abfa2
|
| 3 |
+
size 19461783
|
chunk/Obstentrics_Williams.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d8f53df6626566e3b0a8dc30ba76fe4fe3af1995333afcf55f7f569e1ba991fb
|
| 3 |
+
size 15223023
|
chunk/Pathology_Robbins.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc8d58dce0b5b94a42fafc2f47e6c3f2e0f3d86a5842d8fd2e60dc8a835e5045
|
| 3 |
+
size 8653804
|
chunk/Pathoma_Husain.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:827ed8c8a6fb99fe863b230a231208fd2ad62effc3753ba8d17fce31cf8ba2a2
|
| 3 |
+
size 983408
|
chunk/Pediatrics_Nelson.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:701fefb07537888d5062bc6873a5ac7e746867f8eda9c0fc6e14aaeeba96fce3
|
| 3 |
+
size 6836659
|
chunk/Pharmacology_Katzung.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:47b79061f05293173787205e89a083350e0372beb197aceb92d2e3381c4b8334
|
| 3 |
+
size 11923357
|
chunk/Physiology_Levy.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95c7b1972afef628228efd43a032ac83c6101a60b918b835fe24fff5b6b275db
|
| 3 |
+
size 6973357
|
chunk/Psichiatry_DSM-5.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3a7b2232b2dbb642c06fdf8ea8926c8a69aeb05f76b43b7e71d79081b29f7171
|
| 3 |
+
size 6732065
|
chunk/Surgery_Schwartz.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1d682541c9e4704db5fe48d61944a115e204f693e0ca360171c41e44fc3b2c0
|
| 3 |
+
size 30102070
|