#Installation

We installed the environment like this:

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
source miniforge3/bin/activate
mamba create -n flamingo2 python=3.10.*
conda activate flamingo2
mamba install nvidia/label/cuda-12.4.1::cuda
mamba install pytorch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 pytorch-cuda=12.4 accelerate -c pytorch -c nvidia
pip install flash-attn --no-build-isolation
pip install transformers datasets evaluate tqdm accelerate peft sacrebleu matplotlib scitkit-learn

#Data Preprocessing

Download mimic-iii from here: https://physionet.org/content/mimiciii/1.4/

Run:

preprocess1_mimic_iii_events_icu.py
preprocess2_events_icu_pickle.py
preprocess3_limitforward.py
preprocess4_icd_codes.py
preprocess5_icd_codes.py

#Model Training

Run:

pretrain_LLM_textual_reduced.py
pretrain_LLM_textual_reduced_pipeline.py
pretrain_LLM_textual_reduced_multimodal.py
pretrain_LLM_textual_reduced_icd.py

#Model Testing

Run:

python test_LLM_textual_reduced.py --load_path train_path
python test_LLM_textual_reduced_pipeline.py --load_path train_path
python test_LLM_textual_reduced_multimodal.py --load_path train_path
python test_LLM_textual_reduced_icd.py --load_path train_path
python test_LLM_textual_reduced_icd_ext.py --load_path train_path
python test_LLM_textual_reduced_zero_shot.py --load_path train_path

#Value correctness and Inference correctness

Run:

analyse_results_latex.py generations_file