Update README.md
Browse files
README.md
CHANGED
|
@@ -17,50 +17,40 @@ pipeline_tag: text-generation
|
|
| 17 |
|
| 18 |
# Model Card for gpt-oss-20b-medical-qa
|
| 19 |
|
| 20 |
-
This model is a fine-tuned version of [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) on the [
|
| 21 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 22 |
|
| 23 |
## Quick start
|
| 24 |
|
| 25 |
```python
|
| 26 |
-
from transformers import
|
| 27 |
-
from peft import PeftModel
|
| 28 |
|
| 29 |
-
|
| 30 |
-
tokenizer = AutoTokenizer.from_pretrained("openai/gpt-oss-20b")
|
| 31 |
|
| 32 |
-
|
| 33 |
-
model_kwargs = dict(attn_implementation="eager", torch_dtype="auto", use_cache=True, device_map="auto")
|
| 34 |
-
base_model = AutoModelForCausalLM.from_pretrained("openai/gpt-oss-20b", **model_kwargs).cuda()
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
model
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
text = render_infernce_harmony(question)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
outputs = model.generate(
|
| 49 |
-
input_ids=inputs.input_ids,
|
| 50 |
-
attention_mask=inputs.attention_mask,
|
| 51 |
max_new_tokens=20,
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
```
|
| 58 |
Output:
|
| 59 |
|
| 60 |
```bash
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
You are a medical expert with advanced knowledge in clinical reasoning and diagnostics. Respond with ONLY the final diagnosis/cause in ≤5 words.<|end|><|start|>user<|message|>An 88-year-old woman with osteoarthritis is experiencing mild epigastric discomfort and has vomited material resembling coffee grounds multiple times. Considering her use of naproxen, what is the most likely cause of her gastrointestinal blood loss?<|end|><|start|>assistant<|return|><|message|>Stomach ulcer<|end|><|return|>
|
| 64 |
```
|
| 65 |
## Training procedure
|
| 66 |
This model was trained with SFT.
|
|
|
|
| 17 |
|
| 18 |
# Model Card for gpt-oss-20b-medical-qa
|
| 19 |
|
| 20 |
+
This model is a fine-tuned version of [openai/gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) on the [FreedomIntelligence/medical-o1-verifiable-problem](https://huggingface.co/datasets/FreedomIntelligence/medical-o1-verifiable-problem) dataset.
|
| 21 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 22 |
|
| 23 |
## Quick start
|
| 24 |
|
| 25 |
```python
|
| 26 |
+
from transformers import pipeline
|
|
|
|
| 27 |
|
| 28 |
+
prompt = """<|start|>developer<|message|># Instructions
|
|
|
|
| 29 |
|
| 30 |
+
You are a medical expert with advanced knowledge in clinical reasoning and diagnostics. Respond with ONLY the final diagnosis/cause in ≤5 words.<|end|><|start|>user<|message|>An 88-year-old woman with osteoarthritis is experiencing mild epigastric discomfort and has vomited material resembling coffee grounds multiple times. Considering her use of naproxen, what is the most likely cause of her gastrointestinal blood loss?<|end|><|start|>assistant<|message|>"""
|
|
|
|
|
|
|
| 31 |
|
| 32 |
+
# Load pipeline
|
| 33 |
+
generator = pipeline(
|
| 34 |
+
"text-generation",
|
| 35 |
+
model="kingabzpro/gpt-oss-20b-medical-qa",
|
| 36 |
+
device="cuda" # or device=0
|
| 37 |
+
)
|
| 38 |
|
|
|
|
| 39 |
|
| 40 |
+
# Run inference (passing in chat-style format)
|
| 41 |
+
output = generator(
|
| 42 |
+
prompt,
|
|
|
|
|
|
|
|
|
|
| 43 |
max_new_tokens=20,
|
| 44 |
+
return_full_text=False
|
| 45 |
+
)[0]
|
| 46 |
+
|
| 47 |
+
print(output["generated_text"])
|
| 48 |
+
|
| 49 |
```
|
| 50 |
Output:
|
| 51 |
|
| 52 |
```bash
|
| 53 |
+
NSAID use
|
|
|
|
|
|
|
| 54 |
```
|
| 55 |
## Training procedure
|
| 56 |
This model was trained with SFT.
|