Model card for beitv2_base_patch16_224.beph

A BEiT v2 Vision Transformer (ViT-Base/16) histopathology foundation model (BEPH).
BEiT v2 pre-training on TCGA whole-slide patches.

Model Details

Model Usage

Image Embeddings

from urllib.request import urlopen
from PIL import Image
import timm

# get example image
img = Image.open(
  urlopen("https://github.com/owkin/HistoSSLscaling/raw/main/assets/example.tif")
).convert('RGB')

# load model from the hub
model = timm.create_model(
  model_name="hf-hub:1aurent/beitv2_base_patch16_224.beph",
  pretrained=True,
).eval()

# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)

data = transforms(img).unsqueeze(0) # input is a (batch_size, num_channels, img_size, img_size) shaped tensor
output = model(data)  # output is a (batch_size, num_features) shaped tensor

Citation

@article{yang2025beph,
  title  = {A foundation model for generalizable cancer diagnosis and survival prediction from histopathological images},
  author = {Yang, Zhaochang and Wei, Ting and Liang, Ying and Yuan, Xin and Gao, RuiTian and Xia, Yujia and Zhou, Jie and Zhang, Yue and Yu, Zhangsheng},
  journal = {Nature Communications},
  volume = {16},
  pages  = {2366},
  year   = {2025},
  doi    = {10.1038/s41467-025-57587-y}
}
Downloads last month
74
Safetensors
Model size
85.8M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support