Downloads · 30 days
0
mengflz/pasta-benchmark-rep-genes
pasta-benchmark-rep-genes is a image-to-image model from mengflz. Use it when you need one image transformed into another. It is set up for pytorch. The card lists the license as gpl-3.0.
This repository contains PASTA (PAthological Spatial Transcriptome-guided pAradigm) models trained for predicting 100 representative gene expressions from H&E-stained pathology images.
Downloads · 30 days
0
Access
Public
Updated Jan 10, 2026
Repo size
2.9 GB
Likes
0
Public
Click a slice to open those files.
.pt2.9 GB · 100%
From the Hugging Face model README
This repository contains PASTA (PAthological Spatial Transcriptome-guided pAradigm) models trained for predicting 100 representative gene expressions from H&E-stained pathology images.
PASTA is a deep learning framework that can predict spatial gene expression patterns directly from histology images. These benchmark models were trained on HEST-library human data with various foundation model backbones to evaluate their performance on gene expression prediction tasks.
This repository includes 16 models trained with different backbone encoders:
PLIP_rep_genes.pt - Based on PLIP backboneUNI_rep_genes.pt - Based on UNI backboneVirchow_rep_genes.pt - Based on Virchow backboneHibou-B_rep_genes.pt - Based on Hibou-B backbonePhikonv2_rep_genes.pt - Based on Phikon backboneH-optimus-1_rep_genes.pt - Based on H-optimus-1 backboneUNIv2_rep_genes.pt - Based on UNI backboneKaiko-L_rep_genes.pt - Based on Kaiko-L backboneH-optimus-0_rep_genes.pt - Based on H-optimus-0 backboneKaiko-B_rep_genes.pt - Based on Kaiko-B backboneHibou-L_rep_genes.pt - Based on Hibou-L backboneVirchow2_rep_genes.pt - Based on Virchow backboneCONCH_rep_genes.pt - Based on CONCH backbonegigapath_rep_genes.pt - Based on gigapath backbonePhikon_rep_genes.pt - Based on Phikon backboneUNI_pos_emb_rep_genes.pt - Based on UNI backbone(trained with paired ST data)Notes on variants:
pos: Trained with coarse-grained pathway score/gene expression as positional embeddings. In these variants, you can use coarse-grained pathway scores/gene expression as an optional input.pip install torch torchvision huggingface_hub
import torch
from huggingface_hub import hf_hub_download
# Download model weights
model_path = hf_hub_download(
repo_id="mengflz/pasta-benchmark-rep-genes",
filename="UNI_rep_genes.pt"
)
# Load the model
checkpoint = torch.load(model_path, map_location='cpu')
🌟 To use PASTA models for inference, please follow the code in PASTA codebase and confirm that you have the access to related backbone foundation models.
import torch
from pasta.model import PASTA
from huggingface_hub import hf_hub_download
from PIL import Image
import torchvision.transforms as transforms
# Download model checkpoint
model_path = hf_hub_download(
repo_id="mengflz/pasta-benchmark-rep-genes",
filename="UNI_rep_genes.pt"
)
# Initialize PASTA model
model = PASTA(
model_name='UNI',
pathway_dim=100,
freq_flag=True,
N=128,
scale=1.0
)
# Load trained weights
checkpoint = torch.load(model_path, map_location='cpu')
model.load_state_dict(checkpoint, strict=False)
model.eval()
# Prepare input image
transform = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
image = Image.open("path/to/histology_image.png")
input_tensor = transform(image).unsqueeze(0)
# Run inference
with torch.no_grad():
feat, feat_mean, feat_recon = model(input_tensor)
# feat: spatial gene expression map [B, 100, H, W]
# feat_mean: average expression per gene [B, 100]
# feat_recon: reconstructed image [B, 3, H, W]
These models were benchmarked on HEST-library for gene expression prediction performance. The evaluation metrics including PCC, SSIM and RMSE at different resolution(100µm, 64µm, 32µm, 16µm).
Please refer to the original PASTA paper or PASTA Github repository for more details.
If you use these models in your research, please cite:
This project is licensed under GPL-3.0. Please note that the underlying foundation models (UNI, Virchow, etc.) have their own licenses that must be respected.
For questions and issues, please open an issue on the repository or contact the authors.
.
├── README.md # This file
├── UNI_rep_genes.pt # Model weights
├── UNI_rep_config.json # Configuration for each model
├── Virchow_rep_genes.pt
├── Virchow_rep_config.json
└── ... (other model files)