SlideChat-Virchow2 is an advanced pathology report generation system that adapts the SlideChat architecture to leverage 2560-dimensional Virchow2 features for automated WSI report generation. This repository contains the complete training pipeline for the REG2025 Challenge.
This system addresses automated pathology report generation from whole-slide images (WSIs) through three key innovations:
# Activate the reg2025 conda environment
conda activate reg2025
# Install dependencies
pip install -r requirements.txt
# Stage 1: Cross-domain alignment
python scripts/run_training.py --stage 1
# Stage 2: Visual instruction fine-tuning (automatically loads best Stage 1 checkpoint)
python scripts/run_training.py --stage 2 --stage1-checkpoint models/run_X/checkpoints/iter_Y.pth
# Evaluate trained model
python scripts/evaluate_reg2025.py --model_path models/run_X --test_data data/annotations/val.json
WSI Preprocessing (TRIDENT/)
SlideChat Model (SlideChat/xtuner/)
Training Pipeline
WSI → TRIDENT → 2560D Features → SlideChat Encoder → LongNet → Qwen2.5 → Report
├── SlideChat/ # Modified XTuner framework with 2560D support
├── TRIDENT/ # WSI preprocessing toolkit
├── reg/ # REG2025 evaluation metrics
├── configs/ # Training configurations
│ ├── reg2025_stage1.py # Stage 1: Cross-domain alignment
│ └── reg2025_stage2.py # Stage 2: Visual instruction tuning
├── scripts/ # Training and evaluation scripts
├── data/ # Training data and features
├── models/ # Model checkpoints and outputs
└── manuscript/ # Research paper and documentation
Formula: REG2025 Score = 0.15 × (ROUGE + BLEU) + 0.4 × KEY + 0.3 × EMB
# Key settings for projector-only training
freeze_llm = True
freeze_visual_encoder = True
batch_size = 1
accumulative_counts = 4
lr = 5e-4
max_epochs = 100
save_steps = 50
evaluation_freq = 50
# Settings for full model fine-tuning
freeze_llm = False
lora_config = dict(r=16, alpha=32)
batch_size = 1
accumulative_counts = 8
lr = 2e-5
max_epochs = 50
SlideChat/xtuner/dataset/utils.py: Dynamic 2560D feature loadingSlideChat/xtuner/dataset/llava.py: WSI-specific data handlingSlideChat/xtuner/model/llava.py: LongNet integration for long sequencesscripts/reg2025_validation_hook.py: MMEngine hook for integrated evaluationscripts/fix_slidechat_dimensions.py: Automated patching for 2560D supportIf you use this work, please cite:
@article{yin2025slidechat,
title={SlideChat-Virchow2: Pathology Report Generation with 2560D Feature Adaptation and LongNet Architecture for REG2025 Challenge},
author={Yin, Shuolin and Ma, Jun},
journal={arXiv preprint},
year={2025}
}
This project is licensed under the MIT License - see the LICENSE file for details.
10 commits
Python
96.9%
TeX
1.9%
Jupyter Notebook
1.1%
SlideChat-Virchow2 is an advanced pathology report generation system that adapts the SlideChat architecture to leverage 2560-dimensional Virchow2 features for automated WSI report generation. This repository contains the complete training pipeline for the REG2025 Challenge.
This system addresses automated pathology report generation from whole-slide images (WSIs) through three key innovations:
# Activate the reg2025 conda environment
conda activate reg2025
# Install dependencies
pip install -r requirements.txt
# Stage 1: Cross-domain alignment
python scripts/run_training.py --stage 1
# Stage 2: Visual instruction fine-tuning (automatically loads best Stage 1 checkpoint)
python scripts/run_training.py --stage 2 --stage1-checkpoint models/run_X/checkpoints/iter_Y.pth
# Evaluate trained model
python scripts/evaluate_reg2025.py --model_path models/run_X --test_data data/annotations/val.json
WSI Preprocessing (TRIDENT/)
SlideChat Model (SlideChat/xtuner/)
Training Pipeline
WSI → TRIDENT → 2560D Features → SlideChat Encoder → LongNet → Qwen2.5 → Report
├── SlideChat/ # Modified XTuner framework with 2560D support
├── TRIDENT/ # WSI preprocessing toolkit
├── reg/ # REG2025 evaluation metrics
├── configs/ # Training configurations
│ ├── reg2025_stage1.py # Stage 1: Cross-domain alignment
│ └── reg2025_stage2.py # Stage 2: Visual instruction tuning
├── scripts/ # Training and evaluation scripts
├── data/ # Training data and features
├── models/ # Model checkpoints and outputs
└── manuscript/ # Research paper and documentation
Formula: REG2025 Score = 0.15 × (ROUGE + BLEU) + 0.4 × KEY + 0.3 × EMB
# Key settings for projector-only training
freeze_llm = True
freeze_visual_encoder = True
batch_size = 1
accumulative_counts = 4
lr = 5e-4
max_epochs = 100
save_steps = 50
evaluation_freq = 50
# Settings for full model fine-tuning
freeze_llm = False
lora_config = dict(r=16, alpha=32)
batch_size = 1
accumulative_counts = 8
lr = 2e-5
max_epochs = 50
SlideChat/xtuner/dataset/utils.py: Dynamic 2560D feature loadingSlideChat/xtuner/dataset/llava.py: WSI-specific data handlingSlideChat/xtuner/model/llava.py: LongNet integration for long sequencesscripts/reg2025_validation_hook.py: MMEngine hook for integrated evaluationscripts/fix_slidechat_dimensions.py: Automated patching for 2560D supportIf you use this work, please cite:
@article{yin2025slidechat,
title={SlideChat-Virchow2: Pathology Report Generation with 2560D Feature Adaptation and LongNet Architecture for REG2025 Challenge},
author={Yin, Shuolin and Ma, Jun},
journal={arXiv preprint},
year={2025}
}
This project is licensed under the MIT License - see the LICENSE file for details.
10 commits
Python
96.9%
TeX
1.9%
Jupyter Notebook
1.1%