File size: 1,103 Bytes
dbbba05 | 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 | ---
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
```python
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.pt2` — `torch.export` program (MLP + softmax)
- `labels.json` — class index → name map, plus `in_dim` / `n_classes` / `batch`
- `README.md` — this file
|