A web application that automatically generates concise summaries of clinical notes using state-of-the-art transformer models fine-tuned on clinical text data.
The application is deployed and accessible at: https://sem-werede--clinical-summarizer-app-web-app.modal.run
Note: The current deployment leverages serverless GPUs via Modal, resulting in an average summarization time of ~2 seconds (a significant improvement from the previous ~20 seconds on CPU).
data_processing.py: Script for loading and preprocessing the clinical notes datasettrain.py: Script for fine-tuning transformer models (BioBART and ClinicalT5)run_evaluation.py: Script for evaluating model performance using ROUGE and BLEU metricsapp/: Directory containing the FastAPI web applicationmodels/: Directory for storing fine-tuned model checkpoints (not included in repository)requirements.txt: Python package dependenciesDockerfile: Original container configuration (primarily for local Docker testing or alternative deployments)modal_deploy.py: Script for deploying the application to Modal with serverless GPU.evaluation_results.csv: Model evaluation metricsWe fine-tuned two transformer models on the clinical notes summarization task:
The training process involved:
data_processing.pytrain.pyrun_evaluation.py| Model | rouge1 | rouge2 | rougeL | rougeLsum | bleu | gen_len |
|---|---|---|---|---|---|---|
| BioBART-v2-Base (Original) | 42.1308 | 23.5126 | 28.4806 | 38.7688 | 13.14 | 254.4863 |
| BioBART-v2-Base (Finetuned) | 58.823 | 39.6999 | 47.2348 | 54.9708 | 34.4715 | 115.5956 |
| ClinicalT5-Base (Finetuned) | 60.2571 | 42.1793 | 49.6858 | 56.5992 | 37.1784 | 132.3122 |
| ClinicalT5-Base (Original) | 16.2759 | 5.841 | 12.1763 | 14.5375 | 1.1683 | 45.0182 |
Based on these results, the fine-tuned ClinicalT5 model significantly outperformed the other models and was selected for deployment in the web application.
git clone https://github.com/sgessesse/Clinical_Note_Summarization.git
cd Clinical_Note_Summarization
pip install -r requirements.txt
python -m uvicorn app.main:app --reload
http://localhost:8000 in your browserThe application is deployed using Modal for serverless GPU execution.
pip install modal
modal setup
(This will open a browser for authentication)modal deploy modal_deploy.py
Modal will provide a URL for the deployed application.If you wish to run the application locally using Docker (without Modal's serverless GPU benefits):
Dockerfile is configured for CPU execution if not using a GPU-enabled Docker setup):docker build -t clinical-summarizer .
docker run -p 8000:8000 clinical-summarizer
(Note: The port in Dockerfile might need to be 8000 to match app/main.py's Uvicorn default if not overridden)
Due to size constraints, the fine-tuned models are not included in this repository. To train your own models:
python data_processing.py
python train.py
python run_evaluation.py
models/ directoryThis project uses the following models as starting points for fine-tuning:
@inproceedings{lu-etal-2022-clinicalt5,
title = "Clinical{T}5: A Generative Language Model for Clinical Text",
author = "Lu, Qiuhao and Dou, Dejing and Nguyen, Thien",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2022",
year = "2022",
publisher = "Association for Computational Linguistics",
pages = "5436--5443",
address = "Abu Dhabi, United Arab Emirates"
}
@misc{BioBART,
title={BioBART: Pretraining and Evaluation of A Biomedical Generative Language Model},
author={Hongyi Yuan and Zheng Yuan and Ruyi Gan and Jiaxing Zhang and Yutao Xie and Sheng Yu},
year={2022},
eprint={2204.03905},
archivePrefix={arXiv}
}
This project is licensed under the MIT License - see the LICENSE file for details.
A web application that automatically generates concise summaries of clinical notes using state-of-the-art transformer models fine-tuned on clinical text data.
The application is deployed and accessible at: https://sem-werede--clinical-summarizer-app-web-app.modal.run
Note: The current deployment leverages serverless GPUs via Modal, resulting in an average summarization time of ~2 seconds (a significant improvement from the previous ~20 seconds on CPU).
data_processing.py: Script for loading and preprocessing the clinical notes datasettrain.py: Script for fine-tuning transformer models (BioBART and ClinicalT5)run_evaluation.py: Script for evaluating model performance using ROUGE and BLEU metricsapp/: Directory containing the FastAPI web applicationmodels/: Directory for storing fine-tuned model checkpoints (not included in repository)requirements.txt: Python package dependenciesDockerfile: Original container configuration (primarily for local Docker testing or alternative deployments)modal_deploy.py: Script for deploying the application to Modal with serverless GPU.evaluation_results.csv: Model evaluation metricsWe fine-tuned two transformer models on the clinical notes summarization task:
The training process involved:
data_processing.pytrain.pyrun_evaluation.py| Model | rouge1 | rouge2 | rougeL | rougeLsum | bleu | gen_len |
|---|---|---|---|---|---|---|
| BioBART-v2-Base (Original) | 42.1308 | 23.5126 | 28.4806 | 38.7688 | 13.14 | 254.4863 |
| BioBART-v2-Base (Finetuned) | 58.823 | 39.6999 | 47.2348 | 54.9708 | 34.4715 | 115.5956 |
| ClinicalT5-Base (Finetuned) | 60.2571 | 42.1793 | 49.6858 | 56.5992 | 37.1784 | 132.3122 |
| ClinicalT5-Base (Original) | 16.2759 | 5.841 | 12.1763 | 14.5375 | 1.1683 | 45.0182 |
Based on these results, the fine-tuned ClinicalT5 model significantly outperformed the other models and was selected for deployment in the web application.
git clone https://github.com/sgessesse/Clinical_Note_Summarization.git
cd Clinical_Note_Summarization
pip install -r requirements.txt
python -m uvicorn app.main:app --reload
http://localhost:8000 in your browserThe application is deployed using Modal for serverless GPU execution.
pip install modal
modal setup
(This will open a browser for authentication)modal deploy modal_deploy.py
Modal will provide a URL for the deployed application.If you wish to run the application locally using Docker (without Modal's serverless GPU benefits):
Dockerfile is configured for CPU execution if not using a GPU-enabled Docker setup):docker build -t clinical-summarizer .
docker run -p 8000:8000 clinical-summarizer
(Note: The port in Dockerfile might need to be 8000 to match app/main.py's Uvicorn default if not overridden)
Due to size constraints, the fine-tuned models are not included in this repository. To train your own models:
python data_processing.py
python train.py
python run_evaluation.py
models/ directoryThis project uses the following models as starting points for fine-tuning:
@inproceedings{lu-etal-2022-clinicalt5,
title = "Clinical{T}5: A Generative Language Model for Clinical Text",
author = "Lu, Qiuhao and Dou, Dejing and Nguyen, Thien",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2022",
year = "2022",
publisher = "Association for Computational Linguistics",
pages = "5436--5443",
address = "Abu Dhabi, United Arab Emirates"
}
@misc{BioBART,
title={BioBART: Pretraining and Evaluation of A Biomedical Generative Language Model},
author={Hongyi Yuan and Zheng Yuan and Ruyi Gan and Jiaxing Zhang and Yutao Xie and Sheng Yu},
year={2022},
eprint={2204.03905},
archivePrefix={arXiv}
}
This project is licensed under the MIT License - see the LICENSE file for details.