|
Download README.md from data-archetype/dflow_2b: direct link, hf CLI and curl.
- Browser
- Download file 7.36 kB
-
https://huggingface.co/data-archetype/dflow_2b/resolve/main/README.md
- Command line
-
hf download hf://data-archetype/dflow_2b/README.md
-
curl -L -o README.md https://huggingface.co/data-archetype/dflow_2b/resolve/main/README.md
7.36 kB
| license: other | |
| license_name: mg-by-nc-2.0 | |
| license_link: https://ids.nus.edu.sg/docs/modelgo/v2/MG-BY-NC/LICENSE | |
| library_name: dflow | |
| pipeline_tag: text-to-image | |
| tags: | |
| - text-to-image | |
| - flow-matching | |
| - pytorch | |
| - comfyui | |
| - photography | |
| base_model: | |
| - google/t5gemma-2-270m-270m | |
| # dflow_2b | |
| > [!WARNING] | |
| > **Preview, version 0.22.** The model is still training, so checkpoints and | |
| > behaviour will change between releases. Generations are still uneven, expect | |
| > some seed hunting. | |
| dflow_2b is an indie text-to-image model, trained from scratch on a single GPU, | |
| mostly on photographs and classical art. | |
| It takes ordinary captions and JSON layout captions. The layout format is close | |
| to [MOSS-Image](https://github.com/OpenMOSS/MOSS-Image)'s, and MOSS-Image | |
| layouts are converted internally. | |
| The package contains the weights, the `dflow` inference code and ComfyUI nodes. | |
| [Example gallery](GALLERY.md) · [Manual](MANUAL.md) · | |
| [Technical report](TECHNICAL_REPORT.md) · [Release notes](RELEASES.md) | |
| <table> | |
| <tr> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#boardwalk"><img src="assets/gallery/boardwalk.png" width="220" alt="Boardwalk to a rugged coast"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#cat_grass"><img src="assets/gallery/cat_grass.png" width="220" alt="Tortoiseshell cat in tall grass"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#rooster"><img src="assets/gallery/rooster.png" width="220" alt="Rooster among tropical plants"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#man"><img src="assets/gallery/man.png" width="220" alt="Studio portrait of a man"></a></td> | |
| </tr> | |
| <tr> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#street"><img src="assets/gallery/street.png" width="220" alt="Narrow street of wooden houses"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#constable"><img src="assets/gallery/constable.png" width="220" alt="Landscape oil painting"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#poster_jazz"><img src="assets/gallery/poster_jazz.png" width="220" alt="Jazz festival poster from a JSON layout"></a></td> | |
| <td><a href="https://huggingface.co/data-archetype/dflow_2b/blob/main/GALLERY.md#red_perfume"><img src="assets/gallery/red_perfume.png" width="220" alt="Woman holding a red perfume bottle"></a></td> | |
| </tr> | |
| </table> | |
| ## What's included | |
| - `model.safetensors`: the 2B denoiser. | |
| - `text_encoder/`: the part of | |
| [T5Gemma 2 270M](https://huggingface.co/google/t5gemma-2-270m-270m) the model | |
| uses, under the Gemma Terms of Use. | |
| - `dflow/`: the Python inference package. | |
| - `comfyui/`: ComfyUI nodes and example workflows. | |
| The autoencoder, [dinac3_96](https://huggingface.co/data-archetype/dinac3_96), | |
| is our own and downloads automatically on first use. The | |
| [technical report](TECHNICAL_REPORT.md) covers the architecture and training. | |
| ## Requirements | |
| Python 3.12 or later, PyTorch 2.13 with CUDA, and an NVIDIA GPU with bfloat16 | |
| support and about 7 GB of free VRAM. | |
| Generation is compiled with `torch.compile`. The first image takes an extra 30 | |
| to 45 seconds while it compiles; after that, an 832×1216 image takes about 10 | |
| seconds on an RTX 4090. | |
| ## ComfyUI | |
| The repository is a ComfyUI custom-node folder. Download it into | |
| `custom_nodes` and install its requirements: | |
| ```bash | |
| cd ComfyUI/custom_nodes | |
| hf download data-archetype/dflow_2b --local-dir dflow_2b | |
| pip install -r dflow_2b/requirements.txt | |
| ``` | |
| To update later, run the same `hf download` command again. The manual explains | |
| how to [install an older release](MANUAL.md#updating-and-older-versions). | |
| Load `dflow_2b/comfyui/workflows/dflow_default.json`, or drag any image from the | |
| [gallery](GALLERY.md) onto the canvas to get the workflow that made it. Start | |
| ComfyUI with `--preview-method auto` for live previews. | |
| ## Python | |
| ```bash | |
| hf download data-archetype/dflow_2b --local-dir dflow_2b | |
| pip install -e dflow_2b | |
| ``` | |
| ```python | |
| from dflow.inference import GenerationSettings | |
| from dflow.pipeline import DFlowPipeline | |
| pipe = DFlowPipeline.from_pretrained("dflow_2b") | |
| image = pipe("A lighthouse on a cliff at dusk.", GenerationSettings(seed=7)).images[0] | |
| image.save("lighthouse.png", pnginfo=pipe.png_info(image)) | |
| ``` | |
| `from_pretrained` also takes the Hub id `data-archetype/dflow_2b`, in which case | |
| the files go to the Hugging Face cache. If you have diffusers installed, a thin | |
| diffusers-style wrapper is available as | |
| `dflow.diffusers_pipeline.DFlowDiffusersPipeline`. | |
| ## Prompts | |
| Write captions the way you would describe a photo or a painting: the subject, | |
| the setting, the light and the medium. Long prompts are fine, up to 6,144 | |
| tokens. | |
| Put text you want in the image in double quotes, as in | |
| `A shop sign that reads "OPEN LATE"`. The model reads quoted text letter by | |
| letter, which helps with spelling. | |
| A layout describes the picture as a whole and then lists its elements, each | |
| with a label, a caption and a box `[y0, x0, y1, x1]` on a 0–1000 scale. Text | |
| elements carry the exact string to render: | |
| ```json | |
| {"summary": {"canvas": "single", | |
| "caption": "A travel poster of a mountain above a lake."}, | |
| "frame": {"caption": "The peak sits in the upper middle.", | |
| "palette": ["#F3E6C8", "#2F5D62"]}, | |
| "items": [ | |
| {"label": "object", "caption": "A snow-capped mountain.", | |
| "box_2d": [250, 180, 620, 820]}, | |
| {"label": "text", "caption": "The title in tall serif capitals.", | |
| "text": "SILVER LAKE", "box_2d": [120, 110, 220, 890]}]} | |
| ``` | |
| Use it as the prompt in Python, or paste it into the DFlow Layout Encode node. | |
| MOSS-Image layout prompts and editable drafts go in the same places. | |
| The [manual](MANUAL.md#json-layouts) covers every field and works through a | |
| full poster. | |
| ## Limitations | |
| - It is a preview, and quality varies from prompt to prompt and seed to seed. | |
| - Hands and anatomy often go wrong. | |
| - Small text and long passages of text are hit and miss. | |
| - Above about one megapixel results get less reliable. For large images, move | |
| the [self-attention gain](MANUAL.md#self-attention-gain) towards 0. | |
| - Styles far from photography and classical art are weaker. | |
| You are responsible for how you use the model and its outputs. | |
| ## Licence | |
| - The weights, the `dflow` package, the documentation and the gallery images: | |
| ModelGo Attribution-NonCommercial 2.0 (`MG-BY-NC-2.0`). See | |
| [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE). | |
| - `comfyui/` and the root `__init__.py`: GPL-3.0. See | |
| [`comfyui/LICENSE`](comfyui/LICENSE). | |
| - `text_encoder/`: Gemma is provided under and subject to the Gemma Terms of Use | |
| found at [gemma.ai/resources/terms](https://gemma.ai/resources/terms). A copy | |
| is in [`text_encoder/LICENSE-GEMMA.md`](text_encoder/LICENSE-GEMMA.md). | |
| - dinac3_96 has its own licence, in | |
| [its repository](https://huggingface.co/data-archetype/dinac3_96). | |
| Third-party material is listed in [`ATTRIBUTION.md`](ATTRIBUTION.md). | |
| ## Citation | |
| ```bibtex | |
| @misc{dflow_2b, | |
| title = {dflow\_2b}, | |
| author = {{Data Archetype}}, | |
| year = {2026}, | |
| url = {https://huggingface.co/data-archetype/dflow_2b}, | |
| note = {Preview release, version 0.22} | |
| } | |
| ``` | |