File size: 3,260 Bytes
37f8fae 96f02e6 37f8fae 96f02e6 37f8fae 96f02e6 37f8fae 96f02e6 37f8fae 9cf3627 37f8fae | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | ---
datasets:
- ogutsevda/graph-tcga-brca
library_name: pytorch
license: apache-2.0
pipeline_tag: graph-ml
tags:
- graph-neural-networks
- histopathology
- self-supervised-learning
- pytorch-geometric
- graph-representation-learning
---
# GrapHist: Graph Self-Supervised Learning for Histopathology
This repository contains the pre-trained model from the paper [GrapHist: Graph Self-Supervised Learning for Histopathology](https://huggingface.co/papers/2603.00143).
Pre-trained on the [graph-tcga-brca](https://huggingface.co/datasets/ogutsevda/graph-tcga-brca) dataset, it employs an **ACM-GIN** (Adaptive Channel Mixing Graph Isomorphism Network) encoder-decoder architecture with a masked node attribute prediction objective.
- **Paper:** [arXiv:2603.00143](https://arxiv.org/abs/2603.00143)
- **Code:** [GitHub Repository](https://github.com/ogutsevda/graphist)
<p align="center">
<img src="graphist.png" alt="GrapHist architecture" width="100%">
</p>
## Repository Structure
```
graphist/
βββ graphist.pt # Pre-trained model checkpoint
βββ graphist.png # Architecture overview
βββ models/
β βββ __init__.py # build_model(args) factory
β βββ edcoder.py # PreModel encoder-decoder wrapper
β βββ acm_gin.py # ACM-GIN backbone (encoder/decoder)
β βββ utils.py # Activation and normalization helpers
βββ README.md
```
## Requirements
```bash
pip install torch torch-geometric huggingface_hub
```
The model expects graphs in PyTorch Geometric format with `x`, `edge_index`, `edge_attr`, and `batch`.
## Usage
### 1. Clone the repository
```python
from huggingface_hub import snapshot_download
repo_path = snapshot_download(repo_id="ogutsevda/graphist")
```
### 2. Build and load the model
```python
import sys, torch
sys.path.insert(0, repo_path)
from models import build_model
class Args:
encoder = "acm_gin"
decoder = "acm_gin"
drop_edge_rate = 0.0
mask_rate = 0.5
replace_rate = 0.1
num_hidden = 512
num_layers = 5
num_heads = 4
num_out_heads = 1
residual = None
attn_drop = 0.1
in_drop = 0.2
norm = None
negative_slope = 0.2
batchnorm = False
activation = "prelu"
loss_fn = "sce"
alpha_l = 3
concat_hidden = True
num_features = 46
num_edge_features = 1
args = Args()
model = build_model(args)
checkpoint = torch.load(f"{repo_path}/graphist.pt", weights_only=False)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
```
### 3. Generate embeddings
```python
with torch.no_grad():
embeddings = model.embed(
batch.x, batch.edge_index, batch.edge_attr, batch.batch
)
```
## Acknowledgements
The model architecture adapts code from [GraphMAE](https://github.com/THUDM/GraphMAE) and [ACM-GNN](https://github.com/SitaoLuan/ACM-GNN).
## Citation
```bibtex
@misc{ogut2026graphist,
title={GrapHist: Graph Self-Supervised Learning for Histopathology},
author={Sevda ΓΔΓΌt and CΓ©dric Vincent-Cuaz and Natalia Dubljevic and Carlos Hurtado and Vaishnavi Subramanian and Pascal Frossard and Dorina Thanou},
year={2026},
eprint={2603.00143},
url={https://arxiv.org/abs/2603.00143},
}
``` |