mav23 commited on
Commit
b5b75b0
1 Parent(s): 76b7407

Upload folder using huggingface_hub

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