Instructions to use cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti with PEFT:
from peft import PeftModel from transformers import AutoModelForSequenceClassification base_model = AutoModelForSequenceClassification.from_pretrained("microsoft/biogpt") model = PeftModel.from_pretrained(base_model, "cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti") - Transformers
How to use cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti", dtype="auto") - Notebooks
- Google Colab
- Kaggle
File size: 1,953 Bytes
8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 8e65a97 2dea348 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ---
base_model: microsoft/biogpt
library_name: peft
tags:
- base_model:adapter:microsoft/biogpt
- transformers
---
# biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti
This model is designed to predict in-hospital mortality (i.e., likely face death in their upcoming / current visit) from **prior** hospital records. It is trained on clinical notes from **prior hospitalizations** on MIMIC-IV.
Model was trained on a novel tabular-infused IA3, whereby the pre-operative tabular features (e.g., patient demographics and insurance information) were used to initialize the newly introduced IA3 parameters.
## Model Details
- **Data**: MIMIC-IV (available [here](https://physionet.org/content/mimiciv/2.2/))
- **Outcome**: In-hospital mortality (`True`/`False`)
- **Base Model**: [`microsoft/biogpt`](https://huggingface.co/microsoft/biogpt)
## How to use model
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti")
model = AutoModelForSequenceClassification.from_pretrained("cja5553/biogpt_MIMIC_IV_in_hospital_mortality_prediction_IA3_ti")
```
Then you can use this function below to get one test point
```python
import torch
def get_outcome(tokenizer, model, text, device="cuda:0", max_length=512):
device = torch.device(device)
model = model.to(device)
model.eval()
inputs = tokenizer(
text,
return_tensors="pt",
max_length=max_length,
truncation=True,
padding="max_length"
).to(device)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=-1)[0] # (2,)
probs = probs.detach().cpu().numpy()
result = {
"False": float(probs[0]),
"True": float(probs[1])
}
return result
```
## Questions?
Contact me at [alba@wustl.edu](mailto:alba@wustl.edu) |