SFT
Collection
Supervised fine-tuning
•
6 items
•
Updated
•
1
Not Intended For:
Use the code below to get started with the model.
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/ClinicalReasoning-0.6B")
system = "Please answer with one of the option in the bracket. Write reasoning in between <analysis></analysis>. Write answer in between <answer></answer>."
question = """
A 44-year-old female is admitted to the neurological service. You examine her chart and note that after admission she was started on nimodipine. Which of the following pathologies would benefit from this pharmacologic therapy??
{'A': 'Pseudotumor cerebri', 'B': 'Thromboembolic stroke', 'C': 'Epidural hematoma', 'D': 'Subdural hematoma', 'E': 'Subarachnoid hemorrhage'}
"""
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.6,
top_p = 0.95,
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/ClinicalReasoning-0.6B")
system = "Please answer with one of the option in the bracket. Write reasoning in between <analysis></analysis>. Write answer in between <answer></answer>."
question="""
A 44-year-old female is admitted to the neurological service. You examine her chart and note that after admission she was started on nimodipine. Which of the following pathologies would benefit from this pharmacologic therapy??
{'A': 'Pseudotumor cerebri', 'B': 'Thromboembolic stroke', 'C': 'Epidural hematoma', 'D': 'Subdural hematoma', 'E': 'Subarachnoid hemorrhage'},
"""
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
messages = [
{"role" : "system", "content" : system},
{"role": "user", "content": question}
]
pipe(messages)