RD Flow 64: weights, config, model card and samples
Browse files- README.md +163 -0
- config.json +51 -0
- rd-flow-64.safetensors +3 -0
- samples/autumn-forest.png +0 -0
- samples/kitsune.png +0 -0
- samples/mushroom-house.png +0 -0
- samples/red-potion.png +0 -0
- samples/showcase.png +0 -0
- samples/slime.png +0 -0
- samples/snowy-village.png +0 -0
- samples/tavern.png +0 -0
README.md
CHANGED
|
@@ -1,3 +1,166 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-4.0
|
| 3 |
+
pipeline_tag: text-to-image
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- pixel-art
|
| 8 |
+
- text-to-image
|
| 9 |
+
- flow-matching
|
| 10 |
+
- small-model
|
| 11 |
+
- game-assets
|
| 12 |
+
- sprites
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# RD Flow 64
|
| 16 |
+
|
| 17 |
+
**A 271M-parameter text-to-image model that draws real 64 x 64 pixel art**, made by
|
| 18 |
+
[Retro Diffusion](https://retrodiffusion.ai).
|
| 19 |
+
|
| 20 |
+
[**Try it free in your browser**](https://retrodiffusion.ai/rd-flow#demo) ·
|
| 21 |
+
[Inference code (Windows, Linux, macOS)](https://github.com/Retro-Diffusion/rd-flow-64) ·
|
| 22 |
+
[Prompting guide](https://github.com/Retro-Diffusion/rd-flow-64/blob/main/PROMPTING.md) ·
|
| 23 |
+
[Technical report](https://retrodiffusion.ai/blog/rd-flow-64-technical-report)
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+
RD Flow 64 doesn't draw a big picture and shrink it. It works directly on the 64 x 64 pixel grid and chooses
|
| 28 |
+
each pixel from a palette that it generates along with the image. The result is clean pixel art: every pixel is
|
| 29 |
+
deliberate, colours are limited (about 37 per image on average), and sprites have real transparency.
|
| 30 |
+
|
| 31 |
+
<Gallery>
|
| 32 |
+

|
| 33 |
+

|
| 34 |
+

|
| 35 |
+

|
| 36 |
+

|
| 37 |
+

|
| 38 |
+

|
| 39 |
+
</Gallery>
|
| 40 |
+
|
| 41 |
+
## Demo
|
| 42 |
+
|
| 43 |
+
Try RD Flow 64 directly in your browser, free and with no account:
|
| 44 |
+
[retrodiffusion.ai/rd-flow](https://retrodiffusion.ai/rd-flow#demo).
|
| 45 |
+
|
| 46 |
+
## Small on purpose
|
| 47 |
+
|
| 48 |
+
| | Parameters | vs RD Flow 64 |
|
| 49 |
+
| --- | --- | --- |
|
| 50 |
+
| **RD Flow 64** | **0.27B** (542 MB file) | |
|
| 51 |
+
| Stable Diffusion 1.5 | 0.86B | 3x larger |
|
| 52 |
+
| SDXL | 2.6B | 10x larger |
|
| 53 |
+
| FLUX.1 | 12B | 44x larger |
|
| 54 |
+
| Qwen-Image | 20B | 74x larger |
|
| 55 |
+
|
| 56 |
+
The drawing model fits on a 2 GB GPU, and the whole pipeline runs on an ordinary laptop's CPU.
|
| 57 |
+
An RTX 4090 draws 4 images in 0.7 s. A PC whose GPU has only 2 GB draws them in under a second, with the prompt
|
| 58 |
+
read on the CPU. An 8 GB Mac mini M2 draws them in 25 s on its built-in GPU.
|
| 59 |
+
|
| 60 |
+
## Use it
|
| 61 |
+
|
| 62 |
+
The [GitHub repository](https://github.com/Retro-Diffusion/rd-flow-64) has the inference code and per-OS install
|
| 63 |
+
steps. It downloads these weights automatically:
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
git clone https://github.com/Retro-Diffusion/rd-flow-64
|
| 67 |
+
cd rd-flow-64
|
| 68 |
+
pip install torch && pip install -r requirements.txt
|
| 69 |
+
python generate.py "a red health potion" --expand # an LLM writes the full caption
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from rdflow import Pipeline
|
| 74 |
+
|
| 75 |
+
pipe = Pipeline.load()
|
| 76 |
+
images = pipe(caption, n=4, seed=1) # 64 x 64 RGBA PIL images
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Prompting
|
| 80 |
+
|
| 81 |
+
RD Flow 64 was trained on long, plain, careful descriptions (120-200 words): what the subject is, each part with its
|
| 82 |
+
colours and position, the pose, the view and framing, the background, and the outline and shading. It draws best from
|
| 83 |
+
a caption written the same way. Short prompts work, but much worse. The
|
| 84 |
+
[prompting guide](https://github.com/Retro-Diffusion/rd-flow-64/blob/main/PROMPTING.md) has the structure, examples,
|
| 85 |
+
and a system prompt that turns a short idea into a full caption with any LLM.
|
| 86 |
+
|
| 87 |
+
**Example caption** (transparent sprite):
|
| 88 |
+
|
| 89 |
+
> A small glass flask of red health potion stands upright, centred in the frame. The flask has a rounded, bulbous body that tapers upward into a narrow neck, topped with a short cork stopper in warm tan-brown. The glass is rendered in pale translucent blue-white, with a bright white highlight running down the left side of the bulb. Inside, the red liquid fills the lower two-thirds of the flask, its surface forming a flat horizontal line just below the neck. The liquid is a deep crimson at the bottom, shifting to a lighter red near the top, with a few darker red swirls and a single small bubble rising near the centre. The cork is slightly wider than the neck and sits flush on top, its surface marked with faint darker brown lines. The flask rests on a flat base with no feet or stand. It faces forward, standing still and upright, its widest point at the middle of the body. The flask is centred and fills roughly the middle third of the frame, surrounded by empty space. The whole flask is visible with a clear margin on every side and nothing cut off. The background is transparent. A dark outline surrounds the flask, with soft shading and a light source from the upper left, giving a saturated palette of red, pale blue-white, tan and dark brown.
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
|
| 93 |
+
## Technical specifications
|
| 94 |
+
|
| 95 |
+
| | |
|
| 96 |
+
| --- | --- |
|
| 97 |
+
| Output | 64 x 64 RGBA, with an exact palette (pixels point to palette entries) and binary transparency |
|
| 98 |
+
| Drawing model | 270.9M parameters, hourglass flow transformer, fp16 weights (542 MB); runs in bf16 or fp32 |
|
| 99 |
+
| Prompt reader | first 27 of 36 layers of [Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct), frozen, 3.1B parameters (Apache 2.0, downloaded from Qwen's repository) |
|
| 100 |
+
| Sampling | flow matching, 16 Euler steps, classifier-free guidance 4 |
|
| 101 |
+
| Training data | 525,430 whole 64 x 64 images: 67% generated by Retro Diffusion's own models, 33% hand-made pixel art and illustrations reduced to 64 x 64; every image captioned in detail by a vision model |
|
| 102 |
+
|
| 103 |
+
Measured speed and memory, 4 images per prompt at 16 steps. The prompt is read once per caption; more images of the
|
| 104 |
+
same caption cost only the drawing.
|
| 105 |
+
|
| 106 |
+
| Machine | Read the prompt | Draw 4 images | Peak memory |
|
| 107 |
+
| --- | --- | --- | --- |
|
| 108 |
+
| RTX 4090, everything on the GPU | 0.03 s | 0.7 s | 6.6 GB VRAM |
|
| 109 |
+
| 2 GB GPU (bf16), prompt on the CPU | 19 s | 0.8 s | 0.8 GB VRAM |
|
| 110 |
+
| 2 GB GPU (GTX 10 series, fp32), prompt on the CPU | 19 s | 1.4 s | 1.5 GB VRAM |
|
| 111 |
+
| Mac mini M2, 8 GB, Apple GPU | 20 s | 25 s | 3.3 GB RAM |
|
| 112 |
+
| Mac mini M2, 8 GB, CPU only | 21 s | 67 s | 5.0 GB RAM |
|
| 113 |
+
|
| 114 |
+
## Files
|
| 115 |
+
|
| 116 |
+
| File | |
|
| 117 |
+
| --- | --- |
|
| 118 |
+
| `rd-flow-64.safetensors` | the drawing model, fp16, 270.9M parameters |
|
| 119 |
+
| `config.json` | architecture, sampler defaults and the prompt reader's pinned revision |
|
| 120 |
+
| `samples/` | the images on this page |
|
| 121 |
+
|
| 122 |
+
## How it works
|
| 123 |
+
|
| 124 |
+
- **Pixel-native:** an hourglass flow transformer on the 64 x 64 grid, with a 16 x 16 core that attends jointly
|
| 125 |
+
over the caption, the palette and the image.
|
| 126 |
+
- **Palette first:** the model generates its palette as it draws. Late in sampling, every pixel becomes a pointer to
|
| 127 |
+
one palette entry, so the output never has in-between colours.
|
| 128 |
+
- **Your palette:** pass your own colours and every pixel is drawn from them.
|
| 129 |
+
- **Transparency:** transparent sprites and full-frame pictures from the same model.
|
| 130 |
+
- **Fast:** 16 sampling steps, about 0.13 s per image on one GPU in production.
|
| 131 |
+
|
| 132 |
+
The full design, with the reasoning behind each choice, is in the [technical report](https://retrodiffusion.ai/blog/rd-flow-64-technical-report).
|
| 133 |
+
|
| 134 |
+
## Limitations and biases
|
| 135 |
+
|
| 136 |
+
- **64 x 64 only.** Other sizes need Retro Diffusion's full models.
|
| 137 |
+
- **Long captions.** It was trained on 120-200 word descriptions and is much weaker on short prompts; use the
|
| 138 |
+
[system prompt](https://github.com/Retro-Diffusion/rd-flow-64/blob/main/PROMPTING.md) to have an LLM write them.
|
| 139 |
+
- **Limited knowledge.** Half a million images is small for an image model: it knows common subjects, not everything.
|
| 140 |
+
- **Looser prompt following than the largest models.** It can miss an action or soften an unusual detail, and small
|
| 141 |
+
details may be one or two pixels, or missing.
|
| 142 |
+
- **Opaque pictures are weaker than transparent sprites.** They tend to draw the subject larger and sometimes crop
|
| 143 |
+
it.
|
| 144 |
+
- **Less variety between seeds.** The same caption tends to give similar compositions; change the wording to explore.
|
| 145 |
+
- **No text.** Letters and logos are out of reach.
|
| 146 |
+
- **Bias.** Two thirds of the training images were generated by Retro Diffusion's own models, so the model inherits
|
| 147 |
+
their styles and their biases, along with those of the vision model that captioned the data. Expect common game-art
|
| 148 |
+
conventions in how people, creatures and places are drawn.
|
| 149 |
+
|
| 150 |
+
## References
|
| 151 |
+
|
| 152 |
+
- [RD Flow 64: a pixel art model built from scratch](https://retrodiffusion.ai/blog/rd-flow-64-technical-report),
|
| 153 |
+
the technical report: architecture, data, sampler choices and comparisons with general image models.
|
| 154 |
+
- [Inference code and prompting guide](https://github.com/Retro-Diffusion/rd-flow-64).
|
| 155 |
+
|
| 156 |
+
## More from Retro Diffusion
|
| 157 |
+
|
| 158 |
+
[Retro Diffusion](https://retrodiffusion.ai) is a full pixel art studio built on larger models. It does any size from
|
| 159 |
+
16 to 512 pixels, dozens of styles, animation, tilesets, editing, background removal and 3D, in the browser or
|
| 160 |
+
through the API.
|
| 161 |
+
|
| 162 |
+
## License
|
| 163 |
+
|
| 164 |
+
The weights are licensed under [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/): free for
|
| 165 |
+
non-commercial use with attribution to Retro Diffusion. For commercial use, generate with
|
| 166 |
+
[Retro Diffusion](https://retrodiffusion.ai). The inference code on GitHub is MIT licensed.
|
config.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "RD Flow 64",
|
| 3 |
+
"architecture": "pixflow hourglass flow transformer, palette-pointer head",
|
| 4 |
+
"library": "rdflow (https://github.com/Retro-Diffusion/rd-flow-64)",
|
| 5 |
+
"parameters": 270932357,
|
| 6 |
+
"resolution": 64,
|
| 7 |
+
"dtype": "float16",
|
| 8 |
+
"text_encoder": {
|
| 9 |
+
"repo": "Qwen/Qwen3-VL-4B-Instruct",
|
| 10 |
+
"revision": "ebb281ec70b05090aa6165b016eac8ec08e71b17",
|
| 11 |
+
"layers": 27,
|
| 12 |
+
"max_tokens": 512
|
| 13 |
+
},
|
| 14 |
+
"sampler": {
|
| 15 |
+
"steps": 16,
|
| 16 |
+
"guidance": 4.0,
|
| 17 |
+
"guidance_interval": [
|
| 18 |
+
0.0,
|
| 19 |
+
0.9
|
| 20 |
+
],
|
| 21 |
+
"shift": 3.0
|
| 22 |
+
},
|
| 23 |
+
"config": {
|
| 24 |
+
"size": 64,
|
| 25 |
+
"d0": 128,
|
| 26 |
+
"d1": 256,
|
| 27 |
+
"d2": 512,
|
| 28 |
+
"dc": 1024,
|
| 29 |
+
"head_dim": 64,
|
| 30 |
+
"depth0": 2,
|
| 31 |
+
"depth1": 2,
|
| 32 |
+
"depth2": 2,
|
| 33 |
+
"depth_core": 16,
|
| 34 |
+
"window": 8,
|
| 35 |
+
"mlp_ratio": 3.0,
|
| 36 |
+
"text_dim": 2560,
|
| 37 |
+
"n_registers": 4,
|
| 38 |
+
"n_styles": 512,
|
| 39 |
+
"n_sources": 16,
|
| 40 |
+
"dk": 128,
|
| 41 |
+
"colour_freqs": 8,
|
| 42 |
+
"colour_hidden": 256,
|
| 43 |
+
"rope_theta": 100.0,
|
| 44 |
+
"core_level": 2,
|
| 45 |
+
"palette_tokens": true,
|
| 46 |
+
"attrs": true,
|
| 47 |
+
"text_adapter": 2,
|
| 48 |
+
"self_cond": true,
|
| 49 |
+
"bg_mode": true
|
| 50 |
+
}
|
| 51 |
+
}
|
rd-flow-64.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e017c9829eb122484e1cf1e628d607abb668086f1dc502577d1bb732059d2107
|
| 3 |
+
size 541893098
|
samples/autumn-forest.png
ADDED
|
samples/kitsune.png
ADDED
|
samples/mushroom-house.png
ADDED
|
samples/red-potion.png
ADDED
|
samples/showcase.png
ADDED
|
samples/slime.png
ADDED
|
samples/snowy-village.png
ADDED
|
samples/tavern.png
ADDED
|