Downloads · 30 days
189
15% of all-time downloads
RichardErkhov/sethuiyer_-_Medichat-Llama3-8B-gguf
sethuiyer_-_Medichat-Llama3-8B-gguf is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
189
15% of all-time downloads
All-time downloads
1.3K
Public
Repo size
92.9 GB
Likes
0
Public
Click a slice to open those files.
.gguf108 GB · 100%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Medichat-Llama3-8B - GGUF
| Name | Quant method | Size |
|---|---|---|
| Medichat-Llama3-8B.Q2_K.gguf | Q2_K | 2.96GB |
| Medichat-Llama3-8B.IQ3_XS.gguf | IQ3_XS | 3.28GB |
| Medichat-Llama3-8B.IQ3_S.gguf | IQ3_S | 3.43GB |
| Medichat-Llama3-8B.Q3_K_S.gguf | Q3_K_S | 3.41GB |
| Medichat-Llama3-8B.IQ3_M.gguf | IQ3_M | 3.52GB |
| Medichat-Llama3-8B.Q3_K.gguf | Q3_K | 3.74GB |
| Medichat-Llama3-8B.Q3_K_M.gguf | Q3_K_M | 3.74GB |
| Medichat-Llama3-8B.Q3_K_L.gguf | Q3_K_L | 4.03GB |
| Medichat-Llama3-8B.IQ4_XS.gguf | IQ4_XS | 4.18GB |
| Medichat-Llama3-8B.Q4_0.gguf | Q4_0 | 4.34GB |
| Medichat-Llama3-8B.IQ4_NL.gguf | IQ4_NL | 4.38GB |
| Medichat-Llama3-8B.Q4_K_S.gguf | Q4_K_S | 4.37GB |
| Medichat-Llama3-8B.Q4_K.gguf | Q4_K | 4.58GB |
| Medichat-Llama3-8B.Q4_K_M.gguf | Q4_K_M | 4.58GB |
| Medichat-Llama3-8B.Q4_1.gguf | Q4_1 | 4.78GB |
| Medichat-Llama3-8B.Q5_0.gguf | Q5_0 | 5.21GB |
| Medichat-Llama3-8B.Q5_K_S.gguf | Q5_K_S | 5.21GB |
| Medichat-Llama3-8B.Q5_K.gguf | Q5_K | 5.34GB |
| Medichat-Llama3-8B.Q5_K_M.gguf | Q5_K_M | 5.34GB |
| Medichat-Llama3-8B.Q5_1.gguf | Q5_1 | 5.65GB |
| Medichat-Llama3-8B.Q6_K.gguf | Q6_K | 6.14GB |
| Medichat-Llama3-8B.Q8_0.gguf | Q8_0 | 7.95GB |
base_model:
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.
This model is generally better for accurate and informative responses, particularly for users seeking in-depth medical advice.
The following YAML configuration was used to produce this model:
models:
- model: Undi95/Llama-3-Unholy-8B
parameters:
weight: [0.25, 0.35, 0.45, 0.35, 0.25]
density: [0.1, 0.25, 0.5, 0.25, 0.1]
- model: Locutusque/llama-3-neural-chat-v1-8b
- model: ruslanmv/Medical-Llama3-8B-16bit
parameters:
weight: [0.55, 0.45, 0.35, 0.45, 0.55]
density: [0.1, 0.25, 0.5, 0.25, 0.1]
merge_method: dare_ties
base_model: Locutusque/llama-3-neural-chat-v1-8b
parameters:
int8_mask: true
dtype: bfloat16
| Subject | Medichat-Llama3-8B Accuracy (%) | Dr. Samantha Accuracy (%) |
|---|---|---|
| Clinical Knowledge | 71.70 | 52.83 |
| Medical Genetics | 78.00 | 49.00 |
| Human Aging | 70.40 | 58.29 |
| Human Sexuality | 73.28 | 55.73 |
| College Medicine | 62.43 | 38.73 |
| Anatomy | 64.44 | 41.48 |
| College Biology | 72.22 | 52.08 |
| High School Biology | 77.10 | 53.23 |
| Professional Medicine | 63.97 | 38.73 |
| Nutrition | 73.86 | 50.33 |
| Professional Psychology | 68.95 | 46.57 |
| Virology | 54.22 | 41.57 |
| High School Psychology | 83.67 | 66.60 |
| Average | 70.33 | 48.85 |
The current model demonstrates a substantial improvement over the previous Dr. Samantha model in terms of subject-specific knowledge and accuracy.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
class MedicalAssistant:
def __init__(self, model_name="sethuiyer/Medichat-Llama3-8B", device="cuda"):
self.device = device
self.tokenizer = AutoTokenizer.from_pretrained(model_name)
self.model = AutoModelForCausalLM.from_pretrained(model_name).to(self.device)
self.sys_message = '''
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
'''
def format_prompt(self, question):
messages = [
{"role": "system", "content": self.sys_message},
{"role": "user", "content": question}
]
prompt = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
return prompt
def generate_response(self, question, max_new_tokens=512):
prompt = self.format_prompt(question)
inputs = self.tokenizer(prompt, return_tensors="pt").to(self.device)
with torch.no_grad():
outputs = self.model.generate(**inputs, max_new_tokens=max_new_tokens, use_cache=True)
answer = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip()
return answer
if __name__ == "__main__":
assistant = MedicalAssistant()
question = '''
Symptoms:
Dizziness, headache, and nausea.
What is the differential diagnosis?
'''
response = assistant.generate_response(question)
print(response)
Thanks to Quant Factory, the quantized version of this model is available at QuantFactory/Medichat-Llama3-8B-GGUF,
This model is now also available on Ollama. You can use it by running the command ollama run monotykamary/medichat-llama3 in your
terminal. If you have limited computing resources, check out this video to learn how to run it on
a Google Colab backend.