Update README.md
Browse files
README.md
CHANGED
|
@@ -86,7 +86,29 @@ _ = model.generate(
|
|
| 86 |
streamer = TextStreamer(tokenizer, skip_prompt = True),
|
| 87 |
)
|
| 88 |
```
|
|
|
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
## Training Details
|
| 92 |
|
|
|
|
| 86 |
streamer = TextStreamer(tokenizer, skip_prompt = True),
|
| 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-1.7B")
|
| 96 |
+
base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-1.7B")
|
| 97 |
+
model = PeftModel.from_pretrained(base_model, "khazarai/MedCase-R1")
|
| 98 |
+
|
| 99 |
+
question = """
|
| 100 |
+
A 23-year-old man presented with a 1-month history of epigastric pain, nausea, postprandial vomiting, anorexia, generalized malaise, and an 11-kg weight loss. He had no prior gastrointestinal disease, abdominal surgeries, or hospitalizations, and was not on medications. On examination, vital signs were stable, and abdominal examination revealed only mild epigastric tenderness without organomegaly or peritoneal signs.
|
| 101 |
+
Laboratory tests showed normal hemoglobin, hematocrit, white-cell count, and liver and kidney function. HIV serology was negative. Syphilis serologies were positive (VDRL and Treponema pallidum reagents).
|
| 102 |
+
Upper endoscopy revealed diminished gastric expandability and diffuse mucosal lesions from the cardia to the pylorus. The gastric mucosa appeared thickened, friable, nodular, and had multiple ulcerations. Gastric biopsies demonstrated a dense inflammatory infiltrate rich in plasma cells.
|
| 103 |
+
"""
|
| 104 |
+
|
| 105 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 106 |
+
messages = [
|
| 107 |
+
{"role": "user", "content": question}
|
| 108 |
+
]
|
| 109 |
+
pipe(messages)
|
| 110 |
+
|
| 111 |
+
```
|
| 112 |
|
| 113 |
## Training Details
|
| 114 |
|