Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-sa-4.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-sa-4.0
|
| 3 |
+
---
|
| 4 |
+
# 🧠Top-K 300 Sparse Autoencoder (SAE) — SAEdit
|
| 5 |
+
**Repo:** `Ronenk94/T5_matryoshka_sae`
|
| 6 |
+
**Model Type:** Sparse Autoencoder over T5 Embeddings
|
| 7 |
+
**Paper:** *SAEdit: Token-level control for continuous image editing via Sparse AutoEncoder*
|
| 8 |
+
**License:** CC BY 4.0
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## 📌 Model Overview
|
| 13 |
+
|
| 14 |
+
This repository contains the **Top-K 300 Sparse Autoencoder (SAE)** used in the SAEdit framework.
|
| 15 |
+
It is trained on **T5 text embeddings** and designed to produce **sparse latent representations** that enable *token-level semantic control* in image editing pipelines.
|
| 16 |
+
|
| 17 |
+
| Property | Details |
|
| 18 |
+
|----------|--------|
|
| 19 |
+
| **Architecture** | GlobalBatchTopKMatryoshkaSAE |
|
| 20 |
+
| **Latent sparsity** | Top-K = 300 activations |
|
| 21 |
+
| **Backbone embeddings** | Frozen T5 encoder |
|
| 22 |
+
| **Task** | Semantic factorization + reconstruction |
|
| 23 |
+
| **Use case** | Editing directions for diffusion-based image manipulation |
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## 📥 How to Load
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import torch
|
| 31 |
+
from src.models.sparse_autoencoders.matryoshka_sae import GlobalBatchTopKMatryoshkaSAE
|
| 32 |
+
|
| 33 |
+
# Option A — using a from_pretrained method (if implemented)
|
| 34 |
+
model = GlobalBatchTopKMatryoshkaSAE.from_pretrained(
|
| 35 |
+
"Ronenk94/T5_matryoshka_sae",
|
| 36 |
+
device="cuda"
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
# Option B — manual load if using state_dict
|
| 40 |
+
checkpoint = torch.load("pytorch_model.bin", map_location="cpu")
|
| 41 |
+
with open("config.json", "r") as f:
|
| 42 |
+
cfg = json.load(f)
|
| 43 |
+
|
| 44 |
+
model = GlobalBatchTopKMatryoshkaSAE(cfg)
|
| 45 |
+
model.load_state_dict(checkpoint)
|
| 46 |
+
model.to("cuda").eval()
|
| 47 |
+
|