Request access to the andrew-pathology encoders

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

These weights (andrew-tile and andrew-slide) are derivatives of Paige Virchow and Paige PRISM, released for NON-COMMERCIAL ACADEMIC RESEARCH ONLY. By requesting access you agree to the terms of the underlying Virchow and PRISM licenses, to use the weights for non-commercial research only, and not to redistribute them.

Log in or Sign Up to review the conditions and access this model content.

andrew-pathology encoders

Two prostate-histopathology encoders that produce the pre-extracted features used by the downstream MIL tasks in the andrew-prostate-pathology repo:

model role arch derived from files
andrew-tile tile / patch encoder ViT-H/14 (DINOv2-trained) paige-ai/Virchow andrew-tile/
andrew-slide slide encoder PRISM (CoCa-style) paige-ai/Prism andrew-slide/

Pipeline: each tile โ†’ andrew-tile โ†’ concat([CLS, mean(patch tokens)]) = 2560-dim embedding โ†’ andrew-slide aggregates the tile embeddings into one slide-level vector.

Repository layout

andrew-tile/
  model.safetensors     # ViT-H/14 weights (timm format)
  config.json           # timm model config
andrew-slide/
  andrew-slide.model.pth # fine-tuned PRISM state_dict

Usage

andrew-tile (patch encoder)

import timm, torch
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file

cfg = hf_hub_download("EstelleXIA/andrew", "andrew-tile/config.json")
wts = hf_hub_download("EstelleXIA/andrew", "andrew-tile/model.safetensors")

model = timm.create_model("vit_huge_patch14_224", pretrained=False,
                          img_size=224, patch_size=14, embed_dim=1280, depth=32,
                          num_heads=16, mlp_ratio=5.3375, global_pool="",
                          num_classes=0, reg_tokens=0, init_values=1e-5)
model.load_state_dict(load_file(wts))
model.eval()

# x: [B, 3, 224, 224], normalized with mean=std=0.5
with torch.inference_mode():
    tokens = model(x)                     # [B, 257, 1280]
    emb = torch.cat([tokens[:, 0], tokens[:, 1:].mean(dim=1)], dim=-1)  # [B, 2560]

andrew-slide (slide encoder)

import torch
from huggingface_hub import hf_hub_download
from transformers import AutoModel

model = AutoModel.from_pretrained("paige-ai/Prism", trust_remote_code=True)
ckpt = hf_hub_download("EstelleXIA/andrew", "andrew-slide/andrew-slide.model.pth")
state = torch.load(ckpt, map_location="cpu")
state = state.get("model_state_dict", state)
model.load_state_dict(state, strict=False)
model.eval()

License

Released for non-commercial academic research only, as derivatives of paige-ai/Virchow and paige-ai/Prism. You must comply with the original Virchow and PRISM licenses. No commercial use; no redistribution of the weights.

Citation

If you use these weights, please cite the andrew-prostate-pathology repository and the original Virchow / PRISM / DINOv2 works.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support