Update README.md
Browse files
README.md
CHANGED
|
@@ -86,6 +86,32 @@ _ = model.generate(
|
|
| 86 |
)
|
| 87 |
```
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
### Framework versions
|
| 90 |
|
| 91 |
- PEFT 0.15.2
|
|
|
|
| 86 |
)
|
| 87 |
```
|
| 88 |
|
| 89 |
+
For Pipeline
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
| 93 |
+
from peft import PeftModel
|
| 94 |
+
|
| 95 |
+
tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen3-0.6B")
|
| 96 |
+
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-0.6B")
|
| 97 |
+
model = PeftModel.from_pretrained(base_model, "khazarai/ClinicalReasoning-0.6B")
|
| 98 |
+
|
| 99 |
+
system = "Please answer with one of the option in the bracket. Write reasoning in between <analysis></analysis>. Write answer in between <answer></answer>."
|
| 100 |
+
|
| 101 |
+
question="""
|
| 102 |
+
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??
|
| 103 |
+
{'A': 'Pseudotumor cerebri', 'B': 'Thromboembolic stroke', 'C': 'Epidural hematoma', 'D': 'Subdural hematoma', 'E': 'Subarachnoid hemorrhage'},
|
| 104 |
+
"""
|
| 105 |
+
|
| 106 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 107 |
+
messages = [
|
| 108 |
+
{"role" : "system", "content" : system},
|
| 109 |
+
{"role": "user", "content": question}
|
| 110 |
+
]
|
| 111 |
+
pipe(messages)
|
| 112 |
+
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
### Framework versions
|
| 116 |
|
| 117 |
- PEFT 0.15.2
|