Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- diffusion
|
| 5 |
+
- ddpm
|
| 6 |
+
- sparse-autoencoder
|
| 7 |
+
- jet-physics
|
| 8 |
+
- quark-gluon
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# JetDDPM-SAE — Checkpoints
|
| 12 |
+
|
| 13 |
+
Two stage model on quark/gluon calorimeter jet images (3-channel, 125×125):
|
| 14 |
+
1. DDPM UNet trained to generate realistic jet images.
|
| 15 |
+
2. Sparse Autoencoder on frozen UNet `ups[0]` activations for interpretability.
|
| 16 |
+
|
| 17 |
+
## Checkpoints
|
| 18 |
+
|
| 19 |
+
| File | Description |
|
| 20 |
+
|------|-------------|
|
| 21 |
+
| `diff_checkpoint.pth` | Trained diffusion UNet (raw `state_dict`) |
|
| 22 |
+
| `sae_upblock_checkpoint.pth` | SAE trained on ups[0] activations at t=100 |
|
| 23 |
+
|
| 24 |
+
## Loading diffusion model
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
import torch
|
| 28 |
+
from src.diffusion import Unet
|
| 29 |
+
from src.noise_scheduler import LinNoiseScheduler
|
| 30 |
+
|
| 31 |
+
model = Unet()
|
| 32 |
+
model.load_state_dict(torch.load("diff_checkpoint.pth", map_location="cpu"))
|
| 33 |
+
model.eval()
|
| 34 |
+
|
| 35 |
+
scheduler = LinNoiseScheduler(num_of_timesteps=1000)
|
| 36 |
+
# generate: start from noise and call scheduler.sample_prev_timestep()
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Loading SAE
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from src.sae import SparseAutoencoder
|
| 44 |
+
|
| 45 |
+
ckpt = torch.load("sae_upblock_checkpoint.pth", map_location="cpu")
|
| 46 |
+
model = SparseAutoencoder(input_dim=ckpt["input_dim"], hidden_dim=1024)
|
| 47 |
+
model.load_state_dict(ckpt["model"])
|
| 48 |
+
model.eval()
|
| 49 |
+
|
| 50 |
+
# pass global-avg-pooled ups[0] activations → sparse feature vector z
|
| 51 |
+
recon, z = model(activation_vector)
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Training details
|
| 55 |
+
|
| 56 |
+
- Diffusion: MSE noise prediction, Adam lr=1e-4, 50 epochs, batch 32
|
| 57 |
+
- SAE hook: `ups[0]` (first decoder block, 31×31, 256ch), fixed t=100
|
| 58 |
+
- SAE: MSE + L1(z)·1e-3, Adam lr=1e-3, 50 epochs on 30k activations
|