Update README
Browse files
README.md
CHANGED
|
@@ -9,7 +9,7 @@ language:
|
|
| 9 |
## Model Summary
|
| 10 |
|
| 11 |
|
| 12 |
-
**HistAug** is a lightweight transformer-based generator for **controllable latent-space augmentations** in the feature space of the [H-optimus-1 foundation model](https://huggingface.co/bioptimus/H-optimus-1). Instead of applying costly image-space augmentations on millions of WSI patches, HistAug operates **directly on patch embeddings** extracted from a given foundation model(here H-optimus-1). By conditioning on explicit transformation parameters (e.g., hue shift, erosion, HED color transform), HistAug generates realistic augmented embeddings while preserving semantic content. In practice, the H-optimus-1 variant of HistAug can reconstruct the corresponding ground-truth augmented embeddings with an average cosine similarity of **about
|
| 13 |
|
| 14 |
This enables training of Multiple Instance Learning (MIL) models with:
|
| 15 |
- ⚡ **Fast augmentation**
|
|
@@ -195,39 +195,52 @@ for bag_features, label in loader: # bag_features: (num_patches, embed_dim)
|
|
| 195 |
|
| 196 |
## Offline usage (HPC clusters without internet)
|
| 197 |
|
| 198 |
-
If
|
| 199 |
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
```bash
|
| 203 |
# On the front-end/login node (with internet):
|
| 204 |
python -c "from transformers import AutoModel; AutoModel.from_pretrained('sofieneb/histaug-hoptimus1', trust_remote_code=True)"
|
|
|
|
| 205 |
|
| 206 |
-
|
| 207 |
-
export HF_HUB_OFFLINE=1
|
| 208 |
-
export TRANSFORMERS_OFFLINE=1
|
| 209 |
-
````
|
| 210 |
|
| 211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
-
|
| 214 |
|
| 215 |
```bash
|
| 216 |
# On the front-end/login node (with internet):
|
| 217 |
hf download sofieneb/histaug-hoptimus1 --local-dir ./histaug-hoptimus1
|
| 218 |
```
|
| 219 |
|
| 220 |
-
Then
|
| 221 |
|
| 222 |
```python
|
| 223 |
from transformers import AutoModel
|
| 224 |
-
|
| 225 |
cross_transformer = AutoModel.from_pretrained(
|
| 226 |
"./histaug-hoptimus1", # local path instead of hub ID
|
| 227 |
trust_remote_code=True,
|
| 228 |
-
local_files_only=True
|
| 229 |
)
|
| 230 |
```
|
|
|
|
| 231 |
---
|
| 232 |
## Citation
|
| 233 |
If our work contributes to your research, or if you incorporate part of this code, please consider citing our paper:
|
|
|
|
| 9 |
## Model Summary
|
| 10 |
|
| 11 |
|
| 12 |
+
**HistAug** is a lightweight transformer-based generator for **controllable latent-space augmentations** in the feature space of the [H-optimus-1 foundation model](https://huggingface.co/bioptimus/H-optimus-1). Instead of applying costly image-space augmentations on millions of WSI patches, HistAug operates **directly on patch embeddings** extracted from a given foundation model(here H-optimus-1). By conditioning on explicit transformation parameters (e.g., hue shift, erosion, HED color transform), HistAug generates realistic augmented embeddings while preserving semantic content. In practice, the H-optimus-1 variant of HistAug can reconstruct the corresponding ground-truth augmented embeddings with an average cosine similarity of **about 82%** at **10X, 20X, and 40X magnification**.
|
| 13 |
|
| 14 |
This enables training of Multiple Instance Learning (MIL) models with:
|
| 15 |
- ⚡ **Fast augmentation**
|
|
|
|
| 195 |
|
| 196 |
## Offline usage (HPC clusters without internet)
|
| 197 |
|
| 198 |
+
If compute nodes don’t have internet, **always** run jobs with the offline flags to **prevent unnecessary network calls** and force local loads:
|
| 199 |
|
| 200 |
+
```bash
|
| 201 |
+
# On your compute job (no internet):
|
| 202 |
+
export HF_HUB_OFFLINE=1
|
| 203 |
+
export TRANSFORMERS_OFFLINE=1
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
Prepare the model **in advance** on a front-end/login node (with internet), then choose **either** approach below.
|
| 207 |
+
|
| 208 |
+
### Option — Warm the cache (simplest)
|
| 209 |
|
| 210 |
```bash
|
| 211 |
# On the front-end/login node (with internet):
|
| 212 |
python -c "from transformers import AutoModel; AutoModel.from_pretrained('sofieneb/histaug-hoptimus1', trust_remote_code=True)"
|
| 213 |
+
```
|
| 214 |
|
| 215 |
+
Then in your offline job/script:
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
```python
|
| 218 |
+
from transformers import AutoModel
|
| 219 |
+
model = AutoModel.from_pretrained(
|
| 220 |
+
"sofieneb/histaug-hoptimus1",
|
| 221 |
+
trust_remote_code=True,
|
| 222 |
+
local_files_only=True, # uses local cache only
|
| 223 |
+
)
|
| 224 |
+
```
|
| 225 |
|
| 226 |
+
### Option — Download to a local folder with `hf download`
|
| 227 |
|
| 228 |
```bash
|
| 229 |
# On the front-end/login node (with internet):
|
| 230 |
hf download sofieneb/histaug-hoptimus1 --local-dir ./histaug-hoptimus1
|
| 231 |
```
|
| 232 |
|
| 233 |
+
Then in your offline job/script:
|
| 234 |
|
| 235 |
```python
|
| 236 |
from transformers import AutoModel
|
|
|
|
| 237 |
cross_transformer = AutoModel.from_pretrained(
|
| 238 |
"./histaug-hoptimus1", # local path instead of hub ID
|
| 239 |
trust_remote_code=True,
|
| 240 |
+
local_files_only=True, # uses local files only
|
| 241 |
)
|
| 242 |
```
|
| 243 |
+
|
| 244 |
---
|
| 245 |
## Citation
|
| 246 |
If our work contributes to your research, or if you incorporate part of this code, please consider citing our paper:
|