Views
No views yet

| Property | Value |
|---|---|
| Base Model | Google Gemma3 (270M parameters) |
| Fine-tuning Method | LoRA using Unsloth |
| Dataset Used | 25,000 Q&A pairs from MIRIAD-4.4M |
| Epochs | 3 |
| Final Format | Merged (base + LoRA weights) |
| Model Size | 270M |
| License | ODC-BY v1.0 dataset license (non-commercial) |
| Author | Mohamed Yasser |
| Metric | Value |
|---|---|
| Average Answer Length | 40.3 words |
| Longest Answer | 95 words |
| Shortest Answer | 12 words |
| Empty / Short Responses | 0 |
| Clinical Accuracy | ✅ Consistent terminology |
| Depth in Short Responses | ⚠️ Limited |
| Best Use Case | Lightweight educational deployment (MCQs, tutoring) |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4model_name = "yasserrmd/PharmaQA-270M"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
7model.eval()
8
9question = "What is the mechanism of action of metformin?"
10messages = [{"role": "user", "content": f"Q: {question} A:"}]
11
12inputs = tokenizer.apply_chat_template(
13 messages,
14 add_generation_prompt=True,
15 return_tensors="pt",
16 tokenize=True,
17 return_dict=True
18).to(model.device)
19
20if "token_type_ids" in inputs:
21 del inputs["token_type_ids"]
22
23with torch.no_grad():
24 outputs = model.generate(
25 **inputs,
26 max_new_tokens=128,
27 temperature=0.7,
28 top_p=0.95,
29 repetition_penalty=1.05
30 )
31
32response = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
33answer = response.split("A:")[-1].strip()
34
35print("💊 Question:", question)
36print("🧠 Answer:", answer)