milkzheng's picture
Upload README.md with huggingface_hub
dbbba05 verified
|
Raw
History Blame Contribute Delete
1.1 kB
metadata
license: cc-by-nc-4.0
tags:
  - pathology
  - cell-classification
  - pytorch
  - torch-export

MetPredict-cell-reclassifier

Per-cell MLP classifier. Maps histoplus 768-dim cell features to softmax probabilities over: ['background', 'tumor'].

Exported with torch.export (batch dim: dynamic, feature dim: 768). The exported program wraps MLP + softmax, so the output is probabilities directly — no model class required at load time.

Usage

from huggingface_hub import hf_hub_download
import json, torch

path = hf_hub_download("RendeiroLab/MetPredict-cell-reclassifier", "model.pt2")
labels = json.loads(open(hf_hub_download("RendeiroLab/MetPredict-cell-reclassifier", "labels.json")).read())["labels"]

m = torch.export.load(path).module()
probs = m(torch.randn(N, 768))       # (N, 2), softmaxed
pred_idx = probs.argmax(-1)
pred_class = [labels[i] for i in pred_idx.tolist()]

Files

  • model.pt2torch.export program (MLP + softmax)
  • labels.json — class index → name map, plus in_dim / n_classes / batch
  • README.md — this file