Skip to content

Commit b746fe4

Browse files
committed
fix submodule; update README (data preparation, training)
1 parent f021798 commit b746fe4

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,30 @@ cd MMMM
88
mamba env create -f environment.yaml
99
BUILD_MONAI=1 pip install --no-build-isolation -e third-party/LuoLib/third-party/MONAI
1010
mamba activate mmmm
11+
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
1112
echo \
12-
"export PYTHONPATH=$PWD:$PWD/third-party/LuoLib
13+
"export PYTHONPATH=$PWD:$PYTHONPATH
1314
export BUILD_MONAI=1" \
1415
>> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
15-
1616
```
17-
, and build xformers from source / install pre-built wheel.
1817

19-
Manually modify `pad_nd` according to: https://github.com/Project-MONAI/MONAI/issues/7842
18+
## Data Preparation
19+
20+
Download the datasets (MIMIC-CXR, CT-RATE, etc.) and extract them to `data/origin/<data type>/<dataset name>`, where `<data type>` can be `local` for image datasets with localization (bounding boxes, segmentation) annotations and `vision-language` for VQA and radiology report datasets.
21+
22+
Then execute pre-processing scripts for each dataset. For instance, for MIMIC-CXR, execute the script at `scripts/data/vl/MIMIC-CXR/MIMIC-CXR.py` to pre-process the data. After the pre-processing is finished, the pre-processed data are placed at `data/processed/vision-language/MIMIC-CXR`, where `<split>.json` specifies the data items for each split.
23+
24+
## Training
25+
26+
[THUDM/cogvlm-chat-hf](https://huggingface.co/THUDM/cogvlm-chat-hf) is used as the base VLM.
27+
28+
The example commands for running the three-stage training of VividMed are as follows. Please adapt your number of devices and batch size accordingly. Note that we disable `torch.compile` due the compatibility issue with our dependencies, enable it if you're ready to address it.
29+
30+
```zsh
31+
# Stage 1: Visual Grounding Pre-training
32+
python scripts/cli.py fit -c conf/phase-vg/fit.yaml --compile false --data.dataloader.train_batch_size ... --trainer.accumulate_grad_batches ... --seed_everything $RANDOM --model.freeze_sam false --model.freeze_isam false
33+
# Stage 2: Medical Visual Instruction Tuning
34+
python scripts/cli.py fit -c conf/phase-vlm/fit.yaml --compile false --data.dataloader.train_batch_size ... --trainer.accumulate_grad_batches ... --seed_everything $RANDOM
35+
# Stage 3: Alignment (grounded report generate)
36+
python scripts/cli.py fit -c conf/phase-grg/fit.yaml --compile false --data.dataloader.train_batch_size ... --trainer.accumulate_grad_batches ... --seed_everything $RANDOM --model.freeze_sam false --model.freeze_isam false
37+
```

luolib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
third-party/LuoLib/luolib
1+
third-party/LuoLib/src/luolib

third-party/LuoLib

Submodule LuoLib updated 167 files

0 commit comments

Comments
 (0)