Update README.md
Browse files
README.md
CHANGED
@@ -10,4 +10,60 @@ base_model:
|
|
10 |
library_name: transformers
|
11 |
tags:
|
12 |
- medical
|
13 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
library_name: transformers
|
11 |
tags:
|
12 |
- medical
|
13 |
+
---
|
14 |
+
|
15 |
+
<div align="center">
|
16 |
+
<h1>
|
17 |
+
FineMedLM
|
18 |
+
</h1>
|
19 |
+
</div>
|
20 |
+
|
21 |
+
<div align="center">
|
22 |
+
<a href="https://github.com/hongzhouyu/FineMed" target="_blank">GitHub</a> | <a href="https://arxiv.org/abs/2501.09213" target="_blank">Paper</a>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
# <span>Introduction</span>
|
26 |
+
**FineMedLM** is a medical chat LLM trained via SFT on meticulously crafted synthetic data. By further applying DPO, the model acquires enhanced deep reasoning capabilities, culminating in the development of [FineMedLM-o1](https://huggingface.co/hongzhouyu/FineMedLM-o1).
|
27 |
+
|
28 |
+
For more information, visit our GitHub repository.
|
29 |
+
|
30 |
+
# <span>Usage</span>
|
31 |
+
You can use FineMedLM in the same way as `Llama-3.1-8B-Instruct`:
|
32 |
+
```python
|
33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
34 |
+
|
35 |
+
model = AutoModelForCausalLM.from_pretrained("hongzhouyu/FineMedLM")
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained("hongzhouyu/FineMedLM")
|
37 |
+
|
38 |
+
prompt = "How do the interactions between neuronal activity, gonadal hormones, and neurotrophins influence axon regeneration post-injury, and what are the potential therapeutic implications of this research? Please think step by step."
|
39 |
+
messages = [
|
40 |
+
{"role": "system", "content": "You are a helpful professional doctor."},
|
41 |
+
{"role": "user", "content": prompt}
|
42 |
+
]
|
43 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
44 |
+
model_inputs = tokenizer([text], return_tensors="pt")
|
45 |
+
|
46 |
+
generated_ids = model.generate(
|
47 |
+
model_inputs.input_ids,
|
48 |
+
max_new_tokens=4096
|
49 |
+
)
|
50 |
+
generated_ids = [
|
51 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
52 |
+
]
|
53 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
54 |
+
|
55 |
+
print(response)
|
56 |
+
```
|
57 |
+
|
58 |
+
# <span>Citation</span>
|
59 |
+
```
|
60 |
+
@misc{yu2025finemedlmo1enhancingmedicalreasoning,
|
61 |
+
title={FineMedLM-o1: Enhancing the Medical Reasoning Ability of LLM from Supervised Fine-Tuning to Test-Time Training},
|
62 |
+
author={Hongzhou Yu and Tianhao Cheng and Ying Cheng and Rui Feng},
|
63 |
+
year={2025},
|
64 |
+
eprint={2501.09213},
|
65 |
+
archivePrefix={arXiv},
|
66 |
+
primaryClass={cs.CL},
|
67 |
+
url={https://arxiv.org/abs/2501.09213},
|
68 |
+
}
|
69 |
+
```
|