Llama-2-7B Medical Chat LoRA Adapter

This is a LoRA (Low-Rank Adaptation) fine-tuned version of Llama-2-7b-chat-hf, specifically trained on medical conversation data.

Model Details

  • Base Model: NousResearch/Llama-2-7b-chat-hf
  • Fine-tuning Method: LoRA (Low-Rank Adaptation)
  • Dataset: lavita/ChatDoctor-HealthCareMagic-100k (5000 samples)
  • Task: Medical Question Answering / Healthcare Chat

Usage

To use this model, you need to load the base model and then load the LoRA adapter:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load base model
base_model_name = "NousResearch/Llama-2-7b-chat-hf"
model = AutoModelForCausalLM.from_pretrained(
    base_model_name,
    torch_dtype=torch.float16,
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model_name)

# Load LoRA adapter
model = PeftModel.from_pretrained(model, "Damon07/llama-2-7b-chat-medical")

# Generate response
prompt = "### Human: I have chest pain. What should I do?\n### Assistant:"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Training Details

  • LoRA Rank: 64
  • LoRA Alpha: 16
  • Training Epochs: 1
  • Learning Rate: 2e-4
  • Batch Size: 1 (with gradient accumulation steps: 4)

Disclaimer

This model is for educational and research purposes only. Always consult with qualified healthcare professionals for medical advice.

Downloads last month
49
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Damon07/llama-2-7b-chat-medical

Adapter
(429)
this model

Dataset used to train Damon07/llama-2-7b-chat-medical