2ms commited on
Commit
9522baa
·
1 Parent(s): e46a236

update README.md

Browse files
Files changed (1) hide show
  1. README.md +68 -74
README.md CHANGED
@@ -7,88 +7,82 @@ tags:
7
  - EXAONEPath-1.5
8
  - pathology
9
  ---
10
- # EXAONE Path 1.5
 
 
 
11
  ## Introduction
12
- EXAONE Path 1.5 is a whole slide image level(WSI-level) classification framework designed for downstream tasks in pathology, such as cancer subtyping, molecular subtyping and mutation prediction. It builds upon our previous work, EXAONE Path v1.0, which focused on patch-wise feature extraction by dividing a WSI into patches and embedding each patch into a feature vector.
13
- In EXAONE Path 1.5, we extend this pipeline to take an entire WSI as input. Each patch is first processed using the pretrained EXAONE Path 1.0 encoder to extract patch-level features. These features are then aggregated using a ViT-based (Vision Transformer) aggregator module to produce a slide-level representation.
14
- This aggregated representation is subsequently passed through a linear classifier to perform downstream tasks such as molecular subtyping, tumor subtyping, and mutation prediction.
15
- To effectively train the aggregator, we adopt a two-stage learning process:
16
- Pretraining: We employ multimodal learning by aligning slide images with various mRNA gene expression profiles to learn semantically meaningful slide-level representations.
17
- Fine-tuning: The pretrained model is then adapted to specific downstream classification tasks.
18
- In this repository, we release the model trained for EGFR mutation prediction in lung adenocarcinoma (LUAD), enabling researchers to leverage our pipeline for similar molecular pathology applications.
19
- ## Quickstart
20
- ### 1. Hardware Requirements ###
21
- - NVIDIA GPU is required
22
- - Minimum 40GB GPU memory recommended
23
- - Tested on Ubuntu 22.04 with NVIDIA driver version 550.144.03
24
- Note: This implementation requires NVIDIA GPU and drivers. The provided environment setup specifically uses CUDA-enabled PyTorch, making NVIDIA GPU mandatory for running the model.
25
- ### 2. Environment Setup
26
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  pip install -r requirements.txt
28
  ```
29
- ### 3-a. Load the model & Inference
30
- #### Load model with HuggingFace
31
 
 
32
  ```python
33
  from models.exaonepath import EXAONEPathV1p5Downstream
 
34
  hf_token = "YOUR_HUGGING_FACE_ACCESS_TOKEN"
35
- model = EXAONEPathV1p5Downstream.from_pretrained("LGAI-EXAONE/EXAONE-Path-1.5", use_auth_token=hf_token)
36
- slide_path = './samples/wsis/1/1.svs'
37
- probs = model(slide_path)
38
- ```
39
- #### Fast CLI Inference
40
- Before running the command below, make sure you update your Hugging Face token.
41
- Open `tokens.py` and replace the placeholder with your actual token:
42
-
43
- ```python
44
- HF_TOKEN = "YOUR_HUGGING_FACE_ACCESS_TOKEN"
45
  ```
46
-
47
- Then, run inference with:
48
  ```bash
49
  python inference.py --svs_path ./samples/wsis/1/1.svs
50
  ```
51
- ### 3-b. Fine-tuning with Pretrained Weights
52
- We provide example scripts and files to help you fine-tune the model on your own dataset.
53
- The provided script fine-tunes the model using pretrained weights stored in `./pretrained_weight.pth`.
54
-
55
- #### Extract Features from WSI Images
56
- To train the model using WSI images and their corresponding labels,
57
- you must first extract patch-level features from each WSI using our provided feature extractor.
58
-
59
- ```bash
60
- python feature_extract.py --input_dir ./samples/wsis/ --output_dir ./samples/feats/
61
- ```
62
- This will generate .pt feature files in the output_dir.
63
-
64
- #### Fine-tuning
65
- ```bash
66
- bash tuning_script.sh
67
- ```
68
- Inside tuning_script.sh, you can modify the following variables to match your dataset:
69
- ```bash
70
- FEAT_PATH=./samples/feats
71
- LABEL_PATH=./samples/label/label.csv
72
- LABEL_DICT="{'n':0, 'y':1}"
73
- SPLIT_PATH=./samples/splits
74
- ```
75
- Change these paths to point to your own feature, label, and split files to start training.
76
-
77
- ## Model Performance Comparison
78
- | Metric: AUC | Titan(Conch v1.5+iBot, image+text) | PRISM (virchow+pe receiver, Image+text) | CHIEF (CTransPath + CLAM, Image+text, clam+wsi contrastive) | Prov-GigaPath (GigaPath+LongNet, Image-only, mask precision manner) | UNI2-h + CLAM (Image-only) | EXAONE Path 1.5(image+gene expression) |
79
- |--------------------------|----------------------------------|-----------------------------------------|--------------------------------------------------------------|------------------------------------------------------------------------|-----------------------------|------------------|
80
- | **TMB (cutoff 10)** | 0.74 | 0.73 | 0.70 | 0.69 | 0.71 | 0.71 |
81
- | **LUAD-EGFR-mut** | 0.76 | 0.80 | 0.73 | 0.73 | 0.79 | 0.81 |
82
- | **LUAD-KRAS-mut** | 0.61 | 0.65 | 0.61 | 0.66 | 0.60 | 0.63 |
83
- | **LUAD-Gene-overexp[1]** | 0.75 | 0.68 | 0.71 | 0.71 | 0.74 | 0.72 |
84
- | **CRC-MSS/MSI** | 0.89 | 0.88 | 0.86 | 0.90 | 0.90 | 0.89 |
85
- | **BRCA-ER_PR_HER2** | 0.82 | 0.79 | 0.76 | 0.79 | 0.81 | 0.77 |
86
- | **Pan-cancer-Gene-mut[2]** | 0.79 | 0.77 | 0.73 | 0.74 | 0.77 | 0.76 |
87
- | **Avg. AUC** | 0.77 | 0.76 | 0.73 | 0.74 | 0.77 | 0.76 |
88
-
89
- [1]: **lung-gene-overexp**: total 11 genes were evaluated: LAG3, CLDN6, CD274, EGFR, ERBB2, ERBB3, CD276, VTCN1, TACSTD2, FOLR1, MET.
90
-
91
- [2]: **Pan-cancer-Gene-mut**: total 7 genes were evaluated: TP53, KRAS, ALK, PIK3CA, MET, EGFR, PTEN
92
-
93
- ## License
94
- The model is licensed under [EXAONEPath AI Model License Agreement 1.0 - NC](./LICENSE)
 
7
  - EXAONEPath-1.5
8
  - pathology
9
  ---
10
+ # EXAONEPath for CRCMSI – CRCMSI-centric Whole-Slide Image Classifier
11
+ *A purpose-built upgrade of **EXAONE Path 1.5***
12
+
13
+
14
  ## Introduction
15
+ **EXAONEPath for CRCMSI** is an **enhanced whole-slide image (WSI) classification framework** that retains the core architecture of EXAONE Path 1.5 while upgrading its internals for greater efficiency and richer multimodal integration.
16
+
17
+ The pipeline still unfolds in two stages:
18
+
19
+ 1. **Patch-wise feature extraction** Each WSI is tiled into 256 × 256 px patches, which are embedded into 768-dimensional vectors using the frozen **[EXAONE Path v1.0](https://huggingface.co/LGAI-EXAONE/EXAONEPath)** encoder.
20
+ 2. **Slide-level aggregation** – The patch embeddings are aggregated using a Vision Transformer, producing a unified slide-level representation that a lightweight classification head transforms into task-specific probabilities.
21
+
22
+ ---
23
+
24
+ ## Key Improvements
25
+
26
+ - **[FlexAttention](https://pytorch.org/blog/flexattention/) + `torch.compile`**
27
+ *What changed:* Replaced vanilla multi‑head self‑attention with IO‑aware **FlexAttention** kernels and enabled `torch.compile` to fuse the forward/backward graph at runtime. The new kernel layout dramatically improves both memory efficiency and training-and-inference throughput.
28
+
29
+ - **Coordinate‑aware Relative Bias**
30
+ *What changed:* Added an ALiBi‑style distance bias that is computed from the (x, y) patch coordinates themselves, allowing the ViT aggregator to reason about spatial proximity.
31
+
32
+ - **Scalable Mixed‑Omics Encoder (Token‑mixing Transformer)**
33
+ *What changed:* Each omics modality is first tokenised into a fixed‑length set. **All modality‑specific tokens are concatenated into a single sequence and passed through a shared multi‑head self‑attention stack**, enabling direct information exchange across modalities in one shot. The aggregated omics representation is subsequently fused with image tokens via cross‑attention. This release uses **three modalities (RNA, CNV, DNA‑methylation)**, but the design is agnostic to modality count and scales linearly with token number.
34
+
35
+ ---
36
+
37
+
38
+ ## Quick Start
39
+
40
+ ### Requirements
41
+ - NVIDIA GPU (≥ 40 GB)
42
+ - CUDA 12.8
43
+ - pytorch 2.7.0+cu128
44
+
45
+ ### Installation
46
+ ```bash
47
+ git clone https://huggingface.co/LGAI-EXAONE/{MODEL_NAME}.git
48
+ cd {MODEL_NAME}
49
  pip install -r requirements.txt
50
  ```
 
 
51
 
52
+ ### Quick Inference
53
  ```python
54
  from models.exaonepath import EXAONEPathV1p5Downstream
55
+
56
  hf_token = "YOUR_HUGGING_FACE_ACCESS_TOKEN"
57
+ model = EXAONEPathV1p5Downstream.from_pretrained(
58
+ "LGAI-EXAONE/{MODEL_NAME}",
59
+ use_auth_token=hf_token
60
+ )
61
+ probs = model("./samples/wsis/1/1.svs")
62
+ print(f"P(CRCMSI mutant) = {probs[1]:.3f}")
 
 
 
 
63
  ```
64
+
65
+ #### Command‑line
66
  ```bash
67
  python inference.py --svs_path ./samples/wsis/1/1.svs
68
  ```
69
+
70
+
71
+ ### Model Performance Comparison
72
+
73
+ | Metric (AUC) / Task | Titan (Conch v1.5 + iBot, image-text) | PRISM (virchow + perceiver, image-text) | CHIEF (CTransPath + CLAM, image-text, WSI-contrastive) | Prov-GigaPath (GigaPath + LongNet, image-only, mask-prediction) | UNI2-h + CLAM (image-only) | EXAONEPath V1.5 | **{MODEL_NAME}** |
74
+ |------------------------------------|---------------------------------------|-----------------------------------------|--------------------------------------------------------|-----------------------------------------------------------------|---------------------------|------------------------|------------------------|
75
+ | **CRC-MSI** | 0.9370 | 0.9432 | 0.9273 | 0.9541 | <u>0.9808</u> | 0.9537 | **0.9844** |
76
+ | LUAD-TMB (cutoff 10) | 0.6901 | 0.6445 | 0.6501 | 0.6744 | 0.6686 | 0.6846 | 0.6842 |
77
+ | LUAD-EGFR-mut | 0.8197 | 0.8152 | 0.7691 | 0.7623 | 0.8577 | 0.7607 | 0.8564 |
78
+ | LUAD-KRAS-mut | 0.5405 | 0.6299 | 0.4676 | 0.5110 | 0.4690 | 0.5480 | 0.6038 |
79
+ | BRCA-ER | 0.9343 | 0.8998 | 0.9115 | 0.9186 | 0.9454 | 0.9096 | 0.9278 |
80
+ | BRCA-PR | 0.8804 | 0.8613 | 0.8470 | 0.8595 | 0.8770 | 0.8215 | 0.8430 |
81
+ | BRCA-HER2 | 0.8046 | 0.8154 | 0.7822 | 0.7891 | 0.8322 | 0.7811 | 0.8050 |
82
+ | BRCA-TP53 | 0.7879 | 0.8415 | 0.7879 | 0.7388 | 0.8080 | 0.6607 | 0.7656 |
83
+ | BRCA-PIK3CA | 0.7577 | 0.8929 | 0.7015 | 0.7347 | 0.8571 | 0.7066 | 0.7908 |
84
+ | RCC-PBRM1 | 0.6383 | 0.5570 | 0.5129 | 0.5270 | 0.5011 | 0.4445 | 0.5780 |
85
+ | RCC-BAP1 | 0.7188 | 0.7690 | 0.7310 | 0.6970 | 0.7160 | 0.7337 | 0.7323 |
86
+ | COAD-KRAS | 0.7642 | 0.7443 | 0.6989 | 0.8153 | 0.9432 | 0.6790 | 0.8693 |
87
+ | COAD-TP53 | 0.8889 | 0.8160 | 0.7014 | 0.7118 | 0.7830 | 0.8785 | 0.8715 |
88
+ | <span style="color:red">**Average**</span> | 0.7817 | 0.7869 | 0.7299 | 0.7457 | <u>0.7876</u> | 0.7356 | <span style="color:red">**0.7932**</span> |