Views
No views yet
| Parameter | Value |
|---|---|
| Base model | Llama 3.2 3B Instruct |
| Dataset | PubMedQA (pqa_labeled) |
| Training samples | 1,000 |
| Technique | QLoRA (4-bit quantization + LoRA) |
| LoRA rank | 16 |
| Epochs | 3 |
| Learning rate | 2e-4 |
| Final training loss | 1.56 |
| Training time | ~7 minutes (A100) |
| Trainable parameters | ~13M / 3B (0.42%) |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "Yashwanth-Pulimi/llama3-medical-qa"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16)
7
8prompt = """<|begin_of_text|><|start_header_id|>system<|end_header_id|>
9You are an expert medical AI assistant.<|eot_id|>
10<|start_header_id|>user<|end_header_id|>
11Context: A randomized trial of 200 diabetic patients showed metformin
12reduced HbA1c by 2.1% vs 1.2% with lifestyle changes alone.
13
14Question: Does metformin reduce HbA1c more than lifestyle changes alone?<|eot_id|>
15<|start_header_id|>assistant<|end_header_id|>"""
16
17inputs = tokenizer(prompt, return_tensors="pt")
18outputs = model.generate(**inputs, max_new_tokens=150, temperature=0.1, do_sample=True)
19print(tokenizer.decode(outputs[0], skip_special_tokens=True))