Views
No views yet
| Parameter | Value |
|---|---|
| Base model | Mistral 7B v0.1 |
| Dataset | ChatDoctor-HealthCareMagic-100k |
| Training examples | 5,000 |
| Technique | QLoRA (4-bit quantization + LoRA) |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Trainable parameters | 13.6M (0.19% of total) |
| Training steps | 625 |
| Final training loss | 2.03 |
| Hardware | Google Colab T4 GPU (free tier) |
| Training time | ~96 minutes |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3import torch
4
5base_model = AutoModelForCausalLM.from_pretrained(
6 "mistralai/Mistral-7B-v0.1",
7 torch_dtype=torch.float16,
8 device_map="auto"
9)
10
11model = PeftModel.from_pretrained(base_model, "Umer797/medqa-mistral-7b-lora")
12tokenizer = AutoTokenizer.from_pretrained("Umer797/medqa-mistral-7b-lora")
13
14prompt = """<s>[INST] If you are a doctor, please answer the medical questions
15based on the patient's description.
16
17Patient: I have been experiencing severe headaches on one side of my head
18with sensitivity to light and nausea. [/INST]
19
20Doctor:"""
21
22inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
23outputs = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
24print(tokenizer.decode(outputs[0], skip_special_tokens=True))