Add model card
Browse files
README.md
CHANGED
|
@@ -7,39 +7,49 @@ tags:
|
|
| 7 |
- hopfield-networks
|
| 8 |
- memorization
|
| 9 |
- generalization
|
| 10 |
-
- training-checkpoints
|
| 11 |
- cifar10
|
| 12 |
---
|
| 13 |
|
| 14 |
# dm-am-cifar10-unet128
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
Bao Pham, Gabriel Raya, Matteo Negri, Mohammed J. Zaki, Luca Ambrogioni, Dmitry Krotov
|
| 20 |
|
| 21 |
- Paper: https://arxiv.org/abs/2505.21777
|
| 22 |
- Code: https://github.com/Lemon-cmd/Diffusion-Models-and-Associative-Memory
|
| 23 |
|
| 24 |
-
##
|
| 25 |
|
| 26 |
-
38
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Checkpoint format
|
| 30 |
|
| 31 |
-
Each `.pt` is a `torch.save` dict
|
| 32 |
|
| 33 |
| Key | Contents |
|
| 34 |
|---|---|
|
| 35 |
| `model` | Model `state_dict`, saved from a `DistributedDataParallel` wrapper (keys carry a `module.` prefix) |
|
| 36 |
| `ema` | EMA weights, same parameters without the `module.` prefix |
|
| 37 |
| `opt` | Optimizer state (`state`, `param_groups`) |
|
| 38 |
-
| `args` |
|
| 39 |
-
| `iterations` |
|
| 40 |
|
| 41 |
-
|
| 42 |
-
checkpoints, not inference-only weights.
|
| 43 |
|
| 44 |
## Loading
|
| 45 |
|
|
@@ -47,27 +57,27 @@ checkpoints, not inference-only weights.
|
|
| 47 |
from huggingface_hub import hf_hub_download
|
| 48 |
import torch
|
| 49 |
|
|
|
|
| 50 |
path = hf_hub_download("lemoncmd/dm-am-cifar10-unet128", "2.pt")
|
| 51 |
ckpt = torch.load(path, map_location="cpu", weights_only=False)
|
| 52 |
|
| 53 |
-
# EMA weights
|
| 54 |
-
ema = ckpt["ema"]
|
| 55 |
-
|
| 56 |
-
# Raw model weights, stripped of the DDP prefix
|
| 57 |
model = {k.removeprefix("module."): v for k, v in ckpt["model"].items()}
|
| 58 |
```
|
| 59 |
|
| 60 |
Unpickling `ckpt["args"]` needs the training repo's config classes importable
|
| 61 |
-
(`simple_parsing` plus `parse_utils.py` from the code repo).
|
| 62 |
-
|
|
|
|
|
|
|
| 63 |
|
| 64 |
## Citation
|
| 65 |
|
| 66 |
```bibtex
|
| 67 |
-
@
|
| 68 |
title = {Memorization to Generalization: Emergence of Diffusion Models from Associative Memory},
|
| 69 |
-
author = {
|
| 70 |
-
|
| 71 |
-
|
| 72 |
}
|
| 73 |
```
|
|
|
|
| 7 |
- hopfield-networks
|
| 8 |
- memorization
|
| 9 |
- generalization
|
|
|
|
| 10 |
- cifar10
|
| 11 |
---
|
| 12 |
|
| 13 |
# dm-am-cifar10-unet128
|
| 14 |
|
| 15 |
+
Trained **unet128** DDPM diffusion models on **cifar10**, from the
|
| 16 |
+
paper *Memorization to Generalization: Emergence of Diffusion Models from Associative Memory*.
|
| 17 |
|
| 18 |
Bao Pham, Gabriel Raya, Matteo Negri, Mohammed J. Zaki, Luca Ambrogioni, Dmitry Krotov
|
| 19 |
|
| 20 |
- Paper: https://arxiv.org/abs/2505.21777
|
| 21 |
- Code: https://github.com/Lemon-cmd/Diffusion-Models-and-Associative-Memory
|
| 22 |
|
| 23 |
+
## What this contains
|
| 24 |
|
| 25 |
+
38 models, 20.3 GiB total, spanning K = 2 to 50,000.
|
| 26 |
+
|
| 27 |
+
Each file is named `<K>.pt`, where **K is the size of the training set** the model
|
| 28 |
+
was trained on -- not a training step. Every model was trained for the same number
|
| 29 |
+
of iterations; K is the axis the paper sweeps to move the model through its three
|
| 30 |
+
regimes:
|
| 31 |
+
|
| 32 |
+
| Regime | Roughly | Behaviour |
|
| 33 |
+
|---|---|---|
|
| 34 |
+
| Memorization | small K | Each training sample gets its own attractor |
|
| 35 |
+
| Spurious | intermediate K | Emergent attractors that are not training data -- the first signs of generative ability |
|
| 36 |
+
| Generalization | large K | Attractors correspond to novel, coherent samples |
|
| 37 |
+
|
| 38 |
+
Sorting the files numerically walks that transition.
|
| 39 |
|
| 40 |
## Checkpoint format
|
| 41 |
|
| 42 |
+
Each `.pt` is a `torch.save` dict:
|
| 43 |
|
| 44 |
| Key | Contents |
|
| 45 |
|---|---|
|
| 46 |
| `model` | Model `state_dict`, saved from a `DistributedDataParallel` wrapper (keys carry a `module.` prefix) |
|
| 47 |
| `ema` | EMA weights, same parameters without the `module.` prefix |
|
| 48 |
| `opt` | Optimizer state (`state`, `param_groups`) |
|
| 49 |
+
| `args` | Full training config `Namespace`, including `train_size` (matches the filename) |
|
| 50 |
+
| `iterations` | Configured training iterations (identical across files) |
|
| 51 |
|
| 52 |
+
Optimizer state is included, so these are resume-capable, not inference-only.
|
|
|
|
| 53 |
|
| 54 |
## Loading
|
| 55 |
|
|
|
|
| 57 |
from huggingface_hub import hf_hub_download
|
| 58 |
import torch
|
| 59 |
|
| 60 |
+
# the model trained on K=2 samples
|
| 61 |
path = hf_hub_download("lemoncmd/dm-am-cifar10-unet128", "2.pt")
|
| 62 |
ckpt = torch.load(path, map_location="cpu", weights_only=False)
|
| 63 |
|
| 64 |
+
ema = ckpt["ema"] # EMA weights, used for sampling in the paper
|
|
|
|
|
|
|
|
|
|
| 65 |
model = {k.removeprefix("module."): v for k, v in ckpt["model"].items()}
|
| 66 |
```
|
| 67 |
|
| 68 |
Unpickling `ckpt["args"]` needs the training repo's config classes importable
|
| 69 |
+
(`simple_parsing` plus `parse_utils.py` from the code repo). Use
|
| 70 |
+
`weights_only=True` to read only tensors.
|
| 71 |
+
|
| 72 |
+
`MANIFEST.tsv` lists every file with its K and byte size.
|
| 73 |
|
| 74 |
## Citation
|
| 75 |
|
| 76 |
```bibtex
|
| 77 |
+
@inproceedings{Pham2025MemorizationTG,
|
| 78 |
title = {Memorization to Generalization: Emergence of Diffusion Models from Associative Memory},
|
| 79 |
+
author = {Bao Pham and Gabriel Raya and Matteo Negri and Mohammed J. Zaki and Luca Ambrogioni and Dmitry Krotov},
|
| 80 |
+
year = {2025},
|
| 81 |
+
url = {https://arxiv.org/abs/2505.21777}
|
| 82 |
}
|
| 83 |
```
|