dflow_2b: A 2B Image Model Trained From Scratch on One GPU

ComfyUI Wikinews

dflow_2b is a 2.1B text-to-image model trained from scratch on one GPU, with JSON layout prompts, its own autoencoder and ComfyUI nodes in the same download.

dflow_2b is a 2.13B text-to-image model trained from scratch on a single GPU, mostly on photographs and classical art. Release 0.251 is a preview: it is still training, so checkpoints and behaviour will change between versions.

It generates at about one megapixel, 832 × 1216 by default, and reads two kinds of prompt: ordinary captions, and JSON layout prompts that place objects with boxes, palettes and literal text. The layout format follows MOSS-Image, and MOSS layouts are converted internally.

Coastal boardwalk made with dflow_2b

From the 0.25 example gallery: 832 × 1216, 50 Euler ancestral steps.

Layout prompts

A layout prompt is JSON with a summary, a frame and an items list. Each item has a label, a caption, optional tags and palette, and a box_2d, and text items carry the string to render, so posters, covers and product shots come out with the lettering where you asked for it.

"items": [
  { "label": "object", "caption": "A large flat orange circle, the sun, behind the musician.", "box_2d": [230, 170, 720, 830] },
  { "label": "character", "caption": "A black silhouette of a man in a hat playing a tenor saxophone, facing right.", "box_2d": [260, 250, 880, 760] },
  { "label": "text", "caption": "The title in bold condensed cream capitals on one line.", "text": "BLUE HARBOR JAZZ" }
]
A jazz festival poster generated from a JSON layout prompt

No image input: the whole poster comes from the layout above.

Running it in ComfyUI

The Hugging Face repository is itself a ComfyUI custom-node folder:

cd ComfyUI/custom_nodes
hf download data-archetype/dflow_2b --local-dir dflow_2b
pip install -r dflow_2b/requirements.txt

After a restart the nodes show up under DFlow: Loader, Text Encode, Layout Encode, Guider, Sampler, Time Schedule and Empty Latent. Two example workflows ship in comfyui/workflows/, one caption-driven and one layout-driven. The model needs Python 3.12, a CUDA build of PyTorch and a bfloat16 NVIDIA card, and the autoencoder (dinac3_96, also this author's) downloads on first load.

Speed and limits

On an RTX 4090 a 50-step 832 × 1216 image takes about 10 s with the default torch.compile and 13 s without it, after a one-off 30 to 45 s compile, at a peak of about 7 GB of VRAM. Prompts can run up to 6,144 tokens.

The preview warning is real: generations are uneven and need some seed hunting, and the training set is photographs and classical art, so anime and heavy stylisation are outside what it was built for. Version 0.25 is the weighted average of the step 611,000 weights (0.8 EMA, 0.2 live); 0.251 keeps those weights and swaps in a newer autoencoder that leaves a fainter dot pattern on flat colour.

Tortoiseshell cat in tall grassStudio portrait of a man
Photograph-style promptStudio portrait

Comments

Sign in with GitHub to join the discussion.

Loading comments…
dflow_2b: A 2B Image Model Trained From Scratch on One GPU | ComfyUI Wiki