Views
No views yet
| Model | ROUGE-1 | ROUGE-2 | ROUGE-L |
|---|---|---|---|
| Mistral-7B (zero-shot) | 0.2138 | 0.0707 | 0.1532 |
| This model (QLoRA) | 0.3445 | 0.1249 | 0.2288 |
| Improvement | +61% | +76% | +49% |
| Property | Value |
|---|---|
| Base Model | Mistral-7B-v0.1 |
| Dataset | PubMed QA (pqa_labeled) |
| Train Samples | 630 |
| Test Samples | 70 |
| LoRA Rank | 8 |
| LoRA Alpha | 16 |
| Target Modules | q_proj, v_proj |
| Trainable Params | ~1.2% |
| Quantization | 4-bit NF4 |
| Learning Rate | 2e-4 |
| Total Steps | 600 |
| Final Loss | 1.043 |
| GPU | Tesla T4 16GB |
| Training Time | ~3.86 hours |
The symptoms of type 2 diabetes include increased thirst, increased urination, increased hunger, weight loss, blurred vision, and fatigue. These symptoms occur because the body's cells are starved of glucose.
Insulin is a hormone produced by beta cells in the pancreas. It helps cells take in glucose from the blood as fuel. When cells don't respond properly, glucose stays in the blood — this is called insulin resistance.
High blood pressure has many causes including narrowed arteries, kidney problems, being overweight, and excess salt in the diet.
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import torch
4
5tokenizer = AutoTokenizer.from_pretrained(
6 "sumitkalamkar/mistral-7b-medical-qa-qlora"
7)
8model = AutoModelForCausalLM.from_pretrained(
9 "mistralai/Mistral-7B-v0.1",
10 torch_dtype=torch.bfloat16,
11 device_map="auto"
12)
13model = PeftModel.from_pretrained(
14 model,
15 "sumitkalamkar/mistral-7b-medical-qa-qlora"
16)
17
18def ask(question):
19 prompt = f"<s>[INST] You are an expert medical AI assistant. Question: {question} [/INST] Answer:"
20 inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
21 with torch.no_grad():
22 outputs = model.generate(
23 **inputs,
24 max_new_tokens=200,
25 do_sample=False,
26 pad_token_id=tokenizer.eos_token_id
27 )
28 return tokenizer.decode(
29 outputs[0][inputs['input_ids'].shape[1]:],
30 skip_special_tokens=True
31 ).strip()
32
33print(ask("What are the symptoms of Type 2 diabetes?"))