Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
tags:
|
| 4 |
+
- pathology
|
| 5 |
+
- cell-classification
|
| 6 |
+
- pytorch
|
| 7 |
+
- torch-export
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# MetPredict-cell-reclassifier
|
| 11 |
+
|
| 12 |
+
Per-cell MLP classifier. Maps **histoplus 768-dim cell features** to
|
| 13 |
+
softmax probabilities over: `['background', 'tumor']`.
|
| 14 |
+
|
| 15 |
+
Exported with `torch.export` (batch dim: `dynamic`, feature dim: `768`).
|
| 16 |
+
The exported program wraps `MLP + softmax`, so the output is probabilities
|
| 17 |
+
directly — no model class required at load time.
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from huggingface_hub import hf_hub_download
|
| 23 |
+
import json, torch
|
| 24 |
+
|
| 25 |
+
path = hf_hub_download("RendeiroLab/MetPredict-cell-reclassifier", "model.pt2")
|
| 26 |
+
labels = json.loads(open(hf_hub_download("RendeiroLab/MetPredict-cell-reclassifier", "labels.json")).read())["labels"]
|
| 27 |
+
|
| 28 |
+
m = torch.export.load(path).module()
|
| 29 |
+
probs = m(torch.randn(N, 768)) # (N, 2), softmaxed
|
| 30 |
+
pred_idx = probs.argmax(-1)
|
| 31 |
+
pred_class = [labels[i] for i in pred_idx.tolist()]
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## Files
|
| 35 |
+
|
| 36 |
+
- `model.pt2` — `torch.export` program (MLP + softmax)
|
| 37 |
+
- `labels.json` — class index → name map, plus `in_dim` / `n_classes` / `batch`
|
| 38 |
+
- `README.md` — this file
|