File size: 3,191 Bytes
2f356cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
license: apache-2.0
task_categories:
- text-to-image
language:
- en
tags:
- diffusion
- distillation
- synthetic
- sana
pretty_name: Diffusion Distillation Workshop (Sana-600M teacher samples)
size_categories:
- 1K<n<10K
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*.parquet
  - split: eval
    path: data/eval-*.parquet
---

# Diffusion Distillation Workshop dataset

Teacher samples for a hands-on workshop on **diffusion step distillation** (Consistency Distillation, LADD, DMD, PDD). The teacher is [Sana-600M-512px](https://huggingface.co/Efficient-Large-Model/Sana_600M_512px_diffusers).

Every row contains the **text prompt**, the teacher's **prompt embeddings**, the **generated latent**, and the **decoded 512×512 image**. With it, a Colab student can skip the 2.6B-parameter Gemma-2 text encoder and the teacher sampling and go straight to distillation.

| split | rows | prompts from |
|---|---|---|
| `train` | 4096 | [open-image-preferences-v1](https://huggingface.co/datasets/data-is-better-together/open-image-preferences-v1) `simplified_prompt`, balanced over its 12 style categories (≈341 each) |
| `eval` | 64 | [PartiPrompts](https://huggingface.co/datasets/nateraw/parti-prompts), balanced over its 12 categories |

## Columns

| column | content |
|---|---|
| `prompt` | the text actually fed to the teacher |
| `source_prompt`, `category`, `subcategory`, `source` | provenance (for PartiPrompts, `subcategory` is the *Challenge*) |
| `seed` | `torch.Generator("cuda").manual_seed(seed)` for the initial noise |
| `image` | decoded 512×512 PNG |
| `latent` | `float16` bytes, shape `(32, 16, 16)`. DC-AE latent in **model space**: the x₀ the transformer sees. Decode with `vae.decode(latent / 0.41407)` |
| `prompt_embeds` | `float16` bytes, shape `(128, 2304)`. Gemma-2 hidden states from Sana's `encode_prompt` with the complex human instruction, `max_sequence_length=128` |
| `prompt_attention_mask` | `uint8` bytes, shape `(128,)` |

`null_prompt_embeds.safetensors` holds the unconditional (empty negative prompt) embedding and mask for classifier-free guidance. `meta.json` holds all generation parameters.

## Generation

`SanaPipeline` default sampler (flow DPM-Solver), 20 steps, CFG 4.5, 512×512, transformer in fp16, Gemma-2 in bf16, DC-AE in fp32. Generated on a single H100.

## Loading

```python
import numpy as np, torch, pyarrow.parquet as pq
from huggingface_hub import hf_hub_download

path = hf_hub_download("leffff/diffusion-distillation-workshop", "data/train-00000-of-00008.parquet", repo_type="dataset")
t = pq.read_table(path, columns=["prompt", "latent", "prompt_embeds", "prompt_attention_mask"]).to_pydict()
latents = torch.from_numpy(np.stack([np.frombuffer(b, np.float16).reshape(32, 16, 16) for b in t["latent"]]))
embeds = torch.from_numpy(np.stack([np.frombuffer(b, np.float16).reshape(128, 2304) for b in t["prompt_embeds"]]))
masks = torch.from_numpy(np.stack([np.frombuffer(b, np.uint8) for b in t["prompt_attention_mask"]])).long()
```

## License

Apache-2.0. The prompts come from apache-2.0 datasets, and the images and latents were generated by the apache-2.0 Sana-600M model.