SFT
Collection
Supervised fine-tuning
•
11 items
•
Updated
•
1
This model is a fine-tuned version of Qwen3-0.6B on a 34K medical Q&A dataset derived from the Anki Medical Curriculum flashcards. It is designed to assist with medical education and exam preparation, offering concise and contextually relevant answers to short medical questions.
Use the code below to get started with the model.
from huggingface_hub import login
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-0.6B",)
base_model = AutoModelForCausalLM.from_pretrained(
"unsloth/Qwen3-0.6B",
device_map={"": 0}
)
model = PeftModel.from_pretrained(base_model,"khazarai/Medical-QA")
system = "Answer this question truthfully"
question = """
What can β-blockers cause or exacerbate due to excessive AV nodal inhibition?
"""
messages = [
{"role" : "system", "content" : system},
{"role" : "user", "content" : question}
]
text = tokenizer.apply_chat_template(
messages,
tokenize = False,
add_generation_prompt = True,
enable_thinking = False,
)
from transformers import TextStreamer
_ = model.generate(
**tokenizer(text, return_tensors = "pt").to("cuda"),
max_new_tokens = 512,
temperature = 0.7,
top_p = 0.8,
top_k = 20,
streamer = TextStreamer(tokenizer, skip_prompt = True),
)
For pipeline:
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-0.6B")
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-0.6B")
model = PeftModel.from_pretrained(base_model, "khazarai/Medical-QA")
system = "Answer this question truthfully"
question = """
What can β-blockers cause or exacerbate due to excessive AV nodal inhibition?
"""
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
messages = [
{"role": "system", "content": system}
{"role": "user", "content": question}
]
pipe(messages)
The dataset is based on Anki Medical Curriculum flashcards, created and updated by medical students. These flashcards cover the entire medical curriculum, including but not limited to:
The flashcards typically provide succinct summaries and mnemonics to support learning and retention.