Update README.md
Browse files
README.md
CHANGED
|
@@ -8,6 +8,10 @@ tags:
|
|
| 8 |
- ehr
|
| 9 |
- reasoning
|
| 10 |
- qwen
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# EHR-R1-1.7B: A Reasoning-Enhanced Foundational Language Model for Electronic Health Record Analysis
|
|
@@ -34,14 +38,14 @@ This repository contains the **EHR-R1-1.7B** model, part of the **EHR-R1** serie
|
|
| 34 |
### EHR Input Format
|
| 35 |
For any EHR data, keep the EHR input with markdown format as below:
|
| 36 |
* For the event with single record:
|
| 37 |
-
```
|
| 38 |
## Evant Name [Event Time (YYYY-MM-DD HH:MM:SS)]
|
| 39 |
- ItemKey_1: ItemValue_1
|
| 40 |
- ItemKey_2: ItemValue_2
|
| 41 |
- ItemKey_3: ItemValue_3
|
| 42 |
```
|
| 43 |
* For the event with multiple records (like labevents):
|
| 44 |
-
```
|
| 45 |
## Evant Name [Event Time (YYYY-MM-DD HH:MM:SS)]
|
| 46 |
| ItemKey_1 | ItemKey_2 | ItemKey_3 |
|
| 47 |
| --------- | --------- | --------- |
|
|
@@ -67,8 +71,7 @@ ehr_input = "{YOUR FOMATTED EHR INPUT}"
|
|
| 67 |
instruction = "{YOUR TASK INSTRUCTION}"
|
| 68 |
messages = [
|
| 69 |
{"role": "system", "content": "You are a helpful assistant."},
|
| 70 |
-
{"role": "user", "content": ehr_input + "
|
| 71 |
-
" + instruction}
|
| 72 |
]
|
| 73 |
|
| 74 |
# For EHR-R1-1.7B & EHR-R1-8B, control the reasoning mode by setting enable_thinking
|
|
@@ -78,14 +81,8 @@ text = tokenizer.apply_chat_template(
|
|
| 78 |
add_generation_prompt=True,
|
| 79 |
enable_thinking=False,
|
| 80 |
).to(model.device)
|
| 81 |
-
# For EHR-R1-72B, you can manually add
|
| 82 |
-
|
| 83 |
-
</think>
|
| 84 |
-
at the end of the model_inputs to close the reasoning modes.
|
| 85 |
-
text += "<think>
|
| 86 |
-
|
| 87 |
-
</think>
|
| 88 |
-
"
|
| 89 |
|
| 90 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 91 |
generated_ids = model.generate(
|
|
|
|
| 8 |
- ehr
|
| 9 |
- reasoning
|
| 10 |
- qwen
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
base_model:
|
| 14 |
+
- Qwen/Qwen3-1.7B
|
| 15 |
---
|
| 16 |
|
| 17 |
# EHR-R1-1.7B: A Reasoning-Enhanced Foundational Language Model for Electronic Health Record Analysis
|
|
|
|
| 38 |
### EHR Input Format
|
| 39 |
For any EHR data, keep the EHR input with markdown format as below:
|
| 40 |
* For the event with single record:
|
| 41 |
+
```
|
| 42 |
## Evant Name [Event Time (YYYY-MM-DD HH:MM:SS)]
|
| 43 |
- ItemKey_1: ItemValue_1
|
| 44 |
- ItemKey_2: ItemValue_2
|
| 45 |
- ItemKey_3: ItemValue_3
|
| 46 |
```
|
| 47 |
* For the event with multiple records (like labevents):
|
| 48 |
+
```
|
| 49 |
## Evant Name [Event Time (YYYY-MM-DD HH:MM:SS)]
|
| 50 |
| ItemKey_1 | ItemKey_2 | ItemKey_3 |
|
| 51 |
| --------- | --------- | --------- |
|
|
|
|
| 71 |
instruction = "{YOUR TASK INSTRUCTION}"
|
| 72 |
messages = [
|
| 73 |
{"role": "system", "content": "You are a helpful assistant."},
|
| 74 |
+
{"role": "user", "content": ehr_input + "\n" + instruction}
|
|
|
|
| 75 |
]
|
| 76 |
|
| 77 |
# For EHR-R1-1.7B & EHR-R1-8B, control the reasoning mode by setting enable_thinking
|
|
|
|
| 81 |
add_generation_prompt=True,
|
| 82 |
enable_thinking=False,
|
| 83 |
).to(model.device)
|
| 84 |
+
# For EHR-R1-72B, you can manually add `<think>\n\n</think>` at the end of the model_inputs to close the reasoning modes.
|
| 85 |
+
text += "<think>\n\n</think>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 88 |
generated_ids = model.generate(
|