Add pipeline_tag and library_name to model card
Browse filesThis PR enhances the model card by adding key metadata tags:
- `pipeline_tag: text-generation`: This allows the model to be easily discoverable through the text-generation filter on the Hub and accurately reflects its primary function of generating examination results.
- `library_name: transformers`: This enables the "how to use" widget on the model page, providing automated code snippets for users, as the model is compatible with the `transformers` library as demonstrated in the "Quickstart" section.
These additions will improve the usability and visibility of the model on the Hugging Face Hub.
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
base_model:
|
| 6 |
- Qwen/Qwen2.5-7B-Instruct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
|
|
|
| 8 |
# DiagGym: Virtual Clinical Environment (EHR World Model)
|
| 9 |
|
| 10 |
|
|
@@ -59,16 +62,27 @@ class DiagGym:
|
|
| 59 |
|
| 60 |
def simulate(self, context: str, past_events_list: list, exam_name: str) -> Optional[str]:
|
| 61 |
"""Generate exam results based on patient context and past events."""
|
| 62 |
-
context += "
|
|
|
|
|
|
|
| 63 |
|
| 64 |
if len(past_events_list) == 0:
|
| 65 |
-
input_prompt = context + "Exam name
|
|
|
|
|
|
|
|
|
|
| 66 |
else:
|
| 67 |
past_events_str = [
|
| 68 |
-
f"Exam name
|
|
|
|
|
|
|
|
|
|
| 69 |
for (event_name, resp) in past_events_list
|
| 70 |
]
|
| 71 |
-
input_prompt = context + SEP.join(past_events_str) + SEP + "Exam name
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
response = self.client.completions.create(
|
| 74 |
model=self.model_name_or_path,
|
|
@@ -110,19 +124,32 @@ exam_name = "CHEST (PORTABLE AP)"
|
|
| 110 |
if len(past_events_list) == 0:
|
| 111 |
prompt = (
|
| 112 |
context
|
| 113 |
-
+ "
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
)
|
| 116 |
else:
|
| 117 |
past_events_str = [
|
| 118 |
-
f"Exam name
|
|
|
|
|
|
|
|
|
|
| 119 |
for (event_name, resp) in past_events_list
|
| 120 |
]
|
| 121 |
prompt = (
|
| 122 |
context
|
| 123 |
-
+ "
|
|
|
|
|
|
|
| 124 |
+ SEP.join(past_events_str) + SEP
|
| 125 |
-
+ "Exam name
|
|
|
|
|
|
|
|
|
|
| 126 |
)
|
| 127 |
|
| 128 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
@@ -189,4 +216,4 @@ On 863 MIMIC‑IV cases, DiagGym shows strong step‑level similarity and full
|
|
| 189 |
## Contact
|
| 190 |
|
| 191 |
- For implementation detailes, please refer to our GitHub: https://github.com/MAGIC-AI4Med/DiagGym
|
| 192 |
-
- Email: henrychur@sjtu.edu.cn
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
base_model:
|
| 3 |
- Qwen/Qwen2.5-7B-Instruct
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
---
|
| 10 |
+
|
| 11 |
# DiagGym: Virtual Clinical Environment (EHR World Model)
|
| 12 |
|
| 13 |
|
|
|
|
| 62 |
|
| 63 |
def simulate(self, context: str, past_events_list: list, exam_name: str) -> Optional[str]:
|
| 64 |
"""Generate exam results based on patient context and past events."""
|
| 65 |
+
context += "
|
| 66 |
+
The following summarizes the results from the patient's medical examination:
|
| 67 |
+
"
|
| 68 |
|
| 69 |
if len(past_events_list) == 0:
|
| 70 |
+
input_prompt = context + "Exam name:
|
| 71 |
+
" + exam_name + "
|
| 72 |
+
Exam results:
|
| 73 |
+
"
|
| 74 |
else:
|
| 75 |
past_events_str = [
|
| 76 |
+
f"Exam name:
|
| 77 |
+
{event_name}
|
| 78 |
+
Exam results:
|
| 79 |
+
{resp}"
|
| 80 |
for (event_name, resp) in past_events_list
|
| 81 |
]
|
| 82 |
+
input_prompt = context + SEP.join(past_events_str) + SEP + "Exam name:
|
| 83 |
+
" + exam_name + "
|
| 84 |
+
Exam results:
|
| 85 |
+
"
|
| 86 |
|
| 87 |
response = self.client.completions.create(
|
| 88 |
model=self.model_name_or_path,
|
|
|
|
| 124 |
if len(past_events_list) == 0:
|
| 125 |
prompt = (
|
| 126 |
context
|
| 127 |
+
+ "
|
| 128 |
+
The following summarizes the results from the patient's medical examination:
|
| 129 |
+
"
|
| 130 |
+
+ "Exam name:
|
| 131 |
+
" + exam_name + "
|
| 132 |
+
Exam results:
|
| 133 |
+
"
|
| 134 |
)
|
| 135 |
else:
|
| 136 |
past_events_str = [
|
| 137 |
+
f"Exam name:
|
| 138 |
+
{event_name}
|
| 139 |
+
Exam results:
|
| 140 |
+
{resp}"
|
| 141 |
for (event_name, resp) in past_events_list
|
| 142 |
]
|
| 143 |
prompt = (
|
| 144 |
context
|
| 145 |
+
+ "
|
| 146 |
+
The following summarizes the results from the patient's medical examination:
|
| 147 |
+
"
|
| 148 |
+ SEP.join(past_events_str) + SEP
|
| 149 |
+
+ "Exam name:
|
| 150 |
+
" + exam_name + "
|
| 151 |
+
Exam results:
|
| 152 |
+
"
|
| 153 |
)
|
| 154 |
|
| 155 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
|
|
| 216 |
## Contact
|
| 217 |
|
| 218 |
- For implementation detailes, please refer to our GitHub: https://github.com/MAGIC-AI4Med/DiagGym
|
| 219 |
+
- Email: henrychur@sjtu.edu.cn
|