ontenkutsenko commited on
Commit
44d5492
·
verified ·
1 Parent(s): 2a44b25

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +144 -0
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ pretty_name: Stable Diffusion 1.5 Denoising Trajectories (ID-2K & COCO-10K)
4
+ language:
5
+ - en
6
+ task_categories:
7
+ - text-to-image
8
+ tags:
9
+ - diffusion
10
+ - stable-diffusion
11
+ - latent-diffusion
12
+ - denoising-trajectories
13
+ - retrieval
14
+ - redi
15
+ - ddim
16
+ - interior-design
17
+ - ms-coco
18
+ - synthetic
19
+ size_categories:
20
+ - 10K<n<100K
21
+ viewer: false
22
+ ---
23
+
24
+ # Stable Diffusion 1.5 Denoising Trajectories (ID-2K & COCO-10K)
25
+
26
+ Full DDIM denoising trajectories (every intermediate latent) recorded from **Stable Diffusion 1.5** for **12,000 prompts**, together with the prompts that produced them. The data was built as the knowledge base for retrieval-based diffusion experiments in the MSc thesis *Enhancing the Efficiency of Diffusion Models* (NOVA IMS, 2025), which extends [ReDi](https://arxiv.org/abs/2302.02285): instead of denoising from scratch, a new generation retrieves a similar stored trajectory and resumes from one of its intermediate latents, skipping part of the sampling steps.
27
+
28
+ - **Code:** [ontenkutsenko/Efficient-Retrieval-Based-Diffusion](https://github.com/ontenkutsenko/Efficient-Retrieval-Based-Diffusion)
29
+ - **Author:** Anton Kutsenko
30
+ - **Supervisors:** Mauro Castelli (NOVA IMS) and Marco Buzzelli (University of Milano-Bicocca)
31
+
32
+ ## Subsets
33
+
34
+ | Subset | Files | Prompts | Size | Description |
35
+ |---|---|---:|---:|---|
36
+ | **ID-2K** | `trajectories.h5`, `prompts.jsonl` | 2,000 | 2.0 GB | Synthetic interior-design prompts written by a local LLM |
37
+ | **COCO-10K** | `coco_trajectories.h5`, `coco_prompts.jsonl` | 10,000 | 9.1 GB | Real MS-COCO captions of furniture scenes |
38
+
39
+ **ID-2K.** Structured prompts generated with OpenHermes 2.5 (Mistral 7B) via Ollama. Each prompt was seeded with a randomly sampled space type from a taxonomy covering residential rooms (living rooms, kitchens, bedrooms, home offices…), commercial and institutional interiors (offices, lobbies, clinics, classrooms, museums…), public spaces (cafés, restaurants, airport lounges…) and unusual settings (subway cars, glamping tents, ambulances…). Prompts are long and descriptive, covering materials, lighting, style and audience.
40
+
41
+ **COCO-10K.** 10,000 unique captions sampled (seed 42) from MS-COCO `train2017` images containing at least one of: *chair, couch, potted plant, bed, dining table, toilet*. One caption per image. Captions are short and natural, which makes this subset a harder, more diverse retrieval setting than ID-2K.
42
+
43
+ ## Generation settings
44
+
45
+ | Setting | Value |
46
+ |---|---|
47
+ | Model | [`stable-diffusion-v1-5/stable-diffusion-v1-5`](https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5), fp16 |
48
+ | Library | 🤗 Diffusers |
49
+ | Scheduler | `DDIMScheduler` (η = 0) |
50
+ | Steps | 30 |
51
+ | Guidance scale | 7.5 |
52
+ | Resolution | 512 × 512 (latent 4 × 64 × 64) |
53
+ | Seed | `torch.Generator().manual_seed(1024)` for every prompt |
54
+
55
+ Because every prompt uses the same seed, all trajectories start from the **same initial noise**. Differences between trajectories therefore come only from the prompt, which is what makes nearest-neighbour retrieval over early latents meaningful.
56
+
57
+ ## Data format
58
+
59
+ ### Prompts (`*.jsonl`)
60
+ One JSON object per line, mapping a trajectory ID to its prompt:
61
+
62
+ ```json
63
+ {"ef424318": "Create an image of a luxury villa featuring handcrafted mosaic tile floors, ..."}
64
+ {"1a585a50": "A sandwich on top of a plate with juice."}
65
+ ```
66
+
67
+ The ID is the `xxhash32` hex digest of the prompt text.
68
+
69
+ ### Trajectories (`*.h5`)
70
+ HDF5 files with one gzip-compressed dataset per prompt, named by the same ID.
71
+
72
+ - **Shape:** `(30, 1, 4, 64, 64)`: denoising step × batch × latent channels × height × width
73
+ - **dtype:** `float16`
74
+ - **Index `i`** holds the latent *after* DDIM step `i + 1`. Index `0` is the latent after the first denoising step, index `-1` (29) is the final latent that decodes to the image. The pure-noise starting latent is not stored (it is identical for every prompt; regenerate it with seed 1024).
75
+
76
+ ## Usage
77
+
78
+ ```python
79
+ import json, h5py, torch
80
+ from huggingface_hub import hf_hub_download
81
+ from diffusers import StableDiffusionPipeline
82
+
83
+ repo = "ontenkutsenko/diffusion_trajectories"
84
+ traj_path = hf_hub_download(repo, "trajectories.h5", repo_type="dataset") # ID-2K
85
+ prompt_path = hf_hub_download(repo, "prompts.jsonl", repo_type="dataset")
86
+
87
+ prompts = {}
88
+ with open(prompt_path) as f:
89
+ for line in f:
90
+ prompts.update(json.loads(line))
91
+
92
+ with h5py.File(traj_path, "r") as h5:
93
+ traj_id = next(iter(h5.keys()))
94
+ traj = h5[traj_id][()] # (30, 1, 4, 64, 64) float16
95
+ print(prompts[traj_id], traj.shape)
96
+
97
+ # Decode the final latent to an image
98
+ pipe = StableDiffusionPipeline.from_pretrained(
99
+ "stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch.float16
100
+ ).to("cuda")
101
+ latent = torch.from_numpy(traj[-1]).to("cuda")
102
+ with torch.no_grad():
103
+ image = pipe.vae.decode(latent / pipe.vae.config.scaling_factor).sample
104
+ image = pipe.image_processor.postprocess(image)[0]
105
+ ```
106
+
107
+ Use `h5[traj_id][k]` to read a single step without loading the whole trajectory.
108
+
109
+ ## Intended uses
110
+
111
+ - **Retrieval-based / training-free acceleration** of diffusion sampling (ReDi-style step skipping)
112
+ - **Vector-search research** on high-dimensional latent keys (16,384-dim at a single step), e.g. PCA / Product Quantisation compression
113
+ - **Analysing denoising dynamics:** how and when prompt semantics emerge across steps
114
+ - **Training lightweight models** that predict late latents from early ones (distillation, latent refinement)
115
+
116
+ ## Limitations
117
+
118
+ - Single model, scheduler, step count, guidance scale and seed. Trajectories are not directly reusable with other samplers or step schedules.
119
+ - ID-2K prompts are LLM-generated and share stylistic patterns; they are not real user prompts.
120
+ - COCO-10K is limited to furniture-related scenes and carries MS-COCO caption noise (typos, varying detail).
121
+ - Images are not stored; decode the final latent with the SD 1.5 VAE as shown above.
122
+ - Generated content inherits the biases of Stable Diffusion 1.5 and of its training data.
123
+
124
+ ## License
125
+
126
+ Dataset released under CC BY 4.0. COCO captions come from [MS-COCO](https://cocodataset.org/) (annotations under CC BY 4.0). Latents were generated with Stable Diffusion 1.5, whose outputs are subject to the use restrictions of the [CreativeML OpenRAIL-M](https://huggingface.co/spaces/CompVis/stable-diffusion-license) license.
127
+
128
+ ## Citation
129
+
130
+ ```bibtex
131
+ @mastersthesis{kutsenko2025efficiency,
132
+ author = {Kutsenko, Anton},
133
+ title = {Enhancing the Efficiency of Diffusion Models},
134
+ school = {NOVA Information Management School (NOVA IMS), Universidade Nova de Lisboa},
135
+ year = {2025}
136
+ }
137
+
138
+ @inproceedings{zhang2023redi,
139
+ author = {Zhang, Kexun and Yang, Xianjun and Wang, William Yang and Li, Lei},
140
+ title = {ReDi: Efficient Learning-Free Diffusion Inference via Trajectory Retrieval},
141
+ booktitle = {International Conference on Machine Learning (ICML)},
142
+ year = {2023}
143
+ }
144
+ ```