munish0838 commited on
Commit
c3efb8d
1 Parent(s): 49c5aef

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +232 -0
README.md ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: sethuiyer/Medichat-Llama3-8B
3
+ library_name: transformers
4
+ tags:
5
+ - mergekit
6
+ - merge
7
+ - medical
8
+ license: other
9
+ datasets:
10
+ - mlabonne/orpo-dpo-mix-40k
11
+ - Open-Orca/SlimOrca-Dedup
12
+ - jondurbin/airoboros-3.2
13
+ - microsoft/orca-math-word-problems-200k
14
+ - m-a-p/Code-Feedback
15
+ - MaziyarPanahi/WizardLM_evol_instruct_V2_196k
16
+ - ruslanmv/ai-medical-chatbot
17
+ model-index:
18
+ - name: Medichat-Llama3-8B
19
+ results:
20
+ - task:
21
+ type: text-generation
22
+ name: Text Generation
23
+ dataset:
24
+ name: AI2 Reasoning Challenge (25-Shot)
25
+ type: ai2_arc
26
+ config: ARC-Challenge
27
+ split: test
28
+ args:
29
+ num_few_shot: 25
30
+ metrics:
31
+ - type: acc_norm
32
+ value: 59.13
33
+ name: normalized accuracy
34
+ source:
35
+ url: >-
36
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
37
+ name: Open LLM Leaderboard
38
+ - task:
39
+ type: text-generation
40
+ name: Text Generation
41
+ dataset:
42
+ name: HellaSwag (10-Shot)
43
+ type: hellaswag
44
+ split: validation
45
+ args:
46
+ num_few_shot: 10
47
+ metrics:
48
+ - type: acc_norm
49
+ value: 82.9
50
+ name: normalized accuracy
51
+ source:
52
+ url: >-
53
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
54
+ name: Open LLM Leaderboard
55
+ - task:
56
+ type: text-generation
57
+ name: Text Generation
58
+ dataset:
59
+ name: MMLU (5-Shot)
60
+ type: cais/mmlu
61
+ config: all
62
+ split: test
63
+ args:
64
+ num_few_shot: 5
65
+ metrics:
66
+ - type: acc
67
+ value: 60.35
68
+ name: accuracy
69
+ source:
70
+ url: >-
71
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
72
+ name: Open LLM Leaderboard
73
+ - task:
74
+ type: text-generation
75
+ name: Text Generation
76
+ dataset:
77
+ name: TruthfulQA (0-shot)
78
+ type: truthful_qa
79
+ config: multiple_choice
80
+ split: validation
81
+ args:
82
+ num_few_shot: 0
83
+ metrics:
84
+ - type: mc2
85
+ value: 49.65
86
+ source:
87
+ url: >-
88
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
89
+ name: Open LLM Leaderboard
90
+ - task:
91
+ type: text-generation
92
+ name: Text Generation
93
+ dataset:
94
+ name: Winogrande (5-shot)
95
+ type: winogrande
96
+ config: winogrande_xl
97
+ split: validation
98
+ args:
99
+ num_few_shot: 5
100
+ metrics:
101
+ - type: acc
102
+ value: 78.93
103
+ name: accuracy
104
+ source:
105
+ url: >-
106
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
107
+ name: Open LLM Leaderboard
108
+ - task:
109
+ type: text-generation
110
+ name: Text Generation
111
+ dataset:
112
+ name: GSM8k (5-shot)
113
+ type: gsm8k
114
+ config: main
115
+ split: test
116
+ args:
117
+ num_few_shot: 5
118
+ metrics:
119
+ - type: acc
120
+ value: 60.35
121
+ name: accuracy
122
+ source:
123
+ url: >-
124
+ https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard?query=sethuiyer/Medichat-Llama3-8B
125
+ name: Open LLM Leaderboard
126
+ language:
127
+ - en
128
+ pipeline_tag: text-generation
129
+ ---
130
+
131
+ # Medichat-Llama3-8B-GGUF
132
+ This is quantized version of [sethuiyer/Medichat-Llama3-8B](https://huggingface.co/sethuiyer/Medichat-Llama3-8B) created using llama.cpp
133
+
134
+ # Model Description
135
+
136
+ Built upon the powerful LLaMa-3 architecture and fine-tuned on an extensive dataset of health information, this model leverages its vast medical knowledge to offer clear, comprehensive answers.
137
+
138
+ This model is generally better for accurate and informative responses, particularly for users seeking in-depth medical advice.
139
+
140
+
141
+ The following YAML configuration was used to produce this model:
142
+
143
+ ```yaml
144
+
145
+ models:
146
+ - model: Undi95/Llama-3-Unholy-8B
147
+ parameters:
148
+ weight: [0.25, 0.35, 0.45, 0.35, 0.25]
149
+ density: [0.1, 0.25, 0.5, 0.25, 0.1]
150
+ - model: Locutusque/llama-3-neural-chat-v1-8b
151
+ - model: ruslanmv/Medical-Llama3-8B-16bit
152
+ parameters:
153
+ weight: [0.55, 0.45, 0.35, 0.45, 0.55]
154
+ density: [0.1, 0.25, 0.5, 0.25, 0.1]
155
+ merge_method: dare_ties
156
+ base_model: Locutusque/llama-3-neural-chat-v1-8b
157
+ parameters:
158
+ int8_mask: true
159
+ dtype: bfloat16
160
+
161
+ ```
162
+
163
+ # Comparision Against Dr.Samantha 7B
164
+
165
+ | Subject | Medichat-Llama3-8B Accuracy (%) | Dr. Samantha Accuracy (%) |
166
+ |-------------------------|---------------------------------|---------------------------|
167
+ | Clinical Knowledge | 71.70 | 52.83 |
168
+ | Medical Genetics | 78.00 | 49.00 |
169
+ | Human Aging | 70.40 | 58.29 |
170
+ | Human Sexuality | 73.28 | 55.73 |
171
+ | College Medicine | 62.43 | 38.73 |
172
+ | Anatomy | 64.44 | 41.48 |
173
+ | College Biology | 72.22 | 52.08 |
174
+ | High School Biology | 77.10 | 53.23 |
175
+ | Professional Medicine | 63.97 | 38.73 |
176
+ | Nutrition | 73.86 | 50.33 |
177
+ | Professional Psychology | 68.95 | 46.57 |
178
+ | Virology | 54.22 | 41.57 |
179
+ | High School Psychology | 83.67 | 66.60 |
180
+ | **Average** | **70.33** | **48.85** |
181
+
182
+
183
+ The current model demonstrates a substantial improvement over the previous [Dr. Samantha](sethuiyer/Dr_Samantha-7b) model in terms of subject-specific knowledge and accuracy.
184
+
185
+ ### Usage:
186
+ ```python
187
+ import torch
188
+ from transformers import AutoTokenizer, AutoModelForCausalLM
189
+
190
+ class MedicalAssistant:
191
+ def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
192
+ self.device = device
193
+ self.tokenizer = AutoTokenizer.from_pretrained(model_name)
194
+ self.model = AutoModelForCausalLM.from_pretrained(model_name).to(self.device)
195
+ self.sys_message = '''
196
+ You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
197
+ provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
198
+ '''
199
+
200
+ def format_prompt(self, question):
201
+ messages = [
202
+ {"role": "system", "content": self.sys_message},
203
+ {"role": "user", "content": question}
204
+ ]
205
+ prompt = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
206
+ return prompt
207
+
208
+ def generate_response(self, question, max_new_tokens=512):
209
+ prompt = self.format_prompt(question)
210
+ inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
211
+ with torch.no_grad():
212
+ outputs = self.model.generate(**inputs, max_new_tokens=max_new_tokens, use_cache=True)
213
+ answer = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip()
214
+ return answer
215
+
216
+ if __name__ == "__main__":
217
+ assistant = MedicalAssistant()
218
+ question = '''
219
+ Symptoms:
220
+ Dizziness, headache, and nausea.
221
+
222
+ What is the differential diagnosis?
223
+ '''
224
+ response = assistant.generate_response(question)
225
+ print(response)
226
+
227
+ ```
228
+
229
+ ## Ollama
230
+ This model is now also available on Ollama. You can use it by running the command ```ollama run monotykamary/medichat-llama3``` in your
231
+ terminal. If you have limited computing resources, check out this [video](https://www.youtube.com/watch?v=Qa1h7ygwQq8) to learn how to run it on
232
+ a Google Colab backend.