| 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 | |