Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,75 @@
|
|
1 |
---
|
2 |
license: cc
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
library_name: transformers
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- medical
|
9 |
---
|
10 |
+
# MedAlpaca 13b
|
11 |
+
|
12 |
+
|
13 |
+
## Table of Contents
|
14 |
+
|
15 |
+
[Model Description](#model-description)
|
16 |
+
- [Architecture](#architecture)
|
17 |
+
- [Training Data](#trainig-data)
|
18 |
+
[Model Usage](#model-usage)
|
19 |
+
[Limitations](#limitations)
|
20 |
+
|
21 |
+
## Model Description
|
22 |
+
### Architecture
|
23 |
+
`medalpaca-13b` is a large language model specifically fine-tuned for medical domain tasks.
|
24 |
+
It is based on LLaMA (Large Language Model Meta AI) and contains 13 billion parameters.
|
25 |
+
The primary goal of this model is to improve question-answering and medical dialogue tasks.
|
26 |
+
|
27 |
+
### Training Data
|
28 |
+
The training data for this project was sourced from various resources.
|
29 |
+
Firstly, we used Anki flashcards to automatically generate questions,
|
30 |
+
from the front of the cards and anwers from the back of the card.
|
31 |
+
Secondly, we generated medical question-answer pairs from [Wikidoc](https://www.wikidoc.org/index.php/Main_Page).
|
32 |
+
We extracted paragraphs with relevant headings, and used Chat-GPT 3.5
|
33 |
+
to generate questions from the headings and using the corresponding paragraphs
|
34 |
+
as answers. This dataset is still under development and we believe
|
35 |
+
that approximately 70% of these question answer pairs are factual correct.
|
36 |
+
Thirdly, we used StackExchange to extract question-answer pairs, taking the
|
37 |
+
top-rated question from five categories: Academia, Bioinformatics, Biology,
|
38 |
+
Fitness, and Health. Additionally, we used a dataset from [ChatDoctor](https://arxiv.org/abs/2303.14070)
|
39 |
+
consisting of 200,000 question-answer pairs, available at https://github.com/Kent0n-Li/ChatDoctor.
|
40 |
+
|
41 |
+
| Source | n items |
|
42 |
+
|------------------------------|--------|
|
43 |
+
| ChatDoc large | 200000 |
|
44 |
+
| wikidoc | 67704 |
|
45 |
+
| Stackexchange academia | 40865 |
|
46 |
+
| Anki flashcards | 33955 |
|
47 |
+
| Stackexchange biology | 27887 |
|
48 |
+
| Stackexchange fitness | 9833 |
|
49 |
+
| Stackexchange health | 7721 |
|
50 |
+
| Wikidoc patient information | 5942 |
|
51 |
+
| Stackexchange bioinformatics | 5407 |
|
52 |
+
|
53 |
+
## Model Usage
|
54 |
+
To evaluate the performance of the model on a specific dataset, you can use the Hugging Face Transformers library's built-in evaluation scripts. Please refer to the evaluation guide for more information.
|
55 |
+
Inference
|
56 |
+
|
57 |
+
You can use the model for inference tasks like question-answering and medical dialogues using the Hugging Face Transformers library. Here's an example of how to use the model for a question-answering task:
|
58 |
+
|
59 |
+
```python
|
60 |
+
|
61 |
+
from transformers import pipeline
|
62 |
+
|
63 |
+
qa_pipeline = pipeline("question-answering", model="medalpaca/medalpaca-7b", tokenizer="medalpaca/medalpaca-7b")
|
64 |
+
question = "What are the symptoms of diabetes?"
|
65 |
+
context = "Diabetes is a metabolic disease that causes high blood sugar. The symptoms include increased thirst, frequent urination, and unexplained weight loss."
|
66 |
+
answer = qa_pipeline({"question": question, "context": context})
|
67 |
+
print(answer)
|
68 |
+
```
|
69 |
+
|
70 |
+
## Limitations
|
71 |
+
The model may not perform effectively outside the scope of the medical domain.
|
72 |
+
The training data primarily targets the knowledge level of medical students,
|
73 |
+
which may result in limitations when addressing the needs of board-certified physicians.
|
74 |
+
The model has not been tested in real-world applications, so its efficacy and accuracy are currently unknown.
|
75 |
+
It should never be used as a substitute for a doctor's opinion and must be treated as a research tool only.
|