|
--- |
|
license: apache-2.0 |
|
language: |
|
- zh |
|
base_model: |
|
- Qwen/Qwen2.5-7B-Instruct |
|
pipeline_tag: feature-extraction |
|
tags: |
|
- structuring |
|
- EHR |
|
- medical |
|
- IE |
|
--- |
|
# Model Card for GENIE |
|
|
|
|
|
## Model Details |
|
|
|
Model Size: 8B (English) / 7B (Chinese) |
|
|
|
Max Tokens: 8192 |
|
|
|
Base model: Llama 3.1 8B (English) / Qwen 2.5 7B (Chinese) |
|
|
|
### Model Description |
|
|
|
GENIE (Generative Note Information Extraction, 中文名:病历精灵) is an end-to-end model designed to structure free text from electronic health records (EHRs). It processes EHRs in a single pass, extracting biomedical named entities along with their assertion statuses, body locations, modifiers, values, units, and intended purposes, outputting this information in a structured JSON format. This streamlined approach simplifies traditional natural language processing workflows by replacing all the analysis components with a single model, making the system easier to maintain while leveraging the advanced analytical capabilities of large language models (LLMs). Comparing with general-purpose LLMs, GENIE does not require prompt engineering or few-shot examples. Additionally, it generates all relevant attributes in one pass, significantly reducing both runtime and operational costs. |
|
GENIE is co-developed by the groups of Sheng Yu (https://www.stat.tsinghua.edu.cn/teachers/shengyu/), Tianxi Cai (https://dbmi.hms.harvard.edu/people/tianxi-cai), and Isaac Kohane (https://dbmi.hms.harvard.edu/people/isaac-kohane). |
|
|
|
|
|
## Usage |
|
|
|
```python |
|
from vllm import LLM, SamplingParams |
|
|
|
PROMPT_TEMPLATE = "Human:\n{query}\n\n Assistant:" |
|
sampling_params = SamplingParams(temperature=temperature, max_tokens=max_new_token) |
|
EHR = ['xxxxx1','xxxxx2'] |
|
texts = [PROMPT_TEMPLATE.format(query=k) for k in EHR] |
|
output = model.generate(texts, sampling_params) |
|
``` |
|
|
|
# An example |
|
|
|
Input: |
|
```python |
|
EHR = ['慢性乙型肝炎病史10余年,曾有肝功能异常,中医治疗后好转;1年余前查HBsAg转阴,但肝脏病理提示病毒性肝炎伴肝纤维化(G1S3-4)'] |
|
``` |
|
|
|
Output: |
|
```python |
|
res = [ |
|
{ "术语": "慢性乙型肝炎", |
|
"语义类型": "疾病、综合征、病理功能", |
|
"叙述状态": "存在", |
|
"身体部位": "无", |
|
"数值": "NA", |
|
"单位": "NA", |
|
"修饰词": "无" }, |
|
{ "术语": "肝功能异常", |
|
"语义类型": "症状、体征、临床所见", |
|
"叙述状态": "存在", |
|
"身体部位": "无", |
|
"数值": "NA", |
|
"单位": "NA", |
|
"修饰词": "无" }, |
|
{ "术语": "HBsAg", |
|
"语义类型": "化学物质、药物", |
|
"叙述状态": "不存在", |
|
"身体部位": "NA", |
|
"数值": "无", |
|
"单位": "NA", |
|
"修饰词": "NA" }, |
|
{ "术语": "肝脏病理", |
|
"语义类型": "诊断操作", |
|
"叙述状态": "存在", |
|
"身体部位": "无", |
|
"数值": "无", |
|
"单位": "NA", |
|
"修饰词": "NA" }, |
|
{ "术语": "病毒性肝炎", |
|
"语义类型": "疾病、综合征、病理功能", |
|
"叙述状态": "存在", |
|
"身体部位": "无", |
|
"数值": "NA", |
|
"单位": "NA", |
|
"修饰词": "无" }, |
|
{ "术语": "肝纤维化", |
|
"语义类型": "疾病、综合征、病理功能", |
|
"叙述状态": "存在", |
|
"身体部位": "无", |
|
"数值": "NA", |
|
"单位": "NA", |
|
"修饰词": "无" }, |
|
] |
|
``` |
|
|
|
|
|
|
|
## Citation [optional] |
|
|
|
If you find our paper or models helpful, please consider cite: (to be released) |
|
|
|
**BibTeX:** |
|
|
|
[More Information Needed] |