Downloads · 30 days
16
36% of all-time downloads
halame/chatdoctor-llama3-lora
chatdoctor-llama3-lora is a text generation model from halame. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A fine-tuned LoRA adapter for medical question answering, achieving BERTScore F1 = 0.845 (best result, exceeds original ChatDoctor paper).
Downloads · 30 days
16
36% of all-time downloads
All-time downloads
44
Public
Repo size
185 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 91%
From the Hugging Face model README
A fine-tuned LoRA adapter for medical question answering, achieving BERTScore F1 = 0.845 (best result, exceeds original ChatDoctor paper).
| Model | BERTScore P | BERTScore R | BERTScore F1 |
|---|---|---|---|
| ChatDoctor (Paper) | 0.844 | 0.845 | 0.841 |
| Mistral + LoRA | 0.845 | 0.843 | 0.844 |
| LLaMA-3 + LoRA | 0.844 | 0.846 | 0.845 |
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"NousResearch/Meta-Llama-3-8B-Instruct",
torch_dtype=torch.float16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "halame/chatdoctor-llama3-lora")
tokenizer = AutoTokenizer.from_pretrained("halame/chatdoctor-llama3-lora")
# Generate
prompt = "I have headache and fever for 2 days. What should I do?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Apache 2.0
This model is for research purposes only. Do not use for actual medical diagnosis.