YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
CXR-VLM: Unified Vision-Language Model for Chest X-ray Interpretation
A lightweight Vision-Language Model for three tasks on chest X-rays:
- Findings Generation β detailed radiological findings
- Impression Generation β concise clinical summary
- Visual Question Answering (VQA) β answer specific clinical questions
Architecture (based on RaDialog)
CXR Image
β
BioViL-T Encoder (frozen) β domain-specific CXR encoder
β [768-dim patch features]
MLP Projection Layer (trained) β align to LLM space
β [32 image tokens]
+ CheXpert Findings (structured labels, optional)
+ Task Instruction Prompt
β
Vicuna-7B + LoRA (LLM trained with LoRA)
β
Output Text (findings / impression / answer)
Project Structure
cxr_vlm/
βββ configs/
β βββ model_config.yaml # model hyperparameters
β βββ train_config.yaml # training hyperparameters
βββ model/
β βββ __init__.py
β βββ image_encoder.py # BioViL-T wrapper
β βββ projection.py # MLP alignment layer
β βββ chexpert_classifier.py # CheXpert structured findings classifier
β βββ cxr_vlm.py # full model (encoder + projection + LLM)
βββ data/
β βββ __init__.py
β βββ dataset.py # CXRInstructDataset (load later)
β βββ prompt_templates.py # instruction templates for 3 tasks
β βββ collator.py # DataCollator for variable-length inputs
βββ training/
β βββ __init__.py
β βββ trainer.py # custom HuggingFace Trainer
β βββ train.py # main training entry point
βββ evaluation/
β βββ __init__.py
β βββ metrics.py # BLEU, ROUGE, ClinicalF1, BERTScore
β βββ evaluate.py # evaluation entry point
βββ utils/
β βββ __init__.py
β βββ logger.py # logging setup
β βββ checkpoint.py # save/load utilities
βββ scripts/
β βββ train.sh # training shell script
β βββ evaluate.sh # evaluation shell script
βββ README.md
Setup
conda create -n cxr_vlm python=3.10
conda activate cxr_vlm
conda install pytorch==2.0.1 torchvision==0.15.2 pytorch-cuda=11.7 -c pytorch -c nvidia
pip install -r requirements.txt
Training
bash scripts/train.sh
Evaluation
bash scripts/evaluate.sh
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support