Commit ·
6daffc2
0
Parent(s):
dflow_2b 0.2
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +67 -0
- ATTRIBUTION.md +45 -0
- GALLERY.md +1270 -0
- LICENSE +124 -0
- MANUAL.md +1242 -0
- NOTICE +55 -0
- README.md +174 -0
- RELEASES.md +23 -0
- TECHNICAL_REPORT.md +699 -0
- __init__.py +17 -0
- assets/gallery/army.png +3 -0
- assets/gallery/beetle.png +3 -0
- assets/gallery/boardwalk.png +3 -0
- assets/gallery/cat_grass.png +3 -0
- assets/gallery/closet.png +3 -0
- assets/gallery/collier.png +3 -0
- assets/gallery/constable.png +3 -0
- assets/gallery/hokusai.png +3 -0
- assets/gallery/larson.png +3 -0
- assets/gallery/leopard.png +3 -0
- assets/gallery/man.png +3 -0
- assets/gallery/man_outside.png +3 -0
- assets/gallery/marina.png +3 -0
- assets/gallery/nissan.png +3 -0
- assets/gallery/poster_film.png +3 -0
- assets/gallery/poster_jazz.png +3 -0
- assets/gallery/poster_travel.png +3 -0
- assets/gallery/red_perfume.png +3 -0
- assets/gallery/renoir.png +3 -0
- assets/gallery/rooster.png +3 -0
- assets/gallery/rousseau.png +3 -0
- assets/gallery/snail.png +3 -0
- assets/gallery/station.png +3 -0
- assets/gallery/still_woman.png +3 -0
- assets/gallery/street.png +3 -0
- assets/gallery/wahlberg.png +3 -0
- assets/gallery/weenix.png +3 -0
- comfyui/LICENSE +674 -0
- comfyui/NOTICE +17 -0
- comfyui/__init__.py +8 -0
- comfyui/loader.py +128 -0
- comfyui/nodes.py +941 -0
- comfyui/preview.py +101 -0
- comfyui/sampling.py +400 -0
- comfyui/types.py +166 -0
- comfyui/vae.py +92 -0
- comfyui/web/dflow_solver.js +37 -0
- comfyui/workflows/dflow_default.json +869 -0
- comfyui/workflows/dflow_layout_poster.json +851 -0
- config.json +30 -0
.gitattributes
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
assets/gallery/army.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/gallery/boardwalk.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
assets/gallery/cat.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
assets/gallery/closet.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
assets/gallery/constable.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
assets/gallery/leopard.png filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
assets/gallery/man.png filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
assets/gallery/man_outside.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
assets/gallery/nissan.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
assets/gallery/poster_film.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
assets/gallery/poster_jazz.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
assets/gallery/poster_travel.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
assets/gallery/red_perfume.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
assets/gallery/still_table.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
assets/gallery/still_woman.png filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
assets/gallery/venice.png filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
assets/gallery/window_display.png filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
text_encoder/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
assets/gallery/beetle.png filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
assets/gallery/cat_grass.png filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
assets/gallery/marina.png filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
assets/gallery/rooster.png filter=lfs diff=lfs merge=lfs -text
|
| 58 |
+
assets/gallery/snail.png filter=lfs diff=lfs merge=lfs -text
|
| 59 |
+
assets/gallery/station.png filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
assets/gallery/street.png filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
assets/gallery/collier.png filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
assets/gallery/hokusai.png filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
assets/gallery/larson.png filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
assets/gallery/renoir.png filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
assets/gallery/rousseau.png filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
assets/gallery/wahlberg.png filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
assets/gallery/weenix.png filter=lfs diff=lfs merge=lfs -text
|
ATTRIBUTION.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Attribution
|
| 2 |
+
|
| 3 |
+
## T5Gemma 2 text encoder
|
| 4 |
+
|
| 5 |
+
The `text_encoder/` folder is derived from
|
| 6 |
+
[`google/t5gemma-2-270m-270m`](https://huggingface.co/google/t5gemma-2-270m-270m),
|
| 7 |
+
published by Google, at revision `7c38f16641f455ef0685b18431faf1b17722d5a1`.
|
| 8 |
+
|
| 9 |
+
> Zhang et al., "T5Gemma 2: Seeing, Reading, and Understanding Longer," 2025.
|
| 10 |
+
> [arXiv:2512.14856](https://arxiv.org/abs/2512.14856)
|
| 11 |
+
|
| 12 |
+
The folder is a modified copy of the original. It contains only what dflow_2b
|
| 13 |
+
uses for prompt conditioning:
|
| 14 |
+
|
| 15 |
+
- the tokenizer files, unchanged;
|
| 16 |
+
- the token embeddings;
|
| 17 |
+
- encoder layers 1 to 12.
|
| 18 |
+
|
| 19 |
+
The remaining encoder layers and the whole decoder are not included. The kept
|
| 20 |
+
weights are stored in bfloat16 with their values unchanged and with shortened
|
| 21 |
+
tensor names. Data Archetype made these modifications in November 2026.
|
| 22 |
+
|
| 23 |
+
Gemma is provided under and subject to the Gemma Terms of Use found at
|
| 24 |
+
[gemma.ai/resources/terms](https://gemma.ai/resources/terms). A copy of the
|
| 25 |
+
terms is in `text_encoder/LICENSE-GEMMA.md`. Use of the text encoder is subject
|
| 26 |
+
to the use restrictions in Section 3.2 of those terms, which include the
|
| 27 |
+
[Gemma Prohibited Use Policy](https://gemma.ai/resources/prohibited_use_policy).
|
| 28 |
+
The bundled files are not relicensed under MG-BY-NC-2.0.
|
| 29 |
+
|
| 30 |
+
## dinac3_96 autoencoder
|
| 31 |
+
|
| 32 |
+
dflow_2b generates latents for the separately published
|
| 33 |
+
[`data-archetype/dinac3_96`](https://huggingface.co/data-archetype/dinac3_96)
|
| 34 |
+
autoencoder. The loader downloads it at the pinned commit
|
| 35 |
+
`d0ca36daa3e429a510ba465a5f7f8139c66d2f82`. It is not part of this repository,
|
| 36 |
+
and its own repository is the authority for its code, model card and licence.
|
| 37 |
+
|
| 38 |
+
## dflow_2b
|
| 39 |
+
|
| 40 |
+
The model weights, the `dflow` package, the documentation and the gallery
|
| 41 |
+
images are distributed under the ModelGo Attribution-NonCommercial License 2.0
|
| 42 |
+
(`MG-BY-NC-2.0`). See `LICENSE`, and retain `NOTICE` in any distribution.
|
| 43 |
+
|
| 44 |
+
The ComfyUI nodes in `comfyui/` and the root `__init__.py` are distributed
|
| 45 |
+
under GPL-3.0. See `comfyui/LICENSE`.
|
GALLERY.md
ADDED
|
@@ -0,0 +1,1270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
|
| 3 |
+
# dflow_2b example gallery
|
| 4 |
+
|
| 5 |
+
[Model card](README.md) · [Manual](MANUAL.md) ·
|
| 6 |
+
[Technical report](TECHNICAL_REPORT.md)
|
| 7 |
+
|
| 8 |
+
> [!WARNING]
|
| 9 |
+
> **Preview model, version 0.2.** The model is still in training.
|
| 10 |
+
|
| 11 |
+
Every image was made with dflow_2b 0.2 and the default settings for
|
| 12 |
+
its size, and was chosen from several seeds. Each PNG carries its ComfyUI
|
| 13 |
+
workflow: drop it onto the ComfyUI canvas to load the graph that made it.
|
| 14 |
+
|
| 15 |
+
<a id="photographs"></a>
|
| 16 |
+
|
| 17 |
+
## Photographs
|
| 18 |
+
|
| 19 |
+
<table>
|
| 20 |
+
<tr>
|
| 21 |
+
<td width="25%" align="center"><a href="#boardwalk"><img src="assets/gallery/boardwalk.png" alt="Boardwalk descending toward a rugged coast"></a><br><sub>Coastal boardwalk</sub></td>
|
| 22 |
+
<td width="25%" align="center"><a href="#cat_grass"><img src="assets/gallery/cat_grass.png" alt="Tortoiseshell cat in tall grass"></a><br><sub>Tortoiseshell cat</sub></td>
|
| 23 |
+
<td width="25%" align="center"><a href="#closet"><img src="assets/gallery/closet.png" alt="Bright white walk-in closet"></a><br><sub>Walk-in closet</sub></td>
|
| 24 |
+
<td width="25%" align="center"><a href="#man"><img src="assets/gallery/man.png" alt="Studio portrait of a man"></a><br><sub>Studio portrait</sub></td>
|
| 25 |
+
</tr>
|
| 26 |
+
<tr>
|
| 27 |
+
<td width="25%" align="center"><a href="#rooster"><img src="assets/gallery/rooster.png" alt="Orange and black rooster among tropical plants"></a><br><sub>Rooster on a garden path</sub></td>
|
| 28 |
+
<td width="25%" align="center"><a href="#man_outside"><img src="assets/gallery/man_outside.png" alt="Man standing outdoors beside a wooden post"></a><br><sub>Outdoor portrait</sub></td>
|
| 29 |
+
<td width="25%" align="center"><a href="#snail"><img src="assets/gallery/snail.png" alt="Snail with a spiral shell crawling on sandy ground"></a><br><sub>Snail on sand</sub></td>
|
| 30 |
+
<td width="25%" align="center"><a href="#red_perfume"><img src="assets/gallery/red_perfume.png" alt="Woman holding a red perfume bottle"></a><br><sub>Perfume campaign</sub></td>
|
| 31 |
+
</tr>
|
| 32 |
+
<tr>
|
| 33 |
+
<td width="25%" align="center"><a href="#street"><img src="assets/gallery/street.png" alt="Narrow street of wooden houses under tangled wires"></a><br><sub>Narrow street</sub></td>
|
| 34 |
+
<td width="25%" align="center"><a href="#beetle"><img src="assets/gallery/beetle.png" alt="Red Volkswagen Beetle on a cobblestone street"></a><br><sub>Red Beetle</sub></td>
|
| 35 |
+
<td width="25%" align="center"><a href="#station"><img src="assets/gallery/station.png" alt="Sunlit train station with yellow trains"></a><br><sub>Train station</sub></td>
|
| 36 |
+
<td width="25%" align="center"><a href="#army"><img src="assets/gallery/army.png" alt="Armoured man beside an army"></a><br><sub>Armoured man and army</sub></td>
|
| 37 |
+
</tr>
|
| 38 |
+
<tr>
|
| 39 |
+
<td width="25%" align="center"><a href="#leopard"><img src="assets/gallery/leopard.png" alt="Leopard in a tree at night"></a><br><sub>Leopard at night</sub></td>
|
| 40 |
+
<td width="25%" align="center"><a href="#still_woman"><img src="assets/gallery/still_woman.png" alt="Woman seated by a window"></a><br><sub>Woman by a window</sub></td>
|
| 41 |
+
<td width="25%" align="center"><a href="#nissan"><img src="assets/gallery/nissan.png" alt="Nissan 300ZX outside a warehouse at night"></a><br><sub>Nissan 300ZX at night</sub></td>
|
| 42 |
+
<td width="25%" align="center"><a href="#marina"><img src="assets/gallery/marina.png" alt="Coastal village and marina at dusk"></a><br><sub>Coastal village at dusk</sub></td>
|
| 43 |
+
</tr>
|
| 44 |
+
</table>
|
| 45 |
+
|
| 46 |
+
<a id="paintings-and-prints"></a>
|
| 47 |
+
|
| 48 |
+
## Paintings and prints
|
| 49 |
+
|
| 50 |
+
<table>
|
| 51 |
+
<tr>
|
| 52 |
+
<td width="25%" align="center"><a href="#constable"><img src="assets/gallery/constable.png" alt="Landscape oil painting with sheep and a mill"></a><br><sub>Landscape painting</sub></td>
|
| 53 |
+
<td width="25%" align="center"><a href="#weenix"><img src="assets/gallery/weenix.png" alt="Baroque oil painting of a mastiff standing over a dead dog"></a><br><sub>Mastiff over a fallen dog</sub></td>
|
| 54 |
+
<td width="25%" align="center"><a href="#wahlberg"><img src="assets/gallery/wahlberg.png" alt="Black and white oil landscape with a barn and a windmill"></a><br><sub>Barn and windmill</sub></td>
|
| 55 |
+
<td width="25%" align="center"><a href="#renoir"><img src="assets/gallery/renoir.png" alt="Impressionist oil painting of a cluster of roses"></a><br><sub>Roses</sub></td>
|
| 56 |
+
</tr>
|
| 57 |
+
<tr>
|
| 58 |
+
<td width="25%" align="center"><a href="#larson"><img src="assets/gallery/larson.png" alt="Romantic seascape with waves breaking on rocks under sunbeams"></a><br><sub>Stormy coast</sub></td>
|
| 59 |
+
<td width="25%" align="center"><a href="#collier"><img src="assets/gallery/collier.png" alt="Realist oil portrait of a man with spectacles and a mustache"></a><br><sub>Portrait with spectacles</sub></td>
|
| 60 |
+
<td width="25%" align="center"><a href="#rousseau"><img src="assets/gallery/rousseau.png" alt="Realist river landscape with trees, figures and cattle"></a><br><sub>River landscape</sub></td>
|
| 61 |
+
<td width="25%" align="center"><a href="#hokusai"><img src="assets/gallery/hokusai.png" alt="Woodblock print of a great wave"></a><br><sub>The Great Wave</sub></td>
|
| 62 |
+
</tr>
|
| 63 |
+
</table>
|
| 64 |
+
|
| 65 |
+
<a id="json-layouts"></a>
|
| 66 |
+
|
| 67 |
+
## JSON layouts
|
| 68 |
+
|
| 69 |
+
<table>
|
| 70 |
+
<tr>
|
| 71 |
+
<td width="25%" align="center"><a href="#poster_jazz"><img src="assets/gallery/poster_jazz.png" alt="Jazz festival poster with a saxophonist silhouette"></a><br><sub>Jazz festival poster</sub></td>
|
| 72 |
+
<td width="25%" align="center"><a href="#poster_travel"><img src="assets/gallery/poster_travel.png" alt="Travel poster of a mountain lake"></a><br><sub>Travel poster</sub></td>
|
| 73 |
+
<td width="25%" align="center"><a href="#poster_film"><img src="assets/gallery/poster_film.png" alt="Film poster of a woman on a foggy platform"></a><br><sub>Film poster</sub></td>
|
| 74 |
+
</tr>
|
| 75 |
+
</table>
|
| 76 |
+
|
| 77 |
+
## Full-size images and settings
|
| 78 |
+
|
| 79 |
+
### Photographs
|
| 80 |
+
|
| 81 |
+
<a id="boardwalk"></a>
|
| 82 |
+
|
| 83 |
+
#### Coastal boardwalk
|
| 84 |
+
|
| 85 |
+
[](assets/gallery/boardwalk.png)
|
| 86 |
+
|
| 87 |
+
<details open>
|
| 88 |
+
<summary>Generation settings</summary>
|
| 89 |
+
|
| 90 |
+
**Prompt**
|
| 91 |
+
|
| 92 |
+
> Wide angle photo of a weathered wooden boardwalk descending steeply from rocky
|
| 93 |
+
> cliffs toward a rugged coastline. The boardwalk, constructed from aged planks
|
| 94 |
+
> with visible cracks and moss growth, is bordered by rustic wooden railings on
|
| 95 |
+
> both sides. Surrounding terrain features uneven, eroded rock formations
|
| 96 |
+
> covered in patches of green vegetation and low-lying shrubs. Below, a
|
| 97 |
+
> crescent-shaped sandy beach meets crashing waves of a deep blue ocean under a
|
| 98 |
+
> stormy, overcast sky with dark clouds and hints of distant sunlight breaking
|
| 99 |
+
> through. The horizon shows turbulent waves colliding with rocky outcrops,
|
| 100 |
+
> creating white foam.
|
| 101 |
+
|
| 102 |
+
| Setting | Value |
|
| 103 |
+
| --- | --- |
|
| 104 |
+
| Seed | `44` |
|
| 105 |
+
| Size | `1120 × 1664` |
|
| 106 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 107 |
+
| Log-SNR shift | `-3.60` (−0.25 plus the resolution term) |
|
| 108 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 109 |
+
| Self-attention gain | `-0.01` |
|
| 110 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 111 |
+
|
| 112 |
+
</details>
|
| 113 |
+
|
| 114 |
+
[Back to the top](#top)
|
| 115 |
+
|
| 116 |
+
<a id="cat_grass"></a>
|
| 117 |
+
|
| 118 |
+
#### Tortoiseshell cat
|
| 119 |
+
|
| 120 |
+
[](assets/gallery/cat_grass.png)
|
| 121 |
+
|
| 122 |
+
<details open>
|
| 123 |
+
<summary>Generation settings</summary>
|
| 124 |
+
|
| 125 |
+
**Prompt**
|
| 126 |
+
|
| 127 |
+
> A close-up portrait of a chunky tortoiseshell cat sitting in tall grass, its
|
| 128 |
+
> dense mottled fur of warm browns, creams and slate grays clearly textured,
|
| 129 |
+
> bright green-yellow eyes looking slightly to the right, long white whiskers
|
| 130 |
+
> and a small dark nose visible, soft natural daylight and a softly blurred
|
| 131 |
+
> earthy background.
|
| 132 |
+
|
| 133 |
+
| Setting | Value |
|
| 134 |
+
| --- | --- |
|
| 135 |
+
| Seed | `127` |
|
| 136 |
+
| Size | `832 × 1216` |
|
| 137 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 138 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 139 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 140 |
+
| Self-attention gain | `-0.03` |
|
| 141 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 142 |
+
|
| 143 |
+
</details>
|
| 144 |
+
|
| 145 |
+
[Back to the top](#top)
|
| 146 |
+
|
| 147 |
+
<a id="closet"></a>
|
| 148 |
+
|
| 149 |
+
#### Walk-in closet
|
| 150 |
+
|
| 151 |
+
[](assets/gallery/closet.png)
|
| 152 |
+
|
| 153 |
+
<details open>
|
| 154 |
+
<summary>Generation settings</summary>
|
| 155 |
+
|
| 156 |
+
**Prompt**
|
| 157 |
+
|
| 158 |
+
> Interior of walk-in closet with white cabinets, shelves, and mirrored doors,
|
| 159 |
+
> plus dark wood floor and crystal chandelier. Clothes hang on rods, shoes line
|
| 160 |
+
> shelves, and a black purse sits on a clear acrylic stool. A vanity holds
|
| 161 |
+
> flowers, perfume, and jewelry.
|
| 162 |
+
|
| 163 |
+
| Setting | Value |
|
| 164 |
+
| --- | --- |
|
| 165 |
+
| Seed | `42` |
|
| 166 |
+
| Size | `1120 × 1664` |
|
| 167 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 168 |
+
| Log-SNR shift | `-3.60` (−0.25 plus the resolution term) |
|
| 169 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 170 |
+
| Self-attention gain | `-0.01` |
|
| 171 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 172 |
+
|
| 173 |
+
</details>
|
| 174 |
+
|
| 175 |
+
[Back to the top](#top)
|
| 176 |
+
|
| 177 |
+
<a id="man"></a>
|
| 178 |
+
|
| 179 |
+
#### Studio portrait
|
| 180 |
+
|
| 181 |
+
[](assets/gallery/man.png)
|
| 182 |
+
|
| 183 |
+
<details open>
|
| 184 |
+
<summary>Generation settings</summary>
|
| 185 |
+
|
| 186 |
+
**Prompt**
|
| 187 |
+
|
| 188 |
+
> Portrait of a man with medium brown skin tone, long dark hair tied back
|
| 189 |
+
> loosely, full beard and mustache, slight stubble on upper lip. Wearing a dark
|
| 190 |
+
> brown V-neck sweater with a slight sheen, looking directly at the camera with
|
| 191 |
+
> a slight smile, neutral expression, soft lighting from above casting subtle
|
| 192 |
+
> shadows under cheekbones and jawline. Plain light gray background.
|
| 193 |
+
|
| 194 |
+
| Setting | Value |
|
| 195 |
+
| --- | --- |
|
| 196 |
+
| Seed | `43` |
|
| 197 |
+
| Size | `832 × 1216` |
|
| 198 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 199 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 200 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 201 |
+
| Self-attention gain | `-0.03` |
|
| 202 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 203 |
+
|
| 204 |
+
</details>
|
| 205 |
+
|
| 206 |
+
[Back to the top](#top)
|
| 207 |
+
|
| 208 |
+
<a id="rooster"></a>
|
| 209 |
+
|
| 210 |
+
#### Rooster on a garden path
|
| 211 |
+
|
| 212 |
+
[](assets/gallery/rooster.png)
|
| 213 |
+
|
| 214 |
+
<details open>
|
| 215 |
+
<summary>Generation settings</summary>
|
| 216 |
+
|
| 217 |
+
**Prompt**
|
| 218 |
+
|
| 219 |
+
> A bright orange and black rooster standing on a damp garden path, surrounded
|
| 220 |
+
> by lush green tropical plants and trees, its red comb upright and long dark
|
| 221 |
+
> tail feathers curving down over the wet concrete.
|
| 222 |
+
|
| 223 |
+
| Setting | Value |
|
| 224 |
+
| --- | --- |
|
| 225 |
+
| Seed | `42` |
|
| 226 |
+
| Size | `832 × 1216` |
|
| 227 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 228 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 229 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 230 |
+
| Self-attention gain | `-0.03` |
|
| 231 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 232 |
+
|
| 233 |
+
</details>
|
| 234 |
+
|
| 235 |
+
[Back to the top](#top)
|
| 236 |
+
|
| 237 |
+
<a id="man_outside"></a>
|
| 238 |
+
|
| 239 |
+
#### Outdoor portrait
|
| 240 |
+
|
| 241 |
+
[](assets/gallery/man_outside.png)
|
| 242 |
+
|
| 243 |
+
<details open>
|
| 244 |
+
<summary>Generation settings</summary>
|
| 245 |
+
|
| 246 |
+
**Prompt**
|
| 247 |
+
|
| 248 |
+
> A close-up portrait of a muscular man in his mid-40s with a bald head and
|
| 249 |
+
> thick facial hair, standing outdoors in bright daylight. He is shirtless,
|
| 250 |
+
> wearing black knee-length athletic shorts with a green wristband on his right
|
| 251 |
+
> wrist and a gold chain necklace. His left arm is resting on a wooden post
|
| 252 |
+
> wrapped with green vines, while his right hand grips the post near his waist.
|
| 253 |
+
|
| 254 |
+
| Setting | Value |
|
| 255 |
+
| --- | --- |
|
| 256 |
+
| Seed | `45` |
|
| 257 |
+
| Size | `1120 × 1664` |
|
| 258 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 259 |
+
| Log-SNR shift | `-3.60` (−0.25 plus the resolution term) |
|
| 260 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 261 |
+
| Self-attention gain | `-0.01` |
|
| 262 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 263 |
+
|
| 264 |
+
</details>
|
| 265 |
+
|
| 266 |
+
[Back to the top](#top)
|
| 267 |
+
|
| 268 |
+
<a id="snail"></a>
|
| 269 |
+
|
| 270 |
+
#### Snail on sand
|
| 271 |
+
|
| 272 |
+
[](assets/gallery/snail.png)
|
| 273 |
+
|
| 274 |
+
<details open>
|
| 275 |
+
<summary>Generation settings</summary>
|
| 276 |
+
|
| 277 |
+
**Prompt**
|
| 278 |
+
|
| 279 |
+
> A dark brown snail with a glossy, spiral-patterned shell slowly crawls across
|
| 280 |
+
> sandy ground, its long black tentacles extended. The shell has lighter cream
|
| 281 |
+
> streaks and a small spiral center. Around the snail, dry tan soil is scattered
|
| 282 |
+
> with thin green and yellow grass blades and a few small bright pink flower
|
| 283 |
+
> petals, all lit by warm, soft daylight.
|
| 284 |
+
|
| 285 |
+
| Setting | Value |
|
| 286 |
+
| --- | --- |
|
| 287 |
+
| Seed | `323` |
|
| 288 |
+
| Size | `1216 × 832` |
|
| 289 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 290 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 291 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 292 |
+
| Self-attention gain | `-0.03` |
|
| 293 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 294 |
+
|
| 295 |
+
</details>
|
| 296 |
+
|
| 297 |
+
[Back to the top](#top)
|
| 298 |
+
|
| 299 |
+
<a id="red_perfume"></a>
|
| 300 |
+
|
| 301 |
+
#### Perfume campaign
|
| 302 |
+
|
| 303 |
+
[](assets/gallery/red_perfume.png)
|
| 304 |
+
|
| 305 |
+
<details open>
|
| 306 |
+
<summary>Generation settings</summary>
|
| 307 |
+
|
| 308 |
+
**Prompt**
|
| 309 |
+
|
| 310 |
+
> Promotional image: Adult Asian woman with red lipstick holds a red perfume
|
| 311 |
+
> bottle. She wears a black dress with black feathers, plus gold earrings. She
|
| 312 |
+
> stands near a brown wall, with a dark background.
|
| 313 |
+
|
| 314 |
+
| Setting | Value |
|
| 315 |
+
| --- | --- |
|
| 316 |
+
| Seed | `47` |
|
| 317 |
+
| Size | `1120 × 1664` |
|
| 318 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 319 |
+
| Log-SNR shift | `-3.60` (−0.25 plus the resolution term) |
|
| 320 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 321 |
+
| Self-attention gain | `-0.01` |
|
| 322 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 323 |
+
|
| 324 |
+
</details>
|
| 325 |
+
|
| 326 |
+
[Back to the top](#top)
|
| 327 |
+
|
| 328 |
+
<a id="street"></a>
|
| 329 |
+
|
| 330 |
+
#### Narrow street
|
| 331 |
+
|
| 332 |
+
[](assets/gallery/street.png)
|
| 333 |
+
|
| 334 |
+
<details open>
|
| 335 |
+
<summary>Generation settings</summary>
|
| 336 |
+
|
| 337 |
+
**Prompt**
|
| 338 |
+
|
| 339 |
+
> A narrow, empty street lined with traditional wooden buildings and bamboo
|
| 340 |
+
> blinds, overhead a tangle of utility poles and wires stretching between
|
| 341 |
+
> rooftops; warm brown and ochre facades, paper lantern signs with Japanese
|
| 342 |
+
> characters, a parked bicycle and potted plants at the edges, and a single
|
| 343 |
+
> person in a blue jacket standing in the distance beneath tiled eaves.
|
| 344 |
+
|
| 345 |
+
| Setting | Value |
|
| 346 |
+
| --- | --- |
|
| 347 |
+
| Seed | `335` |
|
| 348 |
+
| Size | `832 × 1216` |
|
| 349 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 350 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 351 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 352 |
+
| Self-attention gain | `-0.03` |
|
| 353 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 354 |
+
|
| 355 |
+
</details>
|
| 356 |
+
|
| 357 |
+
[Back to the top](#top)
|
| 358 |
+
|
| 359 |
+
<a id="beetle"></a>
|
| 360 |
+
|
| 361 |
+
#### Red Beetle
|
| 362 |
+
|
| 363 |
+
[](assets/gallery/beetle.png)
|
| 364 |
+
|
| 365 |
+
<details open>
|
| 366 |
+
<summary>Generation settings</summary>
|
| 367 |
+
|
| 368 |
+
**Prompt**
|
| 369 |
+
|
| 370 |
+
> A shiny vintage red Volkswagen Beetle parked on a sunlit cobblestone
|
| 371 |
+
> pedestrian street, seen from the rear with chrome bumpers and an old-fashioned
|
| 372 |
+
> European license plate; the narrow street is lined with low, gabled buildings,
|
| 373 |
+
> shops with awnings and an NKD storefront, leafy green trees casting dappled
|
| 374 |
+
> shade, and groups of casually dressed people walking and window-shopping in
|
| 375 |
+
> the background.
|
| 376 |
+
|
| 377 |
+
| Setting | Value |
|
| 378 |
+
| --- | --- |
|
| 379 |
+
| Seed | `129` |
|
| 380 |
+
| Size | `832 × 1216` |
|
| 381 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 382 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 383 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 384 |
+
| Self-attention gain | `-0.03` |
|
| 385 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 386 |
+
|
| 387 |
+
</details>
|
| 388 |
+
|
| 389 |
+
[Back to the top](#top)
|
| 390 |
+
|
| 391 |
+
<a id="station"></a>
|
| 392 |
+
|
| 393 |
+
#### Train station
|
| 394 |
+
|
| 395 |
+
[](assets/gallery/station.png)
|
| 396 |
+
|
| 397 |
+
<details open>
|
| 398 |
+
<summary>Generation settings</summary>
|
| 399 |
+
|
| 400 |
+
**Prompt**
|
| 401 |
+
|
| 402 |
+
> A sunlit train station concourse with tall iron-and-glass arched roof, two
|
| 403 |
+
> yellow commuter trains stopped on either side of the central platform, and
|
| 404 |
+
> passengers scattered across the floor waiting, buying tickets at
|
| 405 |
+
> blue-and-silver machines, or walking toward the trains. Overhead signage
|
| 406 |
+
> includes a large black information board reading "INFORMAÇÕES Information" and
|
| 407 |
+
> smaller platform signs with numbers and arrows. Warm, golden daylight streams
|
| 408 |
+
> through the roof, casting long shadows and highlighting the ornate iron
|
| 409 |
+
> columns and the misty depth of the station. Visible text: "INFORMAÇÕES
|
| 410 |
+
> Information," "zona PRT1," and illuminated timetable displays.
|
| 411 |
+
|
| 412 |
+
| Setting | Value |
|
| 413 |
+
| --- | --- |
|
| 414 |
+
| Seed | `139` |
|
| 415 |
+
| Size | `832 × 1216` |
|
| 416 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 417 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 418 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 419 |
+
| Self-attention gain | `-0.03` |
|
| 420 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 421 |
+
|
| 422 |
+
</details>
|
| 423 |
+
|
| 424 |
+
[Back to the top](#top)
|
| 425 |
+
|
| 426 |
+
<a id="army"></a>
|
| 427 |
+
|
| 428 |
+
#### Armoured man and army
|
| 429 |
+
|
| 430 |
+
[](assets/gallery/army.png)
|
| 431 |
+
|
| 432 |
+
<details open>
|
| 433 |
+
<summary>Generation settings</summary>
|
| 434 |
+
|
| 435 |
+
**Prompt**
|
| 436 |
+
|
| 437 |
+
> A movie still shows an elderly man with a white beard and thinning hair,
|
| 438 |
+
> wearing ornate, weathered bronze plate armor, standing in a dusty field. He
|
| 439 |
+
> faces an unseen person while a dark horse stand besides him. In the
|
| 440 |
+
> background, a large army of soldiers with spears and shields is lined up under
|
| 441 |
+
> a bright, cloudy sky. Another soldier wearing a metal helmet sits on a horse
|
| 442 |
+
> behind the main figure.
|
| 443 |
+
|
| 444 |
+
| Setting | Value |
|
| 445 |
+
| --- | --- |
|
| 446 |
+
| Seed | `42` |
|
| 447 |
+
| Size | `1536 × 832` |
|
| 448 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 449 |
+
| Log-SNR shift | `-3.22` (−0.25 plus the resolution term) |
|
| 450 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 451 |
+
| Self-attention gain | `-0.02` |
|
| 452 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 453 |
+
|
| 454 |
+
</details>
|
| 455 |
+
|
| 456 |
+
[Back to the top](#top)
|
| 457 |
+
|
| 458 |
+
<a id="leopard"></a>
|
| 459 |
+
|
| 460 |
+
#### Leopard at night
|
| 461 |
+
|
| 462 |
+
[](assets/gallery/leopard.png)
|
| 463 |
+
|
| 464 |
+
<details open>
|
| 465 |
+
<summary>Generation settings</summary>
|
| 466 |
+
|
| 467 |
+
**Prompt**
|
| 468 |
+
|
| 469 |
+
> Leopard lying down in a tree at night.
|
| 470 |
+
|
| 471 |
+
| Setting | Value |
|
| 472 |
+
| --- | --- |
|
| 473 |
+
| Seed | `43` |
|
| 474 |
+
| Size | `1216 × 832` |
|
| 475 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 476 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 477 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 478 |
+
| Self-attention gain | `-0.03` |
|
| 479 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 480 |
+
|
| 481 |
+
</details>
|
| 482 |
+
|
| 483 |
+
[Back to the top](#top)
|
| 484 |
+
|
| 485 |
+
<a id="still_woman"></a>
|
| 486 |
+
|
| 487 |
+
#### Woman by a window
|
| 488 |
+
|
| 489 |
+
[](assets/gallery/still_woman.png)
|
| 490 |
+
|
| 491 |
+
<details open>
|
| 492 |
+
<summary>Generation settings</summary>
|
| 493 |
+
|
| 494 |
+
**Prompt**
|
| 495 |
+
|
| 496 |
+
> A movie still shows a young woman with shoulder-length brown hair looking
|
| 497 |
+
> downward while seated indoors. She wears a white, open-knit cardigan over a
|
| 498 |
+
> dark top, a gold heart-shaped locket, and small gold hoop earrings. In the
|
| 499 |
+
> foreground, the back of another person's head and shoulder are visible in soft
|
| 500 |
+
> focus, partially obscuring the right side of the frame. The background
|
| 501 |
+
> features a window with thin, beige curtains and soft, natural light. The image
|
| 502 |
+
> has a shallow depth of field and slight film grain.
|
| 503 |
+
|
| 504 |
+
| Setting | Value |
|
| 505 |
+
| --- | --- |
|
| 506 |
+
| Seed | `43` |
|
| 507 |
+
| Size | `1536 × 832` |
|
| 508 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 509 |
+
| Log-SNR shift | `-3.22` (−0.25 plus the resolution term) |
|
| 510 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 511 |
+
| Self-attention gain | `-0.02` |
|
| 512 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 513 |
+
|
| 514 |
+
</details>
|
| 515 |
+
|
| 516 |
+
[Back to the top](#top)
|
| 517 |
+
|
| 518 |
+
<a id="nissan"></a>
|
| 519 |
+
|
| 520 |
+
#### Nissan 300ZX at night
|
| 521 |
+
|
| 522 |
+
[](assets/gallery/nissan.png)
|
| 523 |
+
|
| 524 |
+
<details open>
|
| 525 |
+
<summary>Generation settings</summary>
|
| 526 |
+
|
| 527 |
+
**Prompt**
|
| 528 |
+
|
| 529 |
+
> A silver 1980s Nissan 300ZX sports car is parked at night in front of a
|
| 530 |
+
> corrugated metal building with a large neon sign that reads "CARGOJET". The
|
| 531 |
+
> car is angled towards the camera, with its headlights on. The building has a
|
| 532 |
+
> loading dock and a concrete barrier in front of it.
|
| 533 |
+
|
| 534 |
+
| Setting | Value |
|
| 535 |
+
| --- | --- |
|
| 536 |
+
| Seed | `42` |
|
| 537 |
+
| Size | `1664 × 1120` |
|
| 538 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 539 |
+
| Log-SNR shift | `-3.60` (−0.25 plus the resolution term) |
|
| 540 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 541 |
+
| Self-attention gain | `-0.01` |
|
| 542 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 543 |
+
|
| 544 |
+
</details>
|
| 545 |
+
|
| 546 |
+
[Back to the top](#top)
|
| 547 |
+
|
| 548 |
+
<a id="marina"></a>
|
| 549 |
+
|
| 550 |
+
#### Coastal village at dusk
|
| 551 |
+
|
| 552 |
+
[](assets/gallery/marina.png)
|
| 553 |
+
|
| 554 |
+
<details open>
|
| 555 |
+
<summary>Generation settings</summary>
|
| 556 |
+
|
| 557 |
+
**Prompt**
|
| 558 |
+
|
| 559 |
+
> A calm coastal village at dusk with a small marina in the foreground: dozens
|
| 560 |
+
> of moored fishing boats and dinghies clustered along a stone quay, orange
|
| 561 |
+
> buoys floating in the water, and a white lighthouse with a green stripe
|
| 562 |
+
> standing near low warehouse buildings. Behind the harbor, terraced houses and
|
| 563 |
+
> apartment buildings with red-tiled roofs climb a tree-dotted hillside, their
|
| 564 |
+
> pale walls and balconies softly lit by the last light. The water reflects the
|
| 565 |
+
> boats and lights, and a pebbled shoreline runs along the lower edge of the
|
| 566 |
+
> frame.
|
| 567 |
+
|
| 568 |
+
| Setting | Value |
|
| 569 |
+
| --- | --- |
|
| 570 |
+
| Seed | `438` |
|
| 571 |
+
| Size | `1216 × 832` |
|
| 572 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 573 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 574 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 575 |
+
| Self-attention gain | `-0.03` |
|
| 576 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 577 |
+
|
| 578 |
+
</details>
|
| 579 |
+
|
| 580 |
+
[Back to the top](#top)
|
| 581 |
+
|
| 582 |
+
### Paintings and prints
|
| 583 |
+
|
| 584 |
+
<a id="constable"></a>
|
| 585 |
+
|
| 586 |
+
#### Landscape painting
|
| 587 |
+
|
| 588 |
+
[](assets/gallery/constable.png)
|
| 589 |
+
|
| 590 |
+
<details open>
|
| 591 |
+
<summary>Generation settings</summary>
|
| 592 |
+
|
| 593 |
+
**Prompt**
|
| 594 |
+
|
| 595 |
+
> An oil painting of a landscape with sheep and farmers near a mill by John
|
| 596 |
+
> Constable
|
| 597 |
+
|
| 598 |
+
| Setting | Value |
|
| 599 |
+
| --- | --- |
|
| 600 |
+
| Seed | `44` |
|
| 601 |
+
| Size | `1216 × 1088` |
|
| 602 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 603 |
+
| Log-SNR shift | `-3.26` (−0.25 plus the resolution term) |
|
| 604 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 605 |
+
| Self-attention gain | `-0.02` |
|
| 606 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 607 |
+
|
| 608 |
+
</details>
|
| 609 |
+
|
| 610 |
+
[Back to the top](#top)
|
| 611 |
+
|
| 612 |
+
<a id="weenix"></a>
|
| 613 |
+
|
| 614 |
+
#### Mastiff over a fallen dog
|
| 615 |
+
|
| 616 |
+
[](assets/gallery/weenix.png)
|
| 617 |
+
|
| 618 |
+
<details open>
|
| 619 |
+
<summary>Generation settings</summary>
|
| 620 |
+
|
| 621 |
+
**Prompt**
|
| 622 |
+
|
| 623 |
+
> An oil painting in the Baroque style by Jan Weenix depicts a large,
|
| 624 |
+
> tan-colored mastiff standing over a dead, dark brown shaggy dog. The standing
|
| 625 |
+
> dog is seen in profile, wearing a thick black leather collar, with a focused,
|
| 626 |
+
> alert expression and its mouth slightly open. The deceased dog lies on its
|
| 627 |
+
> side in the foreground, its mouth agape to reveal teeth, with its coarse fur
|
| 628 |
+
> rendered in deep browns and blacks. Two small, dead songbirds with grey and
|
| 629 |
+
> white plumage lie on the dusty ground near the fallen dog. The setting is a
|
| 630 |
+
> wild landscape under a moody, overcast sky with a glimpse of a valley and
|
| 631 |
+
> distant hills. To the right, a cluster of greenery includes large, curling
|
| 632 |
+
> leaves and a few small red and blue flowers. The lighting is dramatic, with a
|
| 633 |
+
> strong highlight on the standing dog's face and shoulder, casting the rest of
|
| 634 |
+
> the scene in deep, rich shadows. The image has the smooth, blended texture of
|
| 635 |
+
> a classical oil canvas.
|
| 636 |
+
|
| 637 |
+
| Setting | Value |
|
| 638 |
+
| --- | --- |
|
| 639 |
+
| Seed | `231` |
|
| 640 |
+
| Size | `896 × 1088` |
|
| 641 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 642 |
+
| Log-SNR shift | `-2.95` (−0.25 plus the resolution term) |
|
| 643 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 644 |
+
| Self-attention gain | `-0.03` |
|
| 645 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 646 |
+
|
| 647 |
+
</details>
|
| 648 |
+
|
| 649 |
+
[Back to the top](#top)
|
| 650 |
+
|
| 651 |
+
<a id="wahlberg"></a>
|
| 652 |
+
|
| 653 |
+
#### Barn and windmill
|
| 654 |
+
|
| 655 |
+
[](assets/gallery/wahlberg.png)
|
| 656 |
+
|
| 657 |
+
<details open>
|
| 658 |
+
<summary>Generation settings</summary>
|
| 659 |
+
|
| 660 |
+
**Prompt**
|
| 661 |
+
|
| 662 |
+
> A black and white oil painting by Alfred Wahlberg in the style of realism,
|
| 663 |
+
> depicting a rural landscape. In the center, a weathered wooden barn with a
|
| 664 |
+
> steep, gabled roof stands beside a tall, tapered windmill tower. A leafless,
|
| 665 |
+
> spindly tree with fine branches dominates the middle ground, partially
|
| 666 |
+
> obscuring the structures. To the left, a calm body of water meets a soft
|
| 667 |
+
> horizon under a vast, overcast sky filled with textured, swirling clouds. To
|
| 668 |
+
> the right, a dirt path winds up a gentle slope toward a few distant cottages.
|
| 669 |
+
> The terrain is rugged, with scrubby bushes, patches of dry grass, and a rustic
|
| 670 |
+
> wooden fence in the foreground. The image is rendered with a fine, painterly
|
| 671 |
+
> grain and a soft contrast, blending muted grey and white tones to create a
|
| 672 |
+
> somber, atmospheric mood.
|
| 673 |
+
|
| 674 |
+
| Setting | Value |
|
| 675 |
+
| --- | --- |
|
| 676 |
+
| Seed | `426` |
|
| 677 |
+
| Size | `1280 × 768` |
|
| 678 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 679 |
+
| Log-SNR shift | `-2.96` (−0.25 plus the resolution term) |
|
| 680 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 681 |
+
| Self-attention gain | `-0.03` |
|
| 682 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 683 |
+
|
| 684 |
+
</details>
|
| 685 |
+
|
| 686 |
+
[Back to the top](#top)
|
| 687 |
+
|
| 688 |
+
<a id="renoir"></a>
|
| 689 |
+
|
| 690 |
+
#### Roses
|
| 691 |
+
|
| 692 |
+
[](assets/gallery/renoir.png)
|
| 693 |
+
|
| 694 |
+
<details open>
|
| 695 |
+
<summary>Generation settings</summary>
|
| 696 |
+
|
| 697 |
+
**Prompt**
|
| 698 |
+
|
| 699 |
+
> An Impressionist oil painting by Pierre-Auguste Renoir featuring a tight
|
| 700 |
+
> cluster of blooming roses. The composition is a close-up, filling the square
|
| 701 |
+
> frame with vivid red, pale yellow, and creamy white blossoms interspersed with
|
| 702 |
+
> deep green foliage. The brushwork is loose and feathered, creating a soft,
|
| 703 |
+
> blurred texture that blends the petals into one another. The background is a
|
| 704 |
+
> warm, mottled brown and ochre, applied with visible, directional strokes. The
|
| 705 |
+
> painting is rendered on a coarse canvas, with the heavy textile weave showing
|
| 706 |
+
> through the paint throughout the image. Lighting is diffused and bright,
|
| 707 |
+
> creating luminous highlights on the tops of the petals and deep, saturated
|
| 708 |
+
> shadows in the centers of the red roses.
|
| 709 |
+
|
| 710 |
+
| Setting | Value |
|
| 711 |
+
| --- | --- |
|
| 712 |
+
| Seed | `136` |
|
| 713 |
+
| Size | `1024 × 1024` |
|
| 714 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 715 |
+
| Log-SNR shift | `-3.02` (−0.25 plus the resolution term) |
|
| 716 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 717 |
+
| Self-attention gain | `-0.03` |
|
| 718 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 719 |
+
|
| 720 |
+
</details>
|
| 721 |
+
|
| 722 |
+
[Back to the top](#top)
|
| 723 |
+
|
| 724 |
+
<a id="larson"></a>
|
| 725 |
+
|
| 726 |
+
#### Stormy coast
|
| 727 |
+
|
| 728 |
+
[](assets/gallery/larson.png)
|
| 729 |
+
|
| 730 |
+
<details open>
|
| 731 |
+
<summary>Generation settings</summary>
|
| 732 |
+
|
| 733 |
+
**Prompt**
|
| 734 |
+
|
| 735 |
+
> A Romanticism oil painting by Marcus Larson depicting a turbulent sea crashing
|
| 736 |
+
> against jagged, dark reddish-brown rock formations. In the foreground, white
|
| 737 |
+
> frothy waves swell and break violently against the sharp edges of the rocks,
|
| 738 |
+
> creating a sense of motion and spray. The middle ground contains several
|
| 739 |
+
> isolated rocky islets emerging from the churning, olive-green water, with
|
| 740 |
+
> distant silhouettes of sailing ships visible on the horizon under a heavy sky.
|
| 741 |
+
> The sky is filled with dramatic, swirling grey and white clouds, through which
|
| 742 |
+
> bright beams of sunlight pierce downward in sharp diagonal lines, illuminating
|
| 743 |
+
> patches of the ocean. Small, dark birds fly sporadically across the expanse of
|
| 744 |
+
> the sky. The painting has a rich, blended texture with visible brushwork in
|
| 745 |
+
> the foam and clouds. In the bottom left corner, a signature reads "Marcus
|
| 746 |
+
> Larson".
|
| 747 |
+
|
| 748 |
+
| Setting | Value |
|
| 749 |
+
| --- | --- |
|
| 750 |
+
| Seed | `137` |
|
| 751 |
+
| Size | `1216 × 832` |
|
| 752 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 753 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 754 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 755 |
+
| Self-attention gain | `-0.03` |
|
| 756 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 757 |
+
|
| 758 |
+
</details>
|
| 759 |
+
|
| 760 |
+
[Back to the top](#top)
|
| 761 |
+
|
| 762 |
+
<a id="collier"></a>
|
| 763 |
+
|
| 764 |
+
#### Portrait with spectacles
|
| 765 |
+
|
| 766 |
+
[](assets/gallery/collier.png)
|
| 767 |
+
|
| 768 |
+
<details open>
|
| 769 |
+
<summary>Generation settings</summary>
|
| 770 |
+
|
| 771 |
+
**Prompt**
|
| 772 |
+
|
| 773 |
+
> A realist oil portrait by John Collier of a middle-aged man with a fair
|
| 774 |
+
> complexion, facing forward. He has short brown hair, thick dark eyebrows, and
|
| 775 |
+
> a full brown mustache. He wears thin-rimmed round spectacles and a
|
| 776 |
+
> high-collared, button-up white garment made of a heavy fabric. The lighting
|
| 777 |
+
> falls from the upper left, casting a soft shadow on the right side of his face
|
| 778 |
+
> and under his mustache. The background is a textured, neutral grey with
|
| 779 |
+
> visible vertical brushstrokes. In the bottom right corner, the artist's
|
| 780 |
+
> signature "John Collier" and the date "1891" are written in dark paint. The
|
| 781 |
+
> image has the texture of a weathered canvas with fine cracks and a matte
|
| 782 |
+
> finish.
|
| 783 |
+
|
| 784 |
+
| Setting | Value |
|
| 785 |
+
| --- | --- |
|
| 786 |
+
| Seed | `232` |
|
| 787 |
+
| Size | `896 × 1088` |
|
| 788 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 789 |
+
| Log-SNR shift | `-2.95` (−0.25 plus the resolution term) |
|
| 790 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 791 |
+
| Self-attention gain | `-0.03` |
|
| 792 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 793 |
+
|
| 794 |
+
</details>
|
| 795 |
+
|
| 796 |
+
[Back to the top](#top)
|
| 797 |
+
|
| 798 |
+
<a id="rousseau"></a>
|
| 799 |
+
|
| 800 |
+
#### River landscape
|
| 801 |
+
|
| 802 |
+
[](assets/gallery/rousseau.png)
|
| 803 |
+
|
| 804 |
+
<details open>
|
| 805 |
+
<summary>Generation settings</summary>
|
| 806 |
+
|
| 807 |
+
**Prompt**
|
| 808 |
+
|
| 809 |
+
> A landscape painting in the style of Realism by Theodore Rousseau depicts a
|
| 810 |
+
> serene river scene under a pale blue sky with scattered, wispy white clouds.
|
| 811 |
+
> In the center, a cluster of lush, green deciduous trees with dense foliage
|
| 812 |
+
> reflects in the still, glassy water of a winding river. To the left, a small
|
| 813 |
+
> group of figures and brown cattle gather near the riverbank, rendered with
|
| 814 |
+
> small, detailed brushstrokes. The foreground consists of dark, textured
|
| 815 |
+
> shrubbery and earthy riverbanks in deep greens and browns. The composition is
|
| 816 |
+
> a wide horizontal view with a low horizon line, emphasizing the expanse of the
|
| 817 |
+
> sky and the natural layering of the vegetation. The overall rendering features
|
| 818 |
+
> a fine, blended oil texture with soft, natural lighting that creates a hazy,
|
| 819 |
+
> atmospheric quality. The painting is enclosed in a thin, simple gold frame.
|
| 820 |
+
|
| 821 |
+
| Setting | Value |
|
| 822 |
+
| --- | --- |
|
| 823 |
+
| Seed | `138` |
|
| 824 |
+
| Size | `1216 × 832` |
|
| 825 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 826 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 827 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 828 |
+
| Self-attention gain | `-0.03` |
|
| 829 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 830 |
+
|
| 831 |
+
</details>
|
| 832 |
+
|
| 833 |
+
[Back to the top](#top)
|
| 834 |
+
|
| 835 |
+
<a id="hokusai"></a>
|
| 836 |
+
|
| 837 |
+
#### The Great Wave
|
| 838 |
+
|
| 839 |
+
[](assets/gallery/hokusai.png)
|
| 840 |
+
|
| 841 |
+
<details open>
|
| 842 |
+
<summary>Generation settings</summary>
|
| 843 |
+
|
| 844 |
+
**Prompt**
|
| 845 |
+
|
| 846 |
+
> A traditional japanese woodblock print, "the great wave off kanagawa" by
|
| 847 |
+
> hokusai, depicts a massive blue and white wave crashing towards the viewer
|
| 848 |
+
> against a pale blue sky.
|
| 849 |
+
|
| 850 |
+
| Setting | Value |
|
| 851 |
+
| --- | --- |
|
| 852 |
+
| Seed | `424` |
|
| 853 |
+
| Size | `1024 × 1024` |
|
| 854 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 855 |
+
| Log-SNR shift | `-3.02` (−0.25 plus the resolution term) |
|
| 856 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 857 |
+
| Self-attention gain | `-0.03` |
|
| 858 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 859 |
+
|
| 860 |
+
</details>
|
| 861 |
+
|
| 862 |
+
[Back to the top](#top)
|
| 863 |
+
|
| 864 |
+
### JSON layouts
|
| 865 |
+
|
| 866 |
+
<a id="poster_jazz"></a>
|
| 867 |
+
|
| 868 |
+
#### Jazz festival poster
|
| 869 |
+
|
| 870 |
+
[](assets/gallery/poster_jazz.png)
|
| 871 |
+
|
| 872 |
+
<details open>
|
| 873 |
+
<summary>Generation settings</summary>
|
| 874 |
+
|
| 875 |
+
**Layout prompt** (compiled to the image size by the Layout Encode node)
|
| 876 |
+
|
| 877 |
+
```json
|
| 878 |
+
{
|
| 879 |
+
"summary": {
|
| 880 |
+
"meta": [
|
| 881 |
+
"concert_poster",
|
| 882 |
+
"flat_illustration",
|
| 883 |
+
"mid_century_modern"
|
| 884 |
+
],
|
| 885 |
+
"canvas": "single",
|
| 886 |
+
"caption": "A mid-century style jazz festival poster shows a saxophonist in silhouette against a large orange sun on a deep teal background. The title \"BLUE HARBOR JAZZ\" runs across the top in cream capitals and the line \"JULY 12 – 14, 1996\" sits at the bottom."
|
| 887 |
+
},
|
| 888 |
+
"frame": {
|
| 889 |
+
"caption": "The saxophonist stands in the centre, cut off at the knees, with the sun behind his shoulders. The title fills the top fifth and the date line sits in a band along the bottom edge. Flat colour shapes with a light paper grain.",
|
| 890 |
+
"tags": [
|
| 891 |
+
"flat_color",
|
| 892 |
+
"centered_composition",
|
| 893 |
+
"paper_grain"
|
| 894 |
+
],
|
| 895 |
+
"palette": [
|
| 896 |
+
"#0F4C5C",
|
| 897 |
+
"#F28C28",
|
| 898 |
+
"#F5E9D0",
|
| 899 |
+
"#1B1B1B"
|
| 900 |
+
]
|
| 901 |
+
},
|
| 902 |
+
"items": [
|
| 903 |
+
{
|
| 904 |
+
"label": "object",
|
| 905 |
+
"caption": "A large flat orange circle, the sun, behind the musician.",
|
| 906 |
+
"tags": [
|
| 907 |
+
"sun",
|
| 908 |
+
"circle"
|
| 909 |
+
],
|
| 910 |
+
"palette": [
|
| 911 |
+
"#F28C28"
|
| 912 |
+
],
|
| 913 |
+
"box_2d": [
|
| 914 |
+
230,
|
| 915 |
+
170,
|
| 916 |
+
720,
|
| 917 |
+
830
|
| 918 |
+
]
|
| 919 |
+
},
|
| 920 |
+
{
|
| 921 |
+
"label": "character",
|
| 922 |
+
"caption": "A black silhouette of a man in a hat playing a tenor saxophone, facing right, leaning back slightly.",
|
| 923 |
+
"tags": [
|
| 924 |
+
"saxophonist",
|
| 925 |
+
"silhouette",
|
| 926 |
+
"hat"
|
| 927 |
+
],
|
| 928 |
+
"palette": [
|
| 929 |
+
"#1B1B1B"
|
| 930 |
+
],
|
| 931 |
+
"box_2d": [
|
| 932 |
+
260,
|
| 933 |
+
250,
|
| 934 |
+
880,
|
| 935 |
+
760
|
| 936 |
+
]
|
| 937 |
+
},
|
| 938 |
+
{
|
| 939 |
+
"label": "text",
|
| 940 |
+
"caption": "The title \"BLUE HARBOR JAZZ\" in bold condensed cream capitals on one line.",
|
| 941 |
+
"text": "BLUE HARBOR JAZZ",
|
| 942 |
+
"tags": [
|
| 943 |
+
"title",
|
| 944 |
+
"condensed_sans",
|
| 945 |
+
"uppercase"
|
| 946 |
+
],
|
| 947 |
+
"palette": [
|
| 948 |
+
"#F5E9D0"
|
| 949 |
+
],
|
| 950 |
+
"box_2d": [
|
| 951 |
+
60,
|
| 952 |
+
70,
|
| 953 |
+
180,
|
| 954 |
+
930
|
| 955 |
+
]
|
| 956 |
+
},
|
| 957 |
+
{
|
| 958 |
+
"label": "text",
|
| 959 |
+
"caption": "The date line \"JULY 12 – 14, 1996\" in small spaced cream capitals.",
|
| 960 |
+
"text": "JULY 12 – 14, 1996",
|
| 961 |
+
"tags": [
|
| 962 |
+
"date",
|
| 963 |
+
"small_caps"
|
| 964 |
+
],
|
| 965 |
+
"palette": [
|
| 966 |
+
"#F5E9D0"
|
| 967 |
+
],
|
| 968 |
+
"box_2d": [
|
| 969 |
+
905,
|
| 970 |
+
300,
|
| 971 |
+
950,
|
| 972 |
+
700
|
| 973 |
+
]
|
| 974 |
+
}
|
| 975 |
+
]
|
| 976 |
+
}
|
| 977 |
+
```
|
| 978 |
+
|
| 979 |
+
| Setting | Value |
|
| 980 |
+
| --- | --- |
|
| 981 |
+
| Seed | `42` |
|
| 982 |
+
| Size | `832 × 1216` |
|
| 983 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 984 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 985 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 986 |
+
| Self-attention gain | `-0.03` |
|
| 987 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 988 |
+
|
| 989 |
+
</details>
|
| 990 |
+
|
| 991 |
+
[Back to the top](#top)
|
| 992 |
+
|
| 993 |
+
<a id="poster_travel"></a>
|
| 994 |
+
|
| 995 |
+
#### Travel poster
|
| 996 |
+
|
| 997 |
+
[](assets/gallery/poster_travel.png)
|
| 998 |
+
|
| 999 |
+
<details open>
|
| 1000 |
+
<summary>Generation settings</summary>
|
| 1001 |
+
|
| 1002 |
+
**Layout prompt** (compiled to the image size by the Layout Encode node)
|
| 1003 |
+
|
| 1004 |
+
```json
|
| 1005 |
+
{
|
| 1006 |
+
"summary": {
|
| 1007 |
+
"meta": [
|
| 1008 |
+
"travel_poster",
|
| 1009 |
+
"screenprint",
|
| 1010 |
+
"national_park"
|
| 1011 |
+
],
|
| 1012 |
+
"canvas": "single",
|
| 1013 |
+
"caption": "A vintage screenprint travel poster of a snow-capped mountain above a pine forest and a still lake at sunrise. The words \"VISIT\" and \"SILVER LAKE\" are set in the sky, and a cream band at the bottom reads \"OPEN ALL YEAR\"."
|
| 1014 |
+
},
|
| 1015 |
+
"frame": {
|
| 1016 |
+
"caption": "The mountain peak rises in the upper middle, pines frame both sides, and the lake reflects the peak in the lower third. A cream border surrounds the image and widens into a band at the bottom. Four flat inks with visible screenprint texture.",
|
| 1017 |
+
"tags": [
|
| 1018 |
+
"limited_palette",
|
| 1019 |
+
"bordered",
|
| 1020 |
+
"symmetrical"
|
| 1021 |
+
],
|
| 1022 |
+
"palette": [
|
| 1023 |
+
"#F3E6C8",
|
| 1024 |
+
"#E8793A",
|
| 1025 |
+
"#2F5D62",
|
| 1026 |
+
"#1E2F3A"
|
| 1027 |
+
]
|
| 1028 |
+
},
|
| 1029 |
+
"items": [
|
| 1030 |
+
{
|
| 1031 |
+
"label": "object",
|
| 1032 |
+
"caption": "A snow-capped mountain with orange light on its left face.",
|
| 1033 |
+
"tags": [
|
| 1034 |
+
"mountain",
|
| 1035 |
+
"snow_cap"
|
| 1036 |
+
],
|
| 1037 |
+
"palette": [
|
| 1038 |
+
"#E8793A",
|
| 1039 |
+
"#F3E6C8",
|
| 1040 |
+
"#2F5D62"
|
| 1041 |
+
],
|
| 1042 |
+
"box_2d": [
|
| 1043 |
+
250,
|
| 1044 |
+
180,
|
| 1045 |
+
620,
|
| 1046 |
+
820
|
| 1047 |
+
]
|
| 1048 |
+
},
|
| 1049 |
+
{
|
| 1050 |
+
"label": "object",
|
| 1051 |
+
"caption": "A calm lake with a soft reflection of the mountain and a small red canoe near the right shore.",
|
| 1052 |
+
"tags": [
|
| 1053 |
+
"lake",
|
| 1054 |
+
"reflection",
|
| 1055 |
+
"canoe"
|
| 1056 |
+
],
|
| 1057 |
+
"palette": [
|
| 1058 |
+
"#2F5D62",
|
| 1059 |
+
"#E8793A"
|
| 1060 |
+
],
|
| 1061 |
+
"box_2d": [
|
| 1062 |
+
620,
|
| 1063 |
+
60,
|
| 1064 |
+
860,
|
| 1065 |
+
940
|
| 1066 |
+
]
|
| 1067 |
+
},
|
| 1068 |
+
{
|
| 1069 |
+
"label": "text",
|
| 1070 |
+
"caption": "The small word \"VISIT\" in spaced dark capitals.",
|
| 1071 |
+
"text": "VISIT",
|
| 1072 |
+
"tags": [
|
| 1073 |
+
"kicker",
|
| 1074 |
+
"uppercase"
|
| 1075 |
+
],
|
| 1076 |
+
"palette": [
|
| 1077 |
+
"#1E2F3A"
|
| 1078 |
+
],
|
| 1079 |
+
"box_2d": [
|
| 1080 |
+
70,
|
| 1081 |
+
400,
|
| 1082 |
+
110,
|
| 1083 |
+
600
|
| 1084 |
+
]
|
| 1085 |
+
},
|
| 1086 |
+
{
|
| 1087 |
+
"label": "text",
|
| 1088 |
+
"caption": "The title \"SILVER LAKE\" in tall dark serif capitals.",
|
| 1089 |
+
"text": "SILVER LAKE",
|
| 1090 |
+
"tags": [
|
| 1091 |
+
"title",
|
| 1092 |
+
"serif",
|
| 1093 |
+
"uppercase"
|
| 1094 |
+
],
|
| 1095 |
+
"palette": [
|
| 1096 |
+
"#1E2F3A"
|
| 1097 |
+
],
|
| 1098 |
+
"box_2d": [
|
| 1099 |
+
120,
|
| 1100 |
+
110,
|
| 1101 |
+
220,
|
| 1102 |
+
890
|
| 1103 |
+
]
|
| 1104 |
+
},
|
| 1105 |
+
{
|
| 1106 |
+
"label": "text",
|
| 1107 |
+
"caption": "The line \"OPEN ALL YEAR\" in dark capitals centred in the cream band.",
|
| 1108 |
+
"text": "OPEN ALL YEAR",
|
| 1109 |
+
"tags": [
|
| 1110 |
+
"tagline",
|
| 1111 |
+
"uppercase"
|
| 1112 |
+
],
|
| 1113 |
+
"palette": [
|
| 1114 |
+
"#1E2F3A"
|
| 1115 |
+
],
|
| 1116 |
+
"box_2d": [
|
| 1117 |
+
895,
|
| 1118 |
+
260,
|
| 1119 |
+
945,
|
| 1120 |
+
740
|
| 1121 |
+
]
|
| 1122 |
+
}
|
| 1123 |
+
]
|
| 1124 |
+
}
|
| 1125 |
+
```
|
| 1126 |
+
|
| 1127 |
+
| Setting | Value |
|
| 1128 |
+
| --- | --- |
|
| 1129 |
+
| Seed | `50` |
|
| 1130 |
+
| Size | `832 × 1216` |
|
| 1131 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 1132 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 1133 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 1134 |
+
| Self-attention gain | `-0.03` |
|
| 1135 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 1136 |
+
|
| 1137 |
+
</details>
|
| 1138 |
+
|
| 1139 |
+
[Back to the top](#top)
|
| 1140 |
+
|
| 1141 |
+
<a id="poster_film"></a>
|
| 1142 |
+
|
| 1143 |
+
#### Film poster
|
| 1144 |
+
|
| 1145 |
+
[](assets/gallery/poster_film.png)
|
| 1146 |
+
|
| 1147 |
+
<details open>
|
| 1148 |
+
<summary>Generation settings</summary>
|
| 1149 |
+
|
| 1150 |
+
**Layout prompt** (compiled to the image size by the Layout Encode node)
|
| 1151 |
+
|
| 1152 |
+
```json
|
| 1153 |
+
{
|
| 1154 |
+
"summary": {
|
| 1155 |
+
"meta": [
|
| 1156 |
+
"movie_poster",
|
| 1157 |
+
"photographic",
|
| 1158 |
+
"thriller"
|
| 1159 |
+
],
|
| 1160 |
+
"canvas": "single",
|
| 1161 |
+
"caption": "A moody photographic film poster shows a woman in a long grey coat standing on an empty train platform at night, lit by one overhead lamp, with fog behind her. The title \"THE LAST TRAIN\" is set in thin white capitals across the lower third, above the small line \"A FILM BY MARA VOSS\"."
|
| 1162 |
+
},
|
| 1163 |
+
"frame": {
|
| 1164 |
+
"caption": "The woman stands slightly left of centre, full length, facing the camera, with the platform edge leading into the fog on the right. The top half is dark sky and lamp glow. Cool teal grade with a warm lamp highlight and fine film grain.",
|
| 1165 |
+
"tags": [
|
| 1166 |
+
"low_key_lighting",
|
| 1167 |
+
"teal_orange_grade",
|
| 1168 |
+
"film_grain"
|
| 1169 |
+
],
|
| 1170 |
+
"palette": [
|
| 1171 |
+
"#0E1B22",
|
| 1172 |
+
"#27505B",
|
| 1173 |
+
"#D9A15B",
|
| 1174 |
+
"#E9EEF0"
|
| 1175 |
+
]
|
| 1176 |
+
},
|
| 1177 |
+
"items": [
|
| 1178 |
+
{
|
| 1179 |
+
"label": "character",
|
| 1180 |
+
"caption": "A woman in her thirties with dark shoulder-length hair, a long grey wool coat and black boots, hands in her pockets, with a calm, direct look.",
|
| 1181 |
+
"tags": [
|
| 1182 |
+
"woman",
|
| 1183 |
+
"grey_coat",
|
| 1184 |
+
"full_length"
|
| 1185 |
+
],
|
| 1186 |
+
"palette": [
|
| 1187 |
+
"#6F7C80",
|
| 1188 |
+
"#1A1F22",
|
| 1189 |
+
"#C9A58A"
|
| 1190 |
+
],
|
| 1191 |
+
"box_2d": [
|
| 1192 |
+
250,
|
| 1193 |
+
240,
|
| 1194 |
+
800,
|
| 1195 |
+
560
|
| 1196 |
+
]
|
| 1197 |
+
},
|
| 1198 |
+
{
|
| 1199 |
+
"label": "object",
|
| 1200 |
+
"caption": "A hanging platform lamp with a warm cone of light in the fog.",
|
| 1201 |
+
"tags": [
|
| 1202 |
+
"lamp",
|
| 1203 |
+
"warm_light",
|
| 1204 |
+
"fog"
|
| 1205 |
+
],
|
| 1206 |
+
"palette": [
|
| 1207 |
+
"#D9A15B",
|
| 1208 |
+
"#F3D9A8"
|
| 1209 |
+
],
|
| 1210 |
+
"box_2d": [
|
| 1211 |
+
60,
|
| 1212 |
+
330,
|
| 1213 |
+
270,
|
| 1214 |
+
560
|
| 1215 |
+
]
|
| 1216 |
+
},
|
| 1217 |
+
{
|
| 1218 |
+
"label": "text",
|
| 1219 |
+
"caption": "The title \"THE LAST TRAIN\" in thin, widely spaced white capitals.",
|
| 1220 |
+
"text": "THE LAST TRAIN",
|
| 1221 |
+
"tags": [
|
| 1222 |
+
"movie_title",
|
| 1223 |
+
"thin_type",
|
| 1224 |
+
"uppercase"
|
| 1225 |
+
],
|
| 1226 |
+
"palette": [
|
| 1227 |
+
"#E9EEF0"
|
| 1228 |
+
],
|
| 1229 |
+
"box_2d": [
|
| 1230 |
+
815,
|
| 1231 |
+
80,
|
| 1232 |
+
880,
|
| 1233 |
+
920
|
| 1234 |
+
]
|
| 1235 |
+
},
|
| 1236 |
+
{
|
| 1237 |
+
"label": "text",
|
| 1238 |
+
"caption": "The credit line \"A FILM BY MARA VOSS\" in very small white capitals.",
|
| 1239 |
+
"text": "A FILM BY MARA VOSS",
|
| 1240 |
+
"tags": [
|
| 1241 |
+
"credit_line",
|
| 1242 |
+
"small_type"
|
| 1243 |
+
],
|
| 1244 |
+
"palette": [
|
| 1245 |
+
"#E9EEF0"
|
| 1246 |
+
],
|
| 1247 |
+
"box_2d": [
|
| 1248 |
+
900,
|
| 1249 |
+
300,
|
| 1250 |
+
930,
|
| 1251 |
+
700
|
| 1252 |
+
]
|
| 1253 |
+
}
|
| 1254 |
+
]
|
| 1255 |
+
}
|
| 1256 |
+
```
|
| 1257 |
+
|
| 1258 |
+
| Setting | Value |
|
| 1259 |
+
| --- | --- |
|
| 1260 |
+
| Seed | `44` |
|
| 1261 |
+
| Size | `832 × 1216` |
|
| 1262 |
+
| Sampling | `50` ER-SDE steps, Beta(1.25, 1.25), noise scale `1` |
|
| 1263 |
+
| Log-SNR shift | `-2.99` (−0.25 plus the resolution term) |
|
| 1264 |
+
| Guidance | PDG, full path drop, constant `2.5`, suffix caption bias `-4`; CFG off |
|
| 1265 |
+
| Self-attention gain | `-0.03` |
|
| 1266 |
+
| Model | `dflow_2b 0.2`, bfloat16 weights |
|
| 1267 |
+
|
| 1268 |
+
</details>
|
| 1269 |
+
|
| 1270 |
+
[Back to the top](#top)
|
LICENSE
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ModelGo Attribution-NonCommercial License
|
| 2 |
+
Version 2.0, May 2025
|
| 3 |
+
|
| 4 |
+
By exercising the rights granted in Section 2.1, You acknowledge and agree that You have
|
| 5 |
+
read, understood, and agree to be bound by the terms and conditions of this License. If You
|
| 6 |
+
do not agree to any terms and/or conditions of this License, then the Licensor grants You no
|
| 7 |
+
rights under this License.
|
| 8 |
+
|
| 9 |
+
1. DEFINITIONS
|
| 10 |
+
|
| 11 |
+
"Complementary Materials" means the source code and scripts used to define, run, load,
|
| 12 |
+
benchmark and/or evaluate the Model, and prepare data for the purpose of training, pretraining,
|
| 13 |
+
fine-tuning and/or evaluation of the Model, and any tutorials, operating manuals, user guides
|
| 14 |
+
and/or documentation that guide users in using, operating, implementing and/or customising
|
| 15 |
+
the Model.
|
| 16 |
+
|
| 17 |
+
"Derivative Materials" means all improvements, modifications or derivative works to the
|
| 18 |
+
Licensed Material or any part thereof, which are created or developed by You (either by
|
| 19 |
+
Yourself or jointly with other third parties), including any derivative model developed by
|
| 20 |
+
transferring patterns of weights, parameters, activations and/or Output from the Model, such as
|
| 21 |
+
through distillation methods or synthetic data generation techniques, in order to replicate,
|
| 22 |
+
approximate, or otherwise achieve functional behavior that is similar to the Model.
|
| 23 |
+
|
| 24 |
+
"Distribution" (or "Distribute") means any transmission, publication, public performance,
|
| 25 |
+
sharing, or other methods of making the Licensed Materials, Derivative Materials and/or Output
|
| 26 |
+
available to a third party, including providing the Licensed Materials or any part thereof as a
|
| 27 |
+
hosted service or remotely accessible service, such as API-based access or web access.
|
| 28 |
+
|
| 29 |
+
"Licensor" means the rights owner that is granting the License.
|
| 30 |
+
|
| 31 |
+
"Licensed Materials" means the Model and Complementary Materials that are Distributed by
|
| 32 |
+
the Licensor under this License. The Licensed Materials do not include any datasets used for
|
| 33 |
+
pretraining, training, adapting, or evaluating the Model, which may or may not be made
|
| 34 |
+
available under a separate license.
|
| 35 |
+
|
| 36 |
+
"Model" means the machine-learning constructs and/or assemblies licensed by the Licensor
|
| 37 |
+
under this License, including any checkpoints, learned weights, parameters (including optimizer
|
| 38 |
+
states) and the model architecture.
|
| 39 |
+
|
| 40 |
+
"NonCommercial" means not primarily intended for or directed towards commercial advantage
|
| 41 |
+
or monetary compensation.
|
| 42 |
+
|
| 43 |
+
"Output" means any information, data, and/or content, including but not limited to images, text,
|
| 44 |
+
text effects, audio files, and/or video files, generated through operation of the Model, or through
|
| 45 |
+
operation of any new model developed by transferring patterns from the Model.
|
| 46 |
+
|
| 47 |
+
"You" (or "Your") means you, or any other person or entity you are entering into this license on
|
| 48 |
+
behalf of, provided you have the legal authority to bind such person or entity.
|
| 49 |
+
|
| 50 |
+
2. LICENSE RIGHTS
|
| 51 |
+
|
| 52 |
+
2.1 Grant of Rights
|
| 53 |
+
|
| 54 |
+
(a) Subject to the conditions in Section 2.2 of this License, the Licensor hereby grants to
|
| 55 |
+
You a non-exclusive, non-sublicensable, revocable, royalty-free, worldwide license under
|
| 56 |
+
the relevant copyrights, patent rights, database rights, and any other intellectual property
|
| 57 |
+
rights to:
|
| 58 |
+
|
| 59 |
+
(i) make, have made, use, reproduce and Distribute the Licensed Materials;
|
| 60 |
+
|
| 61 |
+
(ii) use the Licensed Materials to create Derivative Materials; and
|
| 62 |
+
|
| 63 |
+
(iii) make, have made, use, reproduce and Distribute Derivative Materials;
|
| 64 |
+
|
| 65 |
+
for NonCommercial purposes only.
|
| 66 |
+
|
| 67 |
+
2.2 Conditions
|
| 68 |
+
|
| 69 |
+
(a) If You Distribute any of the Licensed Materials or Derivative Materials, You shall:
|
| 70 |
+
|
| 71 |
+
(i) provide a copy of this License with the Licensed Material or Derivative Materials;
|
| 72 |
+
|
| 73 |
+
(ii) in the case of Distributing Derivative Materials, provide as part of the Distribution,
|
| 74 |
+
prominent notices stating that You have modified the Licensed Materials and the
|
| 75 |
+
relevant date of such modification;
|
| 76 |
+
|
| 77 |
+
(iii) retain as part of the Distribution any existing copyright notice, attribution notice,
|
| 78 |
+
and/or any notice identifying the authors of the Licensed Materials and any
|
| 79 |
+
Derivative Materials.
|
| 80 |
+
|
| 81 |
+
(b) If You Distribute a collection of Output as a dataset generated wholly or partially using
|
| 82 |
+
the Licensed Materials and/or Derivative Materials, You shall provide a prominent notice
|
| 83 |
+
in the Distribution stating that the dataset is generated using the Licensed Materials
|
| 84 |
+
and/or Derivative Materials provided under this License.
|
| 85 |
+
|
| 86 |
+
2.3 Reservation of Rights
|
| 87 |
+
|
| 88 |
+
You shall not refer to the Licensor or use the Licensor's trademarks, trade names, and service
|
| 89 |
+
marks, for any publicity, advertising or marketing purposes, without the Licensor's prior written
|
| 90 |
+
consent.
|
| 91 |
+
|
| 92 |
+
3. DISCLAIMER
|
| 93 |
+
|
| 94 |
+
To the maximum extent permissible under applicable law, the Licensed Materials are provided
|
| 95 |
+
on an "as is" and "as available" basis without any representation or warranty of any kind
|
| 96 |
+
(whether express, implied, statutory or otherwise), including of merchantability, satisfactory
|
| 97 |
+
quality, fitness for a particular purpose, title, accuracy, correctness, absence of error, reliability,
|
| 98 |
+
timeliness, non-infringement of or compliance with any laws, regulations and/or third-party
|
| 99 |
+
rights, all of which are expressly disclaimed by the Licensor.
|
| 100 |
+
|
| 101 |
+
4. LIMITATION OF LIABILITY
|
| 102 |
+
|
| 103 |
+
To the maximum extent permissible under applicable law, the Licensor shall not be liable for
|
| 104 |
+
any claims, damages, or any other liabilities, in any way arising out of or in connection with the
|
| 105 |
+
Licensed Materials, Derivative Materials, and/or Output, whether on an action or claim in
|
| 106 |
+
contract, tort (including negligence), breach of statutory duty or otherwise, even if the Licensor
|
| 107 |
+
has been advised of the possibility of such damages.
|
| 108 |
+
|
| 109 |
+
5. TERMINATION
|
| 110 |
+
|
| 111 |
+
This License shall terminate immediately if You breach any material term and/or condition of
|
| 112 |
+
this License, or if You initiate any legal action against the Licensor alleging that the Licensed
|
| 113 |
+
Materials and/or Derivative Materials infringe any patent worldwide. Sections 3, 4 and 6 shall
|
| 114 |
+
survive the termination of this License.
|
| 115 |
+
|
| 116 |
+
6. MODIFICATION OF THIS LICENSE
|
| 117 |
+
|
| 118 |
+
This License is Copyright © 2024 National University of Singapore. Permission is granted to
|
| 119 |
+
copy, distribute, or communicate this License without modification. Nothing in this License
|
| 120 |
+
permits You to modify this License as applied to the Licensed Materials. However, You may
|
| 121 |
+
modify the text of this License and copy, distribute or communicate Your modified version and
|
| 122 |
+
apply it to other original works of authorship, provided that You do not use the name "ModelGo"
|
| 123 |
+
for your version of the license and furnish a readable notice describing Your modifications to
|
| 124 |
+
this License.
|
MANUAL.md
ADDED
|
@@ -0,0 +1,1242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dflow_2b Manual
|
| 2 |
+
|
| 3 |
+
[Model card](README.md) · [Example gallery](GALLERY.md) ·
|
| 4 |
+
[Technical report](TECHNICAL_REPORT.md) · [Release notes](RELEASES.md)
|
| 5 |
+
|
| 6 |
+
## Contents
|
| 7 |
+
|
| 8 |
+
1. [Installation](#installation)
|
| 9 |
+
2. [A first image](#a-first-image)
|
| 10 |
+
3. [Prompts](#prompts)
|
| 11 |
+
4. [JSON layouts](#json-layouts)
|
| 12 |
+
5. [Image sizes](#image-sizes)
|
| 13 |
+
6. [Sampling](#sampling)
|
| 14 |
+
7. [Guidance](#guidance)
|
| 15 |
+
8. [Self-attention gain](#self-attention-gain)
|
| 16 |
+
9. [Python API reference](#python-api-reference)
|
| 17 |
+
10. [ComfyUI node reference](#comfyui-node-reference)
|
| 18 |
+
11. [Troubleshooting](#troubleshooting)
|
| 19 |
+
|
| 20 |
+
## Installation
|
| 21 |
+
|
| 22 |
+
dflow_2b needs Python 3.12 or later, PyTorch 2.13 with CUDA, and an NVIDIA GPU
|
| 23 |
+
with bfloat16 support. Install a CUDA build of PyTorch first; the
|
| 24 |
+
[PyTorch installation selector](https://pytorch.org/get-started/locally/) gives
|
| 25 |
+
the command for your system.
|
| 26 |
+
|
| 27 |
+
The repository holds the denoiser weights, the text encoder, the `dflow` Python
|
| 28 |
+
package and the ComfyUI nodes. The autoencoder,
|
| 29 |
+
[dinac3_96](https://huggingface.co/data-archetype/dinac3_96), downloads into the
|
| 30 |
+
Hugging Face cache the first time the model is loaded.
|
| 31 |
+
|
| 32 |
+
### ComfyUI
|
| 33 |
+
|
| 34 |
+
The repository is a ComfyUI custom-node folder. Download it into
|
| 35 |
+
`custom_nodes` and install its requirements into ComfyUI's Python environment:
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
cd ComfyUI/custom_nodes
|
| 39 |
+
hf download data-archetype/dflow_2b --local-dir dflow_2b
|
| 40 |
+
pip install -r dflow_2b/requirements.txt
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
Restart ComfyUI. The nodes appear under the **DFlow** category. Start ComfyUI
|
| 44 |
+
with `--preview-method auto` for live previews.
|
| 45 |
+
|
| 46 |
+
### Python
|
| 47 |
+
|
| 48 |
+
Download the repository and install the package from it. The install is
|
| 49 |
+
editable, so Python runs the code in that folder:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
hf download data-archetype/dflow_2b --local-dir dflow_2b
|
| 53 |
+
pip install -e dflow_2b
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
`diffusers` is needed only for the optional
|
| 57 |
+
[diffusers wrapper](#diffusers-wrapper).
|
| 58 |
+
|
| 59 |
+
### Compilation
|
| 60 |
+
|
| 61 |
+
The denoiser, the text encoder and the autoencoder are compiled with
|
| 62 |
+
`torch.compile` by default. The first generation takes roughly 30 to 45 seconds
|
| 63 |
+
longer while the graphs are built.
|
| 64 |
+
|
| 65 |
+
To turn compilation off, pass `compile=False` in Python or switch
|
| 66 |
+
`compile_model` off in the DFlow Loader node. The model then starts at once and
|
| 67 |
+
each image takes longer. On an RTX 4090 a 50-step 832×1216 image takes about 10
|
| 68 |
+
seconds compiled and about 13 seconds eagerly, with a peak of about 7 GB of
|
| 69 |
+
VRAM.
|
| 70 |
+
|
| 71 |
+
## A first image
|
| 72 |
+
|
| 73 |
+
### In ComfyUI
|
| 74 |
+
|
| 75 |
+
Load `dflow_2b/comfyui/workflows/dflow_default.json` and queue it. It uses the
|
| 76 |
+
default preset. You can also drop any PNG from the [gallery](GALLERY.md) onto
|
| 77 |
+
the canvas: each one carries the workflow that made it.
|
| 78 |
+
|
| 79 |
+
The default graph has ten nodes, connected as follows:
|
| 80 |
+
|
| 81 |
+
- **DFlow Loader** outputs the model, the text encoder and the autoencoder.
|
| 82 |
+
- **DFlow Text Encode** takes the text encoder and the prompt.
|
| 83 |
+
- **DFlow Guider** takes the model and the encoded prompt.
|
| 84 |
+
- **DFlow Empty Latent** sets the image size.
|
| 85 |
+
- **DFlow Sampler** feeds **DFlow Time Schedule**, which also takes the latent
|
| 86 |
+
and outputs the sigmas and the sampler.
|
| 87 |
+
- **RandomNoise** sets the seed.
|
| 88 |
+
- **SamplerCustomAdvanced** takes the noise, the guider, the sampler, the
|
| 89 |
+
sigmas and the latent.
|
| 90 |
+
- **VAEDecode** takes the result and the loader's autoencoder, and
|
| 91 |
+
**SaveImage** stores the image.
|
| 92 |
+
|
| 93 |
+
RandomNoise, SamplerCustomAdvanced, VAEDecode and SaveImage are ComfyUI's own
|
| 94 |
+
nodes. The [node reference](#comfyui-node-reference) lists every input.
|
| 95 |
+
|
| 96 |
+
### In Python
|
| 97 |
+
|
| 98 |
+
```python
|
| 99 |
+
from dflow.inference import GenerationSettings
|
| 100 |
+
from dflow.pipeline import DFlowPipeline
|
| 101 |
+
|
| 102 |
+
pipe = DFlowPipeline.from_pretrained("dflow_2b")
|
| 103 |
+
settings = GenerationSettings(width=832, height=1216, seed=7)
|
| 104 |
+
image = pipe("A lighthouse on a cliff at dusk.", settings).images[0]
|
| 105 |
+
image.save("lighthouse.png", pnginfo=pipe.png_info(image))
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
`"dflow_2b"` is the folder downloaded during installation.
|
| 109 |
+
`GenerationSettings()` with no arguments is the default preset, and the seed
|
| 110 |
+
fixes every random draw of the call.
|
| 111 |
+
|
| 112 |
+
## Prompts
|
| 113 |
+
|
| 114 |
+
### Plain captions
|
| 115 |
+
|
| 116 |
+
Natural descriptive captions work best. Write what a careful caption of the
|
| 117 |
+
finished image would say: the subject, what it is doing, the setting, the light
|
| 118 |
+
and the medium (a photograph, an oil painting, a movie still). Full sentences
|
| 119 |
+
work better than lists of keywords, and a long, detailed prompt is fine. The
|
| 120 |
+
limit is 6,144 tokens.
|
| 121 |
+
|
| 122 |
+
### Quoted text for lettering
|
| 123 |
+
|
| 124 |
+
To put words in the image, write them in double quotes inside the caption:
|
| 125 |
+
|
| 126 |
+
```text
|
| 127 |
+
A neon sign in a rainy street that reads "OPEN LATE".
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
Everything inside double quotes is encoded one character at a time, so the
|
| 131 |
+
model sees the exact spelling. Use double quotes only for text that should be
|
| 132 |
+
visible in the image. To place text precisely, use a
|
| 133 |
+
[JSON layout](#json-layouts).
|
| 134 |
+
|
| 135 |
+
### Prompt emphasis
|
| 136 |
+
|
| 137 |
+
A phrase can be given more or less weight with the markup `(phrase:weight)`:
|
| 138 |
+
|
| 139 |
+
```text
|
| 140 |
+
A portrait of a woman in a (red:1.4) coat, (blurred background:0.7).
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
The weight changes how much attention the rest of the model pays to the tokens
|
| 144 |
+
of that phrase. A weight of 1 is neutral, a weight above 1 strengthens the
|
| 145 |
+
phrase and a weight between 0 and 1 weakens it.
|
| 146 |
+
|
| 147 |
+
The markup follows a few rules:
|
| 148 |
+
|
| 149 |
+
- The weight is the number after the last colon of a parenthesised group. The
|
| 150 |
+
phrase itself may contain colons.
|
| 151 |
+
- Groups can be nested. An inner weight replaces the outer one for its own
|
| 152 |
+
words.
|
| 153 |
+
- Parentheses without a numeric weight are ordinary text, and `\(` and `\)`
|
| 154 |
+
always are.
|
| 155 |
+
|
| 156 |
+
Two settings control how a weight is applied. Let \\(w\\) be the weight and
|
| 157 |
+
\\(\kappa\\) the strength.
|
| 158 |
+
|
| 159 |
+
The **mapping** turns a positive weight into a bias added to the attention
|
| 160 |
+
logits of the weighted tokens. `linear` adds \\(2\kappa(w-1)\\). `log` adds
|
| 161 |
+
\\(\kappa \ln w\\), which at strength 1 multiplies the attention those tokens
|
| 162 |
+
receive by exactly \\(w\\). The linear mapping is the stronger of the two: at
|
| 163 |
+
strength 1, a weight of 2 multiplies the attention by about 7.
|
| 164 |
+
|
| 165 |
+
The **strength** scales every bias. A strength of 0 turns emphasis off without
|
| 166 |
+
removing the markup.
|
| 167 |
+
|
| 168 |
+
A weight of 0 or below works differently. It scales the content the tokens
|
| 169 |
+
contribute by \\(1 + \kappa(w-1)\\). At strength 1 a weight of 0 mutes the
|
| 170 |
+
phrase and a weight of −1 subtracts it.
|
| 171 |
+
|
| 172 |
+
The weights act in every attention layer of the denoiser. The **encoder**
|
| 173 |
+
switch applies them inside the text encoder as well.
|
| 174 |
+
|
| 175 |
+
| Setting | Default | Python (`EmphasisSettings`) | ComfyUI (DFlow Text Encode) |
|
| 176 |
+
| --- | --- | --- | --- |
|
| 177 |
+
| Emphasis on | yes | `emphasis=EmphasisSettings(...)`, or `None` to read prompts verbatim | `emphasis` |
|
| 178 |
+
| Mapping | `linear` | `mapping` | `emphasis_mapping` |
|
| 179 |
+
| Strength | 1.0 | `strength` | `emphasis_strength` |
|
| 180 |
+
| Encoder | on | `encoder` | `emphasis_encoder` |
|
| 181 |
+
|
| 182 |
+
Emphasis applies to plain-text prompts. Negative prompts and JSON layouts are
|
| 183 |
+
encoded exactly as written: in a layout, parentheses and colons in captions or
|
| 184 |
+
text stay literal and carry no weight.
|
| 185 |
+
|
| 186 |
+
### Negative prompts
|
| 187 |
+
|
| 188 |
+
A negative prompt is read by classifier-free guidance (CFG) and by the
|
| 189 |
+
contrastive modes of path-drop guidance, both described under
|
| 190 |
+
[Guidance](#guidance). With those modes, an empty negative prompt selects the
|
| 191 |
+
model's learned null text. The default guidance conditions its reference
|
| 192 |
+
prediction on the prompt itself and ignores the negative prompt.
|
| 193 |
+
|
| 194 |
+
## JSON layouts
|
| 195 |
+
|
| 196 |
+
A layout prompt describes an image as a canvas with a list of boxes. It gives
|
| 197 |
+
control over where things are and over the exact text that appears. Layouts
|
| 198 |
+
suit posters, covers, title cards and other designed images.
|
| 199 |
+
|
| 200 |
+
### The stored format
|
| 201 |
+
|
| 202 |
+
A layout is a JSON object with exactly three keys: `summary`, `frame` and
|
| 203 |
+
`items`.
|
| 204 |
+
|
| 205 |
+
**`summary`** describes the image as a whole.
|
| 206 |
+
|
| 207 |
+
| Field | Type | Meaning |
|
| 208 |
+
| --- | --- | --- |
|
| 209 |
+
| `meta` | list of strings | Tags for the kind of image, such as `concert_poster` |
|
| 210 |
+
| `canvas` | string | The canvas type; `single` in the examples here |
|
| 211 |
+
| `caption` | string | A caption of the whole image |
|
| 212 |
+
|
| 213 |
+
**`frame`** describes the canvas: the overall arrangement, style and colours.
|
| 214 |
+
|
| 215 |
+
| Field | Type | Meaning |
|
| 216 |
+
| --- | --- | --- |
|
| 217 |
+
| `caption` | string | How the image is composed |
|
| 218 |
+
| `tags` | list of strings | Style and composition tags |
|
| 219 |
+
| `palette` | list of strings | Main colours as hex codes |
|
| 220 |
+
|
| 221 |
+
**`items`** is a list of boxes, one per element.
|
| 222 |
+
|
| 223 |
+
| Field | Type | Meaning |
|
| 224 |
+
| --- | --- | --- |
|
| 225 |
+
| `label` | string | `character`, `object` or `text` |
|
| 226 |
+
| `box_2d` | four integers | The box as `[y0, x0, y1, x1]` on a 0 to 1000 scale |
|
| 227 |
+
| `text` | string | The exact string to render; required for `text` items |
|
| 228 |
+
| `caption` | string | A description of this element |
|
| 229 |
+
| `tags` | list of strings | Tags for this element |
|
| 230 |
+
| `palette` | list of strings | Its colours as hex codes |
|
| 231 |
+
|
| 232 |
+
Boxes are measured from the top-left corner of the image. `y0` and `y1` are the
|
| 233 |
+
top and bottom edges as thousandths of the image height, and `x0` and `x1` are
|
| 234 |
+
the left and right edges as thousandths of the width. The vertical coordinate
|
| 235 |
+
comes first.
|
| 236 |
+
|
| 237 |
+
### Optional fields
|
| 238 |
+
|
| 239 |
+
The required fields are the three top-level keys and, for each item, `label`
|
| 240 |
+
and `box_2d`, plus `text` on a text item. Every other field can be left out:
|
| 241 |
+
training dropped the optional fields at random. Captions, tags and palettes
|
| 242 |
+
give the model more to work with, and a layout with labels and boxes alone
|
| 243 |
+
still works.
|
| 244 |
+
|
| 245 |
+
Unknown keys raise an error.
|
| 246 |
+
|
| 247 |
+
### Compiling a layout to a size
|
| 248 |
+
|
| 249 |
+
Before encoding, a layout is compiled for one image size: the frame becomes a
|
| 250 |
+
first item, labelled `panel`, that covers the whole canvas, and every box is
|
| 251 |
+
converted from the 0 to 1000 scale to integer pixels measured from the centre
|
| 252 |
+
of the image. For an image \\(Y\\) pixels high, the top edge \\(y_0\\) and bottom
|
| 253 |
+
edge \\(y_1\\) of a box become
|
| 254 |
+
|
| 255 |
+
$$
|
| 256 |
+
y_0' = \left\lfloor \frac{y_0\,Y}{1000} \right\rfloor - \left\lfloor \frac{Y}{2} \right\rfloor,
|
| 257 |
+
\qquad
|
| 258 |
+
y_1' = \left\lceil \frac{y_1\,Y}{1000} \right\rceil - \left\lfloor \frac{Y}{2} \right\rfloor,
|
| 259 |
+
$$
|
| 260 |
+
|
| 261 |
+
and the left and right edges are computed the same way from the width. At
|
| 262 |
+
832×1216 the panel box is `[-608, -416, 608, 416]`. The result is one line of
|
| 263 |
+
JSON with two fields naming the convention (`abs_centralized`, `yxyx`), in the
|
| 264 |
+
format of the MOSS-Image layout prompts.
|
| 265 |
+
|
| 266 |
+
The compiled boxes are in pixels, so a compiled layout belongs to one image
|
| 267 |
+
size: the same stored layout compiles to different numbers at 832×1216 and at
|
| 268 |
+
1216×832. Using a compiled layout at another size raises an error.
|
| 269 |
+
|
| 270 |
+
Keep layouts in the stored format, which is independent of size, and let the
|
| 271 |
+
code compile them:
|
| 272 |
+
|
| 273 |
+
- In ComfyUI, the **DFlow Layout Encode** node takes the stored JSON together
|
| 274 |
+
with `width` and `height`. Set them to the size of the latent you sample. The
|
| 275 |
+
guider stops with a message when they differ.
|
| 276 |
+
- In Python, pass the stored JSON as the prompt. The pipeline compiles it at
|
| 277 |
+
the size in `GenerationSettings`. The function that does this is
|
| 278 |
+
`dflow.inference.resolve_prompt`, and `dflow.layout.compile_layout` returns
|
| 279 |
+
the compiled text if you want to inspect it.
|
| 280 |
+
|
| 281 |
+
### Worked example: a jazz festival poster
|
| 282 |
+
|
| 283 |
+
This layout describes an 832×1216 poster with a sun, a saxophonist and two
|
| 284 |
+
lines of text:
|
| 285 |
+
|
| 286 |
+
```json
|
| 287 |
+
{"summary": {
|
| 288 |
+
"meta": ["concert_poster", "flat_illustration", "mid_century_modern"],
|
| 289 |
+
"canvas": "single",
|
| 290 |
+
"caption": "A mid-century style jazz festival poster shows a saxophonist in silhouette against a large orange sun on a deep teal background. The title \"BLUE HARBOR JAZZ\" runs across the top in cream capitals and the line \"JULY 12 – 14, 1996\" sits at the bottom."},
|
| 291 |
+
"frame": {
|
| 292 |
+
"caption": "The saxophonist stands in the centre, cut off at the knees, with the sun behind his shoulders. The title fills the top fifth and the date line sits in a band along the bottom edge. Flat colour shapes with a light paper grain.",
|
| 293 |
+
"tags": ["flat_color", "centered_composition", "paper_grain"],
|
| 294 |
+
"palette": ["#0F4C5C", "#F28C28", "#F5E9D0", "#1B1B1B"]},
|
| 295 |
+
"items": [
|
| 296 |
+
{"label": "object",
|
| 297 |
+
"caption": "A large flat orange circle, the sun, behind the musician.",
|
| 298 |
+
"tags": ["sun", "circle"],
|
| 299 |
+
"palette": ["#F28C28"],
|
| 300 |
+
"box_2d": [230, 170, 720, 830]},
|
| 301 |
+
{"label": "character",
|
| 302 |
+
"caption": "A black silhouette of a man in a hat playing a tenor saxophone, facing right, leaning back slightly.",
|
| 303 |
+
"tags": ["saxophonist", "silhouette", "hat"],
|
| 304 |
+
"palette": ["#1B1B1B"],
|
| 305 |
+
"box_2d": [260, 250, 880, 760]},
|
| 306 |
+
{"label": "text",
|
| 307 |
+
"caption": "The title \"BLUE HARBOR JAZZ\" in bold condensed cream capitals on one line.",
|
| 308 |
+
"text": "BLUE HARBOR JAZZ",
|
| 309 |
+
"tags": ["title", "condensed_sans", "uppercase"],
|
| 310 |
+
"palette": ["#F5E9D0"],
|
| 311 |
+
"box_2d": [60, 70, 180, 930]},
|
| 312 |
+
{"label": "text",
|
| 313 |
+
"caption": "The date line \"JULY 12 – 14, 1996\" in small spaced cream capitals.",
|
| 314 |
+
"text": "JULY 12 – 14, 1996",
|
| 315 |
+
"tags": ["date", "small_caps"],
|
| 316 |
+
"palette": ["#F5E9D0"],
|
| 317 |
+
"box_2d": [905, 300, 950, 700]}]}
|
| 318 |
+
```
|
| 319 |
+
|
| 320 |
+
Reading it from the top:
|
| 321 |
+
|
| 322 |
+
- The summary caption describes the finished poster in one paragraph, as a
|
| 323 |
+
plain prompt would, and quotes both lines of text.
|
| 324 |
+
- The frame caption says how the canvas is arranged, and the palette lists the
|
| 325 |
+
four colours of the design.
|
| 326 |
+
- The sun comes first in `items` and the saxophonist second. Their boxes
|
| 327 |
+
overlap, which is how the layout says that the figure stands in front of the
|
| 328 |
+
sun.
|
| 329 |
+
- The title box `[60, 70, 180, 930]` spans from 6% to 18% of the height and
|
| 330 |
+
from 7% to 93% of the width: a wide band near the top. The `text` field holds
|
| 331 |
+
the string to render and the caption describes the lettering.
|
| 332 |
+
|
| 333 |
+
The same layout ships as the workflow
|
| 334 |
+
`comfyui/workflows/dflow_layout_poster.json`. In Python:
|
| 335 |
+
|
| 336 |
+
```python
|
| 337 |
+
from pathlib import Path
|
| 338 |
+
|
| 339 |
+
from dflow.inference import GenerationSettings
|
| 340 |
+
from dflow.pipeline import DFlowPipeline
|
| 341 |
+
|
| 342 |
+
pipe = DFlowPipeline.from_pretrained("dflow_2b")
|
| 343 |
+
layout = Path("jazz_poster.json").read_text(encoding="utf-8")
|
| 344 |
+
settings = GenerationSettings(width=832, height=1216, seed=42)
|
| 345 |
+
image = pipe(layout, settings).images[0]
|
| 346 |
+
```
|
| 347 |
+
|
| 348 |
+
At 832×1216 the sun's box `[230, 170, 720, 830]` compiles to
|
| 349 |
+
`[-329, -275, 268, 275]`: pixels from the image centre, top edge first.
|
| 350 |
+
|
| 351 |
+
### Tips
|
| 352 |
+
|
| 353 |
+
- Write the exact characters in `text`, including capitals, punctuation and
|
| 354 |
+
spaces. The model renders that string; the item's caption describes its style.
|
| 355 |
+
- Keep the number of items small. A handful of well-described boxes works
|
| 356 |
+
better than many small ones.
|
| 357 |
+
- Boxes may overlap or contain one another.
|
| 358 |
+
- Give each box the shape of its content. A single line of text wants a wide,
|
| 359 |
+
short box.
|
| 360 |
+
- Small text and long passages often come out wrong in this release, so prefer
|
| 361 |
+
short strings in generous boxes.
|
| 362 |
+
|
| 363 |
+
## Image sizes
|
| 364 |
+
|
| 365 |
+
Width and height must be multiples of 16, because the autoencoder maps each
|
| 366 |
+
16×16 block of pixels to one latent cell.
|
| 367 |
+
|
| 368 |
+
The model works best at about one megapixel, the area it was trained on, in
|
| 369 |
+
portrait, square or landscape. The default is 832×1216.
|
| 370 |
+
|
| 371 |
+
| Shape | Sizes of about 1 MP |
|
| 372 |
+
| --- | --- |
|
| 373 |
+
| Portrait | 832×1216 |
|
| 374 |
+
| Square | 1024×1024 |
|
| 375 |
+
| Landscape | 1216×832 |
|
| 376 |
+
|
| 377 |
+
Larger images work, for example 1536×832, 1216×1088 or 1024×1536. Composition
|
| 378 |
+
and anatomy become less reliable as the area grows, and the
|
| 379 |
+
[self-attention gain](#self-attention-gain) should move towards 0. Shapes far
|
| 380 |
+
from the trained aspect ratios are also less reliable.
|
| 381 |
+
|
| 382 |
+
## Sampling
|
| 383 |
+
|
| 384 |
+
Sampling starts from noise and moves to the image in a number of solver steps.
|
| 385 |
+
Time runs from \\(t = 1\\), pure noise, to \\(t = 0\\), the finished image. Three
|
| 386 |
+
choices define a sampling run: the solver, the schedule of times it visits, and
|
| 387 |
+
a shift applied to that schedule.
|
| 388 |
+
|
| 389 |
+
### Solvers
|
| 390 |
+
|
| 391 |
+
A solver is the numerical method that takes each step. Some are deterministic,
|
| 392 |
+
and some are stochastic: they add fresh noise at each step. For a stochastic
|
| 393 |
+
solver the noise scale multiplies that noise; deterministic solvers ignore it.
|
| 394 |
+
|
| 395 |
+
| Name | Method | Stochastic | Noise scale |
|
| 396 |
+
| --- | --- | --- | --- |
|
| 397 |
+
| `er_sde` (default) | Extended reverse-time SDE, three-stage | yes | 1.0; 0 makes it deterministic |
|
| 398 |
+
| `er_sde_bt` | The same with Brownian-tree noise, so runs with different step counts follow one noise path | yes | 1.0 |
|
| 399 |
+
| `euler` | First-order ODE | no | ignored |
|
| 400 |
+
| `euler_maruyama` | First-order reverse SDE | yes | 1.0 is the SDE's own noise level |
|
| 401 |
+
| `dpmpp_2m` | DPM++ 2M, second-order multistep ODE | no | ignored |
|
| 402 |
+
| `dpmpp_2m_sde` | DPM++ 2M SDE | yes | Acts as eta; use 0.5 |
|
| 403 |
+
| `abm2` | Adams–Bashforth–Moulton predictor-corrector | no | ignored |
|
| 404 |
+
|
| 405 |
+
`abm2` evaluates the model twice per step, so it takes about twice as long per
|
| 406 |
+
step as the others.
|
| 407 |
+
|
| 408 |
+
### Schedules
|
| 409 |
+
|
| 410 |
+
The schedule sets where the solver's time points lie between noise and image,
|
| 411 |
+
before the shift.
|
| 412 |
+
|
| 413 |
+
| Name | Spacing |
|
| 414 |
+
| --- | --- |
|
| 415 |
+
| `beta_1_25` (default) | Quantiles of a Beta(1.25, 1.25) distribution: slightly denser in the middle |
|
| 416 |
+
| `beta_0_6` | Quantiles of Beta(0.6, 0.6): denser at both ends |
|
| 417 |
+
| `linear` | Evenly spaced |
|
| 418 |
+
| `custom_beta` | Quantiles of a Beta distribution you specify by `beta_mean` in (0, 1) and `beta_concentration` above 0 |
|
| 419 |
+
|
| 420 |
+
For `custom_beta` the two Beta parameters are `beta_mean × beta_concentration`
|
| 421 |
+
and `(1 − beta_mean) × beta_concentration`. A mean above 0.5 puts more steps
|
| 422 |
+
near the noisy end. A concentration of 2 at mean 0.5 is the linear schedule;
|
| 423 |
+
higher values gather steps around the mean and lower values push them to the
|
| 424 |
+
ends.
|
| 425 |
+
|
| 426 |
+
### Steps
|
| 427 |
+
|
| 428 |
+
The default is 50 steps, which the gallery uses. With the default guidance each
|
| 429 |
+
step calls the denoiser twice, once in full and once with its middle layers
|
| 430 |
+
skipped.
|
| 431 |
+
|
| 432 |
+
### Resolution-dependent shift
|
| 433 |
+
|
| 434 |
+
A larger image needs more noise to hide the same amount of structure. The model
|
| 435 |
+
was trained with a timestep shift that grows with the image area, and the
|
| 436 |
+
sampler applies the same shift by default.
|
| 437 |
+
|
| 438 |
+
The shift \\(s\\) is expressed in log signal-to-noise ratio. For an image of
|
| 439 |
+
width \\(W\\) and height \\(H\\) in pixels,
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
s = \min\!\left(0,\; b - \ln\frac{W H}{256^2}\right), \qquad b = -0.25 .
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
Each schedule time \\(t\\) strictly between 0 and 1 is then moved to
|
| 446 |
+
|
| 447 |
+
$$
|
| 448 |
+
t' = \sigma\!\left(\operatorname{logit}(t) - \tfrac{s}{2}\right),
|
| 449 |
+
$$
|
| 450 |
+
|
| 451 |
+
where \\(\sigma\\) is the logistic function. A negative shift moves the time
|
| 452 |
+
points towards the noisy end.
|
| 453 |
+
|
| 454 |
+
| Size | Area | Shift \\(s\\) |
|
| 455 |
+
| --- | --- | --- |
|
| 456 |
+
| 832×1216 | 1.01 MP | −2.99 |
|
| 457 |
+
| 1024×1024 | 1.05 MP | −3.02 |
|
| 458 |
+
| 1536×832 | 1.28 MP | −3.22 |
|
| 459 |
+
| 1024×1536 | 1.57 MP | −3.43 |
|
| 460 |
+
|
| 461 |
+
Two settings control the shift. `base_log_snr_shift` is \\(b\\), default −0.25.
|
| 462 |
+
`resolution_shift` adds the size term and is on by default; with it off, the
|
| 463 |
+
shift is \\(b\\) alone at every size. The defaults match how the model was
|
| 464 |
+
trained.
|
| 465 |
+
|
| 466 |
+
## Guidance
|
| 467 |
+
|
| 468 |
+
Guidance sharpens an image and strengthens its adherence to the prompt by
|
| 469 |
+
comparing two predictions at each step and pushing the result away from the
|
| 470 |
+
weaker one.
|
| 471 |
+
|
| 472 |
+
### Path-drop guidance
|
| 473 |
+
|
| 474 |
+
dflow_2b was trained so that it can also run with its 18 middle layers skipped,
|
| 475 |
+
which gives a cheaper and weaker prediction from the same weights. Path-drop
|
| 476 |
+
guidance (PDG) uses that weak prediction as the reference and moves the result
|
| 477 |
+
away from it, towards the full prediction, by a scale. The
|
| 478 |
+
[technical report](TECHNICAL_REPORT.md#sprint-and-path-drop-guidance) explains
|
| 479 |
+
why this works.
|
| 480 |
+
|
| 481 |
+
With the full prediction \\(v_{\mathrm{full}}\\), the weak one
|
| 482 |
+
\\(v_{\mathrm{weak}}\\) and the scale \\(w\\), the guided prediction is
|
| 483 |
+
|
| 484 |
+
$$
|
| 485 |
+
v = v_{\mathrm{weak}} + w\,(v_{\mathrm{full}} - v_{\mathrm{weak}}) .
|
| 486 |
+
$$
|
| 487 |
+
|
| 488 |
+
A scale of 1 is no guidance, and the weak pass is then skipped. The default is
|
| 489 |
+
2.5.
|
| 490 |
+
|
| 491 |
+
#### Suffix caption bias
|
| 492 |
+
|
| 493 |
+
By default the weak pass reads the prompt less in its last six blocks: a bias
|
| 494 |
+
of −4 is added to their attention on the prompt's tokens, on every step. This
|
| 495 |
+
strengthens prompt following. Values closer to 0 weaken the effect and 0 turns
|
| 496 |
+
it off; move towards −2 if colours or contrast look too strong. Below about −8
|
| 497 |
+
there is almost no further change. It is `PdgGuidance(suffix_caption_bias=...)`
|
| 498 |
+
in Python and `pdg_suffix_caption_bias` on the DFlow Guider node. The
|
| 499 |
+
[technical report](TECHNICAL_REPORT.md#suffix-caption-bias) gives the details.
|
| 500 |
+
|
| 501 |
+
### Classifier-free guidance
|
| 502 |
+
|
| 503 |
+
Classifier-free guidance (CFG) is the familiar alternative. Its reference is
|
| 504 |
+
the full model conditioned on the negative prompt, or on the learned null text
|
| 505 |
+
when the negative prompt is empty. The formula is the same, with that reference
|
| 506 |
+
as \\(v_{\mathrm{weak}}\\). CFG is off by default. It can be used alone or
|
| 507 |
+
combined with PDG through the modes below. With the plain PDG modes, CFG and
|
| 508 |
+
PDG cannot share steps: give them disjoint step windows, or use a mode that
|
| 509 |
+
includes CFG.
|
| 510 |
+
|
| 511 |
+
### Modes
|
| 512 |
+
|
| 513 |
+
The PDG mode decides what the reference is at each step. "Negative text" means
|
| 514 |
+
the negative prompt, or the learned null text when it is empty.
|
| 515 |
+
|
| 516 |
+
| Mode | Reference |
|
| 517 |
+
| --- | --- |
|
| 518 |
+
| `full` (default) | Middle skipped, conditioned on the prompt (read with the suffix caption bias) |
|
| 519 |
+
| `full_contrastive` | Middle skipped, conditioned on the negative text |
|
| 520 |
+
| `three_quarter` | One image token of each 2×2 group goes through the middle; conditioned on the prompt. Width and height must be multiples of 32 |
|
| 521 |
+
| `alternate_contrastive_positive` | `full_contrastive` on even steps, `full` on odd steps |
|
| 522 |
+
| `alternate_pdg_first`, `alternate_cfg_first` | Contrastive PDG and CFG on alternate steps, starting with the one named |
|
| 523 |
+
| `alternate_positive_pdg_first`, `alternate_positive_cfg_first` | The same with prompt-conditioned PDG |
|
| 524 |
+
| `combined_cfg_pdg` | CFG and contrastive PDG on every step, their two corrections averaged |
|
| 525 |
+
| `pdg_with_alternating_cfg` | Contrastive PDG on every step, with CFG averaged in on odd steps |
|
| 526 |
+
| `cfg_to_pdg` | CFG before the PDG step window, prompt-conditioned PDG inside it |
|
| 527 |
+
|
| 528 |
+
Steps are counted from 0. The modes that involve CFG need a CFG scale even when
|
| 529 |
+
plain CFG is switched off.
|
| 530 |
+
|
| 531 |
+
In the two averaging modes the scales are extra strengths added on top of the
|
| 532 |
+
full prediction, so a PDG or CFG value of 0 there means no contribution from
|
| 533 |
+
that side.
|
| 534 |
+
|
| 535 |
+
### Scale curves
|
| 536 |
+
|
| 537 |
+
The PDG scale can be constant or vary along the trajectory.
|
| 538 |
+
|
| 539 |
+
| Curve | Behaviour | Parameters and defaults |
|
| 540 |
+
| --- | --- | --- |
|
| 541 |
+
| Constant (default) | One scale at every step | scale 2.5 |
|
| 542 |
+
| Ramp | Starts at one scale at the noisy end, moves linearly to another over the first part of the schedule, then holds | start 4.5, end 2.5, length 0.3 |
|
| 543 |
+
| Endpoint curve | Goes from a scale at the first step to a scale at the last, along a chosen shape | noisy scale 2.0, clean scale 2.5 |
|
| 544 |
+
| Bezier | 1 plus a multiplier times a fixed fitted curve over time | multiplier 3.0 |
|
| 545 |
+
|
| 546 |
+
The ramp's length is a fraction of the schedule: 0.3 with 50 steps means the
|
| 547 |
+
scale reaches its end value at step 15.
|
| 548 |
+
|
| 549 |
+
An endpoint curve has one of four shapes:
|
| 550 |
+
|
| 551 |
+
| Shape | Interpolation between the two scales |
|
| 552 |
+
| --- | --- |
|
| 553 |
+
| `linear` | Linear in the step index |
|
| 554 |
+
| `power` | (step / steps) raised to `power`, default 3: stays near the noisy scale for longer |
|
| 555 |
+
| `s_curve` | A logistic curve with its midpoint at `s_curve_knee` (default 0.5) and slope `s_curve_sharpness` (default 8) |
|
| 556 |
+
| `linear_logsnr` | Linear in the log signal-to-noise ratio of each step |
|
| 557 |
+
|
| 558 |
+
The ramp cannot be combined with the `cfg_to_pdg` mode, which switches on the
|
| 559 |
+
step window.
|
| 560 |
+
|
| 561 |
+
### Step windows
|
| 562 |
+
|
| 563 |
+
PDG and CFG each have a step window: a first and a last step, both inclusive,
|
| 564 |
+
outside which that guidance is off. The default window covers every step. In
|
| 565 |
+
ComfyUI a stop step of −1 means the last step.
|
| 566 |
+
|
| 567 |
+
### Projected guidance (APG)
|
| 568 |
+
|
| 569 |
+
High guidance scales raise contrast and saturation. Projected guidance reduces
|
| 570 |
+
this by splitting the guidance correction into a part parallel to the full
|
| 571 |
+
prediction of the clean image and a part orthogonal to it, and keeping only a
|
| 572 |
+
fraction of the parallel part. That fraction is `parallel_weight`: 1 is plain
|
| 573 |
+
guidance and 0 removes the parallel part.
|
| 574 |
+
|
| 575 |
+
The projection has two forms. `global` projects each image as a whole.
|
| 576 |
+
`per_band` splits the latent into five spatial frequency bands, from the mean
|
| 577 |
+
colour (band 0) and the coarsest structure (band 1) up to the finest detail
|
| 578 |
+
(band 4), and projects each band from `first_band` upwards, leaving the lower
|
| 579 |
+
bands unprojected.
|
| 580 |
+
|
| 581 |
+
Projected guidance needs PDG or CFG to be on. It cannot be combined with
|
| 582 |
+
guidance rescale or with the two averaging modes.
|
| 583 |
+
|
| 584 |
+
### Guidance rescale
|
| 585 |
+
|
| 586 |
+
Guidance rescale is a simpler remedy for the same problem. It pulls the
|
| 587 |
+
magnitude of the guided prediction back towards that of the full prediction. A
|
| 588 |
+
value of 0 is off and 1 matches the magnitude fully.
|
| 589 |
+
|
| 590 |
+
### Sparse middle steps
|
| 591 |
+
|
| 592 |
+
This is a speed option. On the chosen steps the full pass sends only one image
|
| 593 |
+
token of each 2×2 group through the middle layers, a configuration the model
|
| 594 |
+
was trained on. `percent` is the share of steps that run this way, and the
|
| 595 |
+
schedule is `prefix` for the first steps of the run or `cyclic` to spread them
|
| 596 |
+
evenly. The default is 0, which is off. Width and height must be multiples of
|
| 597 |
+
32.
|
| 598 |
+
|
| 599 |
+
### Defaults
|
| 600 |
+
|
| 601 |
+
| Setting | Default |
|
| 602 |
+
| --- | --- |
|
| 603 |
+
| PDG | on, mode `full`, constant scale 2.5, all steps, suffix caption bias −4 |
|
| 604 |
+
| CFG | off |
|
| 605 |
+
| Self-attention gain | −0.03 on the full pass, 0 on the guidance pass |
|
| 606 |
+
| Projected guidance | off |
|
| 607 |
+
| Guidance rescale | 0 |
|
| 608 |
+
| Sparse middle steps | 0% |
|
| 609 |
+
| Negative prompt | empty |
|
| 610 |
+
|
| 611 |
+
### Recipes
|
| 612 |
+
|
| 613 |
+
Each recipe changes one thing from the defaults. The Python snippets build a
|
| 614 |
+
`GuidanceSettings` object, which goes into `GenerationSettings(guidance=...)`.
|
| 615 |
+
They use these imports:
|
| 616 |
+
|
| 617 |
+
```python
|
| 618 |
+
from dflow.guidance import (
|
| 619 |
+
BezierPdgCurve,
|
| 620 |
+
CfgGuidance,
|
| 621 |
+
ConstantPdgScale,
|
| 622 |
+
EndpointCurveKind,
|
| 623 |
+
EndpointPdgCurve,
|
| 624 |
+
GuidanceSettings,
|
| 625 |
+
PdgGuidance,
|
| 626 |
+
PdgMode,
|
| 627 |
+
ProjectedGuidance,
|
| 628 |
+
ProjectionMode,
|
| 629 |
+
RampPdgScale,
|
| 630 |
+
SparseMiddleSteps,
|
| 631 |
+
SparseStepSchedule,
|
| 632 |
+
StepWindow,
|
| 633 |
+
)
|
| 634 |
+
```
|
| 635 |
+
|
| 636 |
+
In ComfyUI, the mode, the constant scale, the step windows, CFG and the
|
| 637 |
+
self-attention gain are on the **DFlow Guider** node. Curves, projected
|
| 638 |
+
guidance, rescale and sparse steps are on **DFlow Guider Advanced**, which
|
| 639 |
+
takes the guider as input.
|
| 640 |
+
|
| 641 |
+
**A different PDG scale.** Lower values are softer, higher values add contrast.
|
| 642 |
+
|
| 643 |
+
```python
|
| 644 |
+
GuidanceSettings(pdg=PdgGuidance(scale=ConstantPdgScale(2.0)))
|
| 645 |
+
```
|
| 646 |
+
|
| 647 |
+
**Contrastive PDG with a negative prompt.** The negative prompt goes in
|
| 648 |
+
`GenerationSettings(negative_prompt=...)`, or into a second DFlow Text Encode
|
| 649 |
+
node connected to the guider's `negative` input. A lower scale suits this mode.
|
| 650 |
+
|
| 651 |
+
```python
|
| 652 |
+
GuidanceSettings(
|
| 653 |
+
pdg=PdgGuidance(mode=PdgMode.FULL_CONTRASTIVE, scale=ConstantPdgScale(1.75))
|
| 654 |
+
)
|
| 655 |
+
```
|
| 656 |
+
|
| 657 |
+
**A ramp from 4.5 to 2.5 over the first 30% of the schedule.**
|
| 658 |
+
|
| 659 |
+
```python
|
| 660 |
+
GuidanceSettings(pdg=PdgGuidance(scale=RampPdgScale(4.5, 2.5, 0.3)))
|
| 661 |
+
```
|
| 662 |
+
|
| 663 |
+
**An endpoint curve**, here an S-curve from 2.0 to 3.0.
|
| 664 |
+
|
| 665 |
+
```python
|
| 666 |
+
GuidanceSettings(
|
| 667 |
+
pdg=PdgGuidance(
|
| 668 |
+
scale=EndpointPdgCurve(
|
| 669 |
+
kind=EndpointCurveKind.S_CURVE, noisy_scale=2.0, clean_scale=3.0
|
| 670 |
+
)
|
| 671 |
+
)
|
| 672 |
+
)
|
| 673 |
+
```
|
| 674 |
+
|
| 675 |
+
**The Bezier curve.**
|
| 676 |
+
|
| 677 |
+
```python
|
| 678 |
+
GuidanceSettings(pdg=PdgGuidance(scale=BezierPdgCurve(multiplier=3.0)))
|
| 679 |
+
```
|
| 680 |
+
|
| 681 |
+
**PDG without the suffix caption bias.**
|
| 682 |
+
|
| 683 |
+
```python
|
| 684 |
+
GuidanceSettings(pdg=PdgGuidance(suffix_caption_bias=0.0))
|
| 685 |
+
```
|
| 686 |
+
|
| 687 |
+
**PDG on part of the run only**, here steps 0 to 39 of 50.
|
| 688 |
+
|
| 689 |
+
```python
|
| 690 |
+
GuidanceSettings(pdg=PdgGuidance(window=StepWindow(0, 39)))
|
| 691 |
+
```
|
| 692 |
+
|
| 693 |
+
**CFG alone.**
|
| 694 |
+
|
| 695 |
+
```python
|
| 696 |
+
GuidanceSettings(pdg=None, cfg=CfgGuidance(enabled=True, scale=4.0))
|
| 697 |
+
```
|
| 698 |
+
|
| 699 |
+
**CFG and PDG on alternate steps.** The CFG scale is set but plain CFG stays
|
| 700 |
+
off; the mode runs the CFG steps itself.
|
| 701 |
+
|
| 702 |
+
```python
|
| 703 |
+
GuidanceSettings(
|
| 704 |
+
pdg=PdgGuidance(mode=PdgMode.ALTERNATE_POSITIVE_PDG_FIRST),
|
| 705 |
+
cfg=CfgGuidance(enabled=False, scale=4.0),
|
| 706 |
+
)
|
| 707 |
+
```
|
| 708 |
+
|
| 709 |
+
**Projected guidance**, per band from the third band up with the parallel part
|
| 710 |
+
removed, at a slightly higher scale.
|
| 711 |
+
|
| 712 |
+
```python
|
| 713 |
+
GuidanceSettings(
|
| 714 |
+
pdg=PdgGuidance(scale=ConstantPdgScale(3.0)),
|
| 715 |
+
projection=ProjectedGuidance(
|
| 716 |
+
mode=ProjectionMode.PER_BAND, parallel_weight=0.0, first_band=2
|
| 717 |
+
),
|
| 718 |
+
)
|
| 719 |
+
```
|
| 720 |
+
|
| 721 |
+
**Guidance rescale.**
|
| 722 |
+
|
| 723 |
+
```python
|
| 724 |
+
GuidanceSettings(rescale=0.5)
|
| 725 |
+
```
|
| 726 |
+
|
| 727 |
+
**Sparse middle on half of the steps**, spread evenly.
|
| 728 |
+
|
| 729 |
+
```python
|
| 730 |
+
GuidanceSettings(
|
| 731 |
+
sparse_middle=SparseMiddleSteps(percent=50.0, schedule=SparseStepSchedule.CYCLIC)
|
| 732 |
+
)
|
| 733 |
+
```
|
| 734 |
+
|
| 735 |
+
## Self-attention gain
|
| 736 |
+
|
| 737 |
+
The self-attention gain is a small correction to the full pass that reduces the
|
| 738 |
+
excess contrast guidance produces. It is part of the default preset, and its
|
| 739 |
+
best value depends on the image size.
|
| 740 |
+
|
| 741 |
+
### What it does
|
| 742 |
+
|
| 743 |
+
In every image layer of the denoiser, the gain \\(g\\) multiplies the attention
|
| 744 |
+
queries by \\(e^{g}\\). A negative gain makes attention slightly more diffuse and
|
| 745 |
+
a positive one makes it sharper. The main pass uses the gain you set and the
|
| 746 |
+
guidance pass uses 0.
|
| 747 |
+
|
| 748 |
+
The guidance formula amplifies any difference between the two passes by the
|
| 749 |
+
guidance scale, so a 3% softening of attention in the main pass becomes a
|
| 750 |
+
visible reduction in contrast and in structural errors. The
|
| 751 |
+
[technical report](TECHNICAL_REPORT.md#self-attention-gain) gives the
|
| 752 |
+
derivation.
|
| 753 |
+
|
| 754 |
+
### Choosing a value
|
| 755 |
+
|
| 756 |
+
The default, −0.03, was set at the trained sizes of about one megapixel. For
|
| 757 |
+
larger images, move the gain closer to 0 as the area grows.
|
| 758 |
+
|
| 759 |
+
| Image area | Example sizes | Gain |
|
| 760 |
+
| --- | --- | --- |
|
| 761 |
+
| up to about 1.05 MP | 832×1216, 1216×832, 1024×1024 | −0.03 (default) |
|
| 762 |
+
| about 1.3 MP | 1536×832, 1216×1088 | −0.02 |
|
| 763 |
+
| about 1.6 MP | 1024×1536 | −0.015 |
|
| 764 |
+
| about 2.5 MP and above | 1280×1920 | 0 to −0.01 |
|
| 765 |
+
|
| 766 |
+
These values are roughly linear in the logarithm of the area, from −0.03 at
|
| 767 |
+
1 MP to 0 at about 2.5 MP, so sizes in between can be interpolated.
|
| 768 |
+
|
| 769 |
+
At about one megapixel, a gain closer to 0 gives oversaturation and more
|
| 770 |
+
structural defects. At larger sizes, too negative a gain gives washed-out
|
| 771 |
+
images.
|
| 772 |
+
|
| 773 |
+
In Python the gain is `GuidanceSettings(self_attention_gain=...)`. In ComfyUI
|
| 774 |
+
it is `self_attention_gain` on the DFlow Guider node. The gain of the guidance
|
| 775 |
+
pass can also be set, as `guidance_self_attention_gain`, and should stay at 0.
|
| 776 |
+
|
| 777 |
+
## Python API reference
|
| 778 |
+
|
| 779 |
+
All classes below are frozen dataclasses unless noted. Their defaults are the
|
| 780 |
+
default preset, so `GenerationSettings()` reproduces it.
|
| 781 |
+
|
| 782 |
+
### DFlowPipeline
|
| 783 |
+
|
| 784 |
+
`dflow.pipeline.DFlowPipeline` loads the model and turns prompts into images.
|
| 785 |
+
|
| 786 |
+
```python
|
| 787 |
+
DFlowPipeline.from_pretrained(
|
| 788 |
+
path_or_repository="data-archetype/dflow_2b",
|
| 789 |
+
*,
|
| 790 |
+
device="cuda",
|
| 791 |
+
compile=True,
|
| 792 |
+
revision=None,
|
| 793 |
+
cache_dir=None,
|
| 794 |
+
vae_dir=None,
|
| 795 |
+
)
|
| 796 |
+
```
|
| 797 |
+
|
| 798 |
+
| Argument | Meaning |
|
| 799 |
+
| --- | --- |
|
| 800 |
+
| `path_or_repository` | A local release folder, or a Hub repository id to download |
|
| 801 |
+
| `device` | A CUDA device |
|
| 802 |
+
| `compile` | Compile with `torch.compile`; `False` runs eagerly |
|
| 803 |
+
| `revision` | Hub revision, for a repository id |
|
| 804 |
+
| `cache_dir` | Hugging Face cache directory; `None` for the default |
|
| 805 |
+
| `vae_dir` | A local copy of `data-archetype/dinac3_96`, for offline use; `None` downloads the pinned commit |
|
| 806 |
+
|
| 807 |
+
Calling the pipeline generates images:
|
| 808 |
+
|
| 809 |
+
```python
|
| 810 |
+
pipe(
|
| 811 |
+
prompt,
|
| 812 |
+
settings=None,
|
| 813 |
+
*,
|
| 814 |
+
num_images=1,
|
| 815 |
+
output_type=OutputType.PIL,
|
| 816 |
+
image_to_image=None,
|
| 817 |
+
callback=None,
|
| 818 |
+
)
|
| 819 |
+
```
|
| 820 |
+
|
| 821 |
+
| Argument | Meaning |
|
| 822 |
+
| --- | --- |
|
| 823 |
+
| `prompt` | One prompt, or a list of prompts that all have the same number of tokens |
|
| 824 |
+
| `settings` | A `GenerationSettings`; `None` uses `pipe.default_settings` |
|
| 825 |
+
| `num_images` | Images to make from a single prompt string |
|
| 826 |
+
| `output_type` | What to return; see `OutputType` |
|
| 827 |
+
| `image_to_image` | An `ImageToImage`, to start from existing latents |
|
| 828 |
+
| `callback` | A latent callback, called after each solver step |
|
| 829 |
+
|
| 830 |
+
A prompt may be a plain caption, a stored layout or a compiled layout; a
|
| 831 |
+
compiled layout must have been compiled for the requested size. The images of
|
| 832 |
+
one call share the seed and differ because each gets its own noise.
|
| 833 |
+
|
| 834 |
+
The result is a `DFlowOutput` with three fields: `images`, a list of PIL images
|
| 835 |
+
for PIL output; `tensors`, the RGB or latent tensor for the other output types;
|
| 836 |
+
and `settings`, the settings used.
|
| 837 |
+
|
| 838 |
+
### DFlowComponents
|
| 839 |
+
|
| 840 |
+
`dflow.pipeline.DFlowComponents` holds the loaded parts and is available as
|
| 841 |
+
`pipe.components`. `DFlowComponents.from_pretrained` takes the same arguments
|
| 842 |
+
as the pipeline's.
|
| 843 |
+
|
| 844 |
+
| Field | Meaning |
|
| 845 |
+
| --- | --- |
|
| 846 |
+
| `engine` | The denoiser and text encoder. `engine.sample(prompts, settings, image_to_image=None, callback=None)` returns latents |
|
| 847 |
+
| `vae` | The autoencoder. `vae.decode(latents)` returns RGB in about [−1, 1]; `vae.encode(images)` takes RGB in [−1, 1] with sides that are multiples of 16 |
|
| 848 |
+
| `compiled` | Whether the model was compiled |
|
| 849 |
+
|
| 850 |
+
Latents are float32 tensors of shape `[B, 96, height / 16, width / 16]`.
|
| 851 |
+
|
| 852 |
+
### GenerationSettings
|
| 853 |
+
|
| 854 |
+
`dflow.inference.GenerationSettings` holds everything except the prompt that
|
| 855 |
+
defines one generation.
|
| 856 |
+
|
| 857 |
+
| Field | Default | Meaning |
|
| 858 |
+
| --- | --- | --- |
|
| 859 |
+
| `width` | 832 | Image width, a multiple of 16 |
|
| 860 |
+
| `height` | 1216 | Image height, a multiple of 16 |
|
| 861 |
+
| `seed` | 0 | Seed of every random draw, from 0 to 2⁶³ − 1 |
|
| 862 |
+
| `sampling` | `SamplingSettings()` | Solver, schedule and shift |
|
| 863 |
+
| `guidance` | `GuidanceSettings()` | Guidance and gains |
|
| 864 |
+
| `emphasis` | `EmphasisSettings()` | Prompt emphasis; `None` reads prompts verbatim |
|
| 865 |
+
| `negative_prompt` | `""` | Read only by CFG and the contrastive PDG modes; empty selects the learned null text |
|
| 866 |
+
|
| 867 |
+
The starting noise is drawn on the CPU from the seed, so a seed gives the same
|
| 868 |
+
noise on every GPU.
|
| 869 |
+
|
| 870 |
+
### SamplingSettings
|
| 871 |
+
|
| 872 |
+
`dflow.inference.SamplingSettings`:
|
| 873 |
+
|
| 874 |
+
| Field | Default | Meaning |
|
| 875 |
+
| --- | --- | --- |
|
| 876 |
+
| `solver` | `Solver.ER_SDE` | A member of `dflow.solvers.Solver` |
|
| 877 |
+
| `noise_scale` | 1.0 | Noise multiplier of stochastic solvers |
|
| 878 |
+
| `schedule` | `TimeSchedule()` | Spacing and step count |
|
| 879 |
+
| `base_log_snr_shift` | −0.25 | The size-independent part of the shift |
|
| 880 |
+
| `resolution_shift` | `True` | Add the image-size term |
|
| 881 |
+
|
| 882 |
+
`dflow.schedules.TimeSchedule` has `kind` (a `ScheduleKind`, default
|
| 883 |
+
`BETA_1_25`), `steps` (default 50), and `beta_mean` and `beta_concentration`
|
| 884 |
+
for `CUSTOM_BETA` (defaults 0.5 and 0.6).
|
| 885 |
+
|
| 886 |
+
```python
|
| 887 |
+
from dflow.inference import GenerationSettings, SamplingSettings
|
| 888 |
+
from dflow.schedules import ScheduleKind, TimeSchedule
|
| 889 |
+
from dflow.solvers import Solver
|
| 890 |
+
|
| 891 |
+
settings = GenerationSettings(
|
| 892 |
+
width=1024,
|
| 893 |
+
height=1024,
|
| 894 |
+
seed=3,
|
| 895 |
+
sampling=SamplingSettings(
|
| 896 |
+
solver=Solver.DPMPP_2M,
|
| 897 |
+
schedule=TimeSchedule(kind=ScheduleKind.LINEAR, steps=40),
|
| 898 |
+
),
|
| 899 |
+
)
|
| 900 |
+
```
|
| 901 |
+
|
| 902 |
+
### GuidanceSettings and its parts
|
| 903 |
+
|
| 904 |
+
`dflow.guidance.GuidanceSettings`:
|
| 905 |
+
|
| 906 |
+
| Field | Default | Meaning |
|
| 907 |
+
| --- | --- | --- |
|
| 908 |
+
| `pdg` | `PdgGuidance()` | Path-drop guidance; `None` turns it off |
|
| 909 |
+
| `cfg` | `CfgGuidance()` | Classifier-free guidance |
|
| 910 |
+
| `self_attention_gain` | −0.03 | Gain of the main pass, from −0.5 to 0.1 |
|
| 911 |
+
| `guidance_self_attention_gain` | 0.0 | Gain of the guidance passes |
|
| 912 |
+
| `projection` | `ProjectedGuidance()` | Projected guidance (APG) |
|
| 913 |
+
| `rescale` | 0.0 | Guidance rescale, from 0 to 1 |
|
| 914 |
+
| `sparse_middle` | `SparseMiddleSteps()` | Sparse middle steps |
|
| 915 |
+
|
| 916 |
+
The parts, all in `dflow.guidance`:
|
| 917 |
+
|
| 918 |
+
| Class | Fields and defaults |
|
| 919 |
+
| --- | --- |
|
| 920 |
+
| `PdgGuidance` | `mode=PdgMode.FULL`, `scale=ConstantPdgScale()`, `window=StepWindow()`, `suffix_caption_bias=-4.0` (from −10 to 0; 0 is off) |
|
| 921 |
+
| `CfgGuidance` | `enabled=False`, `scale=None`, `window=StepWindow()` |
|
| 922 |
+
| `StepWindow` | `start_step=0`, `stop_step=None` (the last step); both inclusive |
|
| 923 |
+
| `ConstantPdgScale` | `scale=2.5` |
|
| 924 |
+
| `RampPdgScale` | `start_scale=4.5`, `end_scale=2.5`, `length=0.3` |
|
| 925 |
+
| `EndpointPdgCurve` | `kind=EndpointCurveKind.POWER`, `noisy_scale=2.0`, `clean_scale=2.5`, `power=3.0`, `s_curve_knee=0.5`, `s_curve_sharpness=8.0` |
|
| 926 |
+
| `BezierPdgCurve` | `multiplier=3.0`, plus the control points of the curve |
|
| 927 |
+
| `ProjectedGuidance` | `mode=ProjectionMode.OFF`, `parallel_weight=1.0`, `first_band=0` |
|
| 928 |
+
| `SparseMiddleSteps` | `percent=0.0`, `schedule=SparseStepSchedule.PREFIX` |
|
| 929 |
+
|
| 930 |
+
`CfgGuidance.scale` must be set when CFG is enabled or when the PDG mode uses
|
| 931 |
+
CFG, and must be left as `None` otherwise. Inconsistent settings raise a
|
| 932 |
+
`ValueError` when the object is built, before any sampling.
|
| 933 |
+
|
| 934 |
+
### EmphasisSettings
|
| 935 |
+
|
| 936 |
+
`dflow.prompt_emphasis.EmphasisSettings` has `mapping`
|
| 937 |
+
(`EmphasisMapping.LINEAR` or `LOG`, default `LINEAR`), `strength` (default 1.0)
|
| 938 |
+
and `encoder` (default `True`). See [Prompt emphasis](#prompt-emphasis).
|
| 939 |
+
|
| 940 |
+
### ImageToImage
|
| 941 |
+
|
| 942 |
+
`dflow.inference.ImageToImage` starts sampling from existing latents, noised to
|
| 943 |
+
the time of a later schedule step.
|
| 944 |
+
|
| 945 |
+
| Field | Meaning |
|
| 946 |
+
| --- | --- |
|
| 947 |
+
| `latents` | `[B or 1, 96, h, w]` latents of the generation size, for example from `pipe.components.vae.encode` |
|
| 948 |
+
| `start_step` | The step of the schedule at which sampling starts, from 0 to `steps − 1` |
|
| 949 |
+
|
| 950 |
+
The schedule is built at its full step count. The latents are noised to the
|
| 951 |
+
time of `start_step` with the seed's noise, and the remaining steps run. A
|
| 952 |
+
later start step keeps more of the input image. Guidance step windows count
|
| 953 |
+
from the start step.
|
| 954 |
+
|
| 955 |
+
### OutputType
|
| 956 |
+
|
| 957 |
+
`dflow.pipeline.OutputType`:
|
| 958 |
+
|
| 959 |
+
| Member | Result |
|
| 960 |
+
| --- | --- |
|
| 961 |
+
| `PIL` | `images`: PIL images that carry their generation metadata |
|
| 962 |
+
| `TENSOR` | `tensors`: `[B, 3, H, W]` float32 RGB in [−1, 1] |
|
| 963 |
+
| `LATENT` | `tensors`: undecoded `[B, 96, H/16, W/16]` latents |
|
| 964 |
+
|
| 965 |
+
### Previews during sampling
|
| 966 |
+
|
| 967 |
+
A latent callback has the signature `callback(latents, completed, total)`. It
|
| 968 |
+
is called after each solver step with the model's current estimate of the
|
| 969 |
+
finished latents and the step counts.
|
| 970 |
+
|
| 971 |
+
`dflow.preview.LatentRgbPreview` is a fitted projection from those latents to a
|
| 972 |
+
small RGB image, at one eighth of the image resolution.
|
| 973 |
+
|
| 974 |
+
```python
|
| 975 |
+
from dflow.preview import LatentRgbPreview, preview_images
|
| 976 |
+
|
| 977 |
+
preview = LatentRgbPreview.bundled().to(pipe.components.engine.device)
|
| 978 |
+
|
| 979 |
+
|
| 980 |
+
def show(latents, completed, total):
|
| 981 |
+
image = preview_images(preview.project(latents))[0]
|
| 982 |
+
image.save(f"preview_{completed:03d}.png")
|
| 983 |
+
|
| 984 |
+
|
| 985 |
+
image = pipe("A lighthouse on a cliff at dusk.", callback=show).images[0]
|
| 986 |
+
```
|
| 987 |
+
|
| 988 |
+
### PNG metadata
|
| 989 |
+
|
| 990 |
+
Each PIL image returned by the pipeline carries a JSON description of how it
|
| 991 |
+
was made in `image.info["dflow"]`: the model and package versions, the prompt,
|
| 992 |
+
the index of the image in its batch and the complete settings.
|
| 993 |
+
|
| 994 |
+
To keep it in the saved file, pass it to `save`:
|
| 995 |
+
|
| 996 |
+
```python
|
| 997 |
+
image.save("out.png", pnginfo=pipe.png_info(image))
|
| 998 |
+
```
|
| 999 |
+
|
| 1000 |
+
The text is stored in a PNG text chunk named `dflow`.
|
| 1001 |
+
|
| 1002 |
+
### Diffusers wrapper
|
| 1003 |
+
|
| 1004 |
+
`dflow.diffusers_pipeline.DFlowDiffusersPipeline` offers the call signature of
|
| 1005 |
+
a diffusers pipeline. It requires `diffusers` to be installed and wraps a
|
| 1006 |
+
`DFlowPipeline`; the model, sampler and guidance are the same.
|
| 1007 |
+
|
| 1008 |
+
```python
|
| 1009 |
+
from dflow.diffusers_pipeline import DFlowDiffusersPipeline
|
| 1010 |
+
|
| 1011 |
+
pipe = DFlowDiffusersPipeline.from_pretrained("dflow_2b")
|
| 1012 |
+
image = pipe(
|
| 1013 |
+
"A lighthouse on a cliff at dusk.",
|
| 1014 |
+
height=1216,
|
| 1015 |
+
width=832,
|
| 1016 |
+
num_inference_steps=50,
|
| 1017 |
+
guidance_scale=2.5,
|
| 1018 |
+
generator_seed=7,
|
| 1019 |
+
).images[0]
|
| 1020 |
+
```
|
| 1021 |
+
|
| 1022 |
+
| Argument | Default | Meaning |
|
| 1023 |
+
| --- | --- | --- |
|
| 1024 |
+
| `prompt` | | The prompt |
|
| 1025 |
+
| `negative_prompt` | `""` | Accepted only with `settings`, whose guidance must read it (CFG or contrastive PDG); set it in those settings |
|
| 1026 |
+
| `height`, `width` | 1216, 832 | Image size |
|
| 1027 |
+
| `num_inference_steps` | 50 | Solver steps |
|
| 1028 |
+
| `guidance_scale` | 2.5 | The PDG scale |
|
| 1029 |
+
| `num_images_per_prompt` | 1 | Images to generate |
|
| 1030 |
+
| `generator_seed` | 0 | The seed |
|
| 1031 |
+
| `settings` | `None` | A full `GenerationSettings`; when given it replaces every argument except the prompt and the image count |
|
| 1032 |
+
|
| 1033 |
+
`guidance_scale` here is the PDG scale, so values suited to CFG in other models
|
| 1034 |
+
are too high. The wrapper is loaded with its own `from_pretrained`, as above.
|
| 1035 |
+
It does not support `save_pretrained` or loading through
|
| 1036 |
+
`DiffusionPipeline.from_pretrained`.
|
| 1037 |
+
|
| 1038 |
+
## ComfyUI node reference
|
| 1039 |
+
|
| 1040 |
+
The nodes are in the **DFlow** category. Their defaults are the default preset.
|
| 1041 |
+
|
| 1042 |
+
### DFlow Loader
|
| 1043 |
+
|
| 1044 |
+
Loads the denoiser, the text encoder and the autoencoder. Outputs: `model`,
|
| 1045 |
+
`text_encoder`, `vae`. The `vae` output works with ComfyUI's VAEDecode and
|
| 1046 |
+
VAEEncode nodes.
|
| 1047 |
+
|
| 1048 |
+
| Input | Default | Meaning |
|
| 1049 |
+
| --- | --- | --- |
|
| 1050 |
+
| `source` | `bundled` | `bundled` reads the weights in the node folder; `local_dir` another folder; `hub` a Hugging Face repository |
|
| 1051 |
+
| `local_dir` | empty | Release folder, for the `local_dir` source |
|
| 1052 |
+
| `repository` | `data-archetype/dflow_2b` | Repository id, for the `hub` source |
|
| 1053 |
+
| `revision` | empty | Hub revision; empty for `main` |
|
| 1054 |
+
| `compile_model` | on | Compile the model with `torch.compile` |
|
| 1055 |
+
| `cache_dir` | empty | Hugging Face cache directory; empty for the default |
|
| 1056 |
+
|
| 1057 |
+
### DFlow Text Encode
|
| 1058 |
+
|
| 1059 |
+
Encodes a plain prompt. Output: `conditioning`.
|
| 1060 |
+
|
| 1061 |
+
| Input | Default | Meaning |
|
| 1062 |
+
| --- | --- | --- |
|
| 1063 |
+
| `text_encoder` | | From the loader |
|
| 1064 |
+
| `text` | empty | The prompt |
|
| 1065 |
+
| `batch_size` | 1 | Copies of the prompt; must equal the latent's batch size |
|
| 1066 |
+
| `emphasis` | on | Apply `(phrase:weight)` markup |
|
| 1067 |
+
| `emphasis_mapping` | `linear` | `linear` or `log` |
|
| 1068 |
+
| `emphasis_strength` | 1.0 | Multiplier on every weight's effect |
|
| 1069 |
+
| `emphasis_encoder` | on | Also apply the weights inside the text encoder |
|
| 1070 |
+
|
| 1071 |
+
For a negative prompt, add a second DFlow Text Encode node and connect it to
|
| 1072 |
+
the guider's `negative` input. Stored layouts go to DFlow Layout Encode, which
|
| 1073 |
+
takes the image size they are compiled for.
|
| 1074 |
+
|
| 1075 |
+
### DFlow Layout Encode
|
| 1076 |
+
|
| 1077 |
+
Compiles a stored layout at the image size and encodes it. Output:
|
| 1078 |
+
`conditioning`.
|
| 1079 |
+
|
| 1080 |
+
| Input | Default | Meaning |
|
| 1081 |
+
| --- | --- | --- |
|
| 1082 |
+
| `text_encoder` | | From the loader |
|
| 1083 |
+
| `layout_json` | empty | The stored layout, or an already compiled one |
|
| 1084 |
+
| `width` | 832 | Image width the layout is for |
|
| 1085 |
+
| `height` | 1216 | Image height the layout is for |
|
| 1086 |
+
| `batch_size` | 1 | Copies of the prompt |
|
| 1087 |
+
|
| 1088 |
+
`width` and `height` must equal the size of the latent that is sampled.
|
| 1089 |
+
|
| 1090 |
+
### DFlow Guider
|
| 1091 |
+
|
| 1092 |
+
Sets path-drop guidance, its suffix caption bias, CFG and the self-attention
|
| 1093 |
+
gain. Output: `guider`.
|
| 1094 |
+
|
| 1095 |
+
| Input | Default | Meaning |
|
| 1096 |
+
| --- | --- | --- |
|
| 1097 |
+
| `model` | | From the loader |
|
| 1098 |
+
| `positive` | | The prompt's conditioning |
|
| 1099 |
+
| `negative` | not connected | Optional conditioning for CFG and the contrastive PDG modes |
|
| 1100 |
+
| `pdg_enabled` | on | Path-drop guidance |
|
| 1101 |
+
| `pdg_mode` | `full` | The [mode](#modes) |
|
| 1102 |
+
| `pdg_scale` | 2.5 | Constant PDG scale; 1 is none |
|
| 1103 |
+
| `pdg_start_step` | 0 | First PDG step |
|
| 1104 |
+
| `pdg_stop_step` | −1 | Last PDG step; −1 for the last step |
|
| 1105 |
+
| `pdg_suffix_caption_bias` | −4 | [Suffix caption bias](#suffix-caption-bias) of the reference; 0 is off |
|
| 1106 |
+
| `cfg_enabled` | off | Classifier-free guidance |
|
| 1107 |
+
| `cfg_scale` | 4.0 | CFG scale, also used by the PDG modes that involve CFG |
|
| 1108 |
+
| `cfg_start_step` | 0 | First CFG step |
|
| 1109 |
+
| `cfg_stop_step` | −1 | Last CFG step; −1 for the last step |
|
| 1110 |
+
| `self_attention_gain` | −0.03 | [Gain](#self-attention-gain) of the main pass |
|
| 1111 |
+
|
| 1112 |
+
### DFlow Guider Advanced
|
| 1113 |
+
|
| 1114 |
+
Takes a guider from DFlow Guider and returns it with further settings. It is
|
| 1115 |
+
optional. Output: `guider`.
|
| 1116 |
+
|
| 1117 |
+
| Input | Default | Meaning |
|
| 1118 |
+
| --- | --- | --- |
|
| 1119 |
+
| `guider` | | From DFlow Guider |
|
| 1120 |
+
| `guidance_self_attention_gain` | 0.0 | Gain of the guidance passes |
|
| 1121 |
+
| `pdg_curve` | `constant` | `constant`, `ramp`, `linear`, `linear_logsnr`, `power`, `s_curve` or `bezier` |
|
| 1122 |
+
| `curve_noisy_scale` | 2.0 | Endpoint curves: scale at the first step |
|
| 1123 |
+
| `curve_clean_scale` | 2.5 | Endpoint curves: scale at the last step |
|
| 1124 |
+
| `curve_power` | 3.0 | Exponent of the `power` curve |
|
| 1125 |
+
| `s_curve_knee` | 0.5 | Midpoint of the `s_curve` |
|
| 1126 |
+
| `s_curve_sharpness` | 8.0 | Slope of the `s_curve` |
|
| 1127 |
+
| `ramp_start_scale` | 4.5 | Ramp: scale at the noisy end |
|
| 1128 |
+
| `ramp_end_scale` | 2.5 | Ramp: scale after the ramp |
|
| 1129 |
+
| `ramp_length` | 0.3 | Ramp: fraction of the schedule |
|
| 1130 |
+
| `bezier_multiplier` | 3.0 | Height of the Bezier curve |
|
| 1131 |
+
| `projection` | `off` | Projected guidance: `off`, `global` or `per_band` |
|
| 1132 |
+
| `projection_parallel_weight` | 1.0 | Weight kept on the parallel part |
|
| 1133 |
+
| `projection_first_band` | 0 | `per_band`: first projected band, 0 to 4 |
|
| 1134 |
+
| `rescale` | 0.0 | Guidance rescale; 0 is off |
|
| 1135 |
+
| `sparse_middle_percent` | 0.0 | Percent of steps with a sparse middle |
|
| 1136 |
+
| `sparse_middle_schedule` | `prefix` | `prefix` or `cyclic` |
|
| 1137 |
+
|
| 1138 |
+
With `pdg_curve` at `constant` the scale is the `pdg_scale` of the DFlow Guider
|
| 1139 |
+
node. The other choices replace it and read only their own inputs.
|
| 1140 |
+
|
| 1141 |
+
### DFlow Sampler
|
| 1142 |
+
|
| 1143 |
+
Chooses the solver. Output: `sampler`, which goes to DFlow Time Schedule.
|
| 1144 |
+
|
| 1145 |
+
| Input | Default | Meaning |
|
| 1146 |
+
| --- | --- | --- |
|
| 1147 |
+
| `solver` | `er_sde` | One of the [solvers](#solvers) |
|
| 1148 |
+
| `noise_scale` | 1.0 | Noise multiplier of stochastic solvers; eta for `dpmpp_2m_sde` |
|
| 1149 |
+
|
| 1150 |
+
Changing the solver in the ComfyUI interface sets `noise_scale` to that
|
| 1151 |
+
solver's recommended value.
|
| 1152 |
+
|
| 1153 |
+
### DFlow Time Schedule
|
| 1154 |
+
|
| 1155 |
+
Builds the schedule for the size of the latent. Outputs: `sigmas` and
|
| 1156 |
+
`sampler`.
|
| 1157 |
+
|
| 1158 |
+
| Input | Default | Meaning |
|
| 1159 |
+
| --- | --- | --- |
|
| 1160 |
+
| `sampler` | | From DFlow Sampler |
|
| 1161 |
+
| `latent` | | The latent that will be sampled; gives the image size |
|
| 1162 |
+
| `schedule` | `beta_1_25` | One of the [schedules](#schedules) |
|
| 1163 |
+
| `steps` | 50 | Solver steps |
|
| 1164 |
+
| `base_log_snr_shift` | −0.25 | The size-independent part of the shift |
|
| 1165 |
+
| `resolution_shift` | on | Add the image-size term |
|
| 1166 |
+
| `beta_mean` | 0.5 | `custom_beta` only |
|
| 1167 |
+
| `beta_concentration` | 0.6 | `custom_beta` only |
|
| 1168 |
+
|
| 1169 |
+
Connect both outputs to SamplerCustomAdvanced. The `sampler` output carries the
|
| 1170 |
+
schedule the sigmas were built from: its kind, its shift and the image size.
|
| 1171 |
+
Guidance computes the ramp and the `linear_logsnr` curve from them and checks
|
| 1172 |
+
the size against the latent. With a sampler taken straight from DFlow Sampler,
|
| 1173 |
+
sampling stops with an error message.
|
| 1174 |
+
|
| 1175 |
+
### DFlow Empty Latent
|
| 1176 |
+
|
| 1177 |
+
Creates an empty 96-channel latent. Output: `latent`. ComfyUI's stock empty
|
| 1178 |
+
latent nodes produce a different latent format and cannot be used.
|
| 1179 |
+
|
| 1180 |
+
| Input | Default | Meaning |
|
| 1181 |
+
| --- | --- | --- |
|
| 1182 |
+
| `width` | 832 | Image width, a multiple of 16 |
|
| 1183 |
+
| `height` | 1216 | Image height, a multiple of 16 |
|
| 1184 |
+
| `batch_size` | 1 | Images per run |
|
| 1185 |
+
|
| 1186 |
+
### Stock nodes
|
| 1187 |
+
|
| 1188 |
+
Seeds come from ComfyUI's RandomNoise node. A seed gives the same starting
|
| 1189 |
+
noise in ComfyUI as in the Python package.
|
| 1190 |
+
|
| 1191 |
+
SamplerCustomAdvanced takes the noise, the guider, the sampler and sigmas from
|
| 1192 |
+
DFlow Time Schedule, and the latent. VAEDecode with the loader's `vae` output
|
| 1193 |
+
turns the result into an image, and SaveImage stores it with the workflow
|
| 1194 |
+
embedded.
|
| 1195 |
+
|
| 1196 |
+
## Troubleshooting
|
| 1197 |
+
|
| 1198 |
+
**"The dflow_2b weights are not in the node folder", or a file "is a Git LFS
|
| 1199 |
+
pointer".** This happens after a `git clone` without the large files. Download
|
| 1200 |
+
them into the folder with the command the message prints,
|
| 1201 |
+
`hf download data-archetype/dflow_2b --local-dir <folder>`, or set the loader's
|
| 1202 |
+
`source` to `hub`.
|
| 1203 |
+
|
| 1204 |
+
**The first image takes much longer than the following ones.** The model is
|
| 1205 |
+
being compiled. This happens once per session.
|
| 1206 |
+
|
| 1207 |
+
**Errors during compilation.** `torch.compile` needs a working compiler
|
| 1208 |
+
toolchain and a matching PyTorch build. To check whether compilation is the
|
| 1209 |
+
cause, run eagerly: `compile=False` in Python, or `compile_model` off in DFlow
|
| 1210 |
+
Loader. Eager mode runs the same model at lower speed.
|
| 1211 |
+
|
| 1212 |
+
**Out of memory.** An 832×1216 image needs about 7 GB of VRAM at peak, and
|
| 1213 |
+
memory grows with the image area and the batch size. Generate one image at a
|
| 1214 |
+
time, reduce the size, and close other programs that hold GPU memory. In
|
| 1215 |
+
ComfyUI, other loaded models count against the same memory.
|
| 1216 |
+
|
| 1217 |
+
**"The prompt has N tokens; the model takes at most 6144."** Shorten the
|
| 1218 |
+
prompt. Text in double quotes and `text` fields of a layout use one token per
|
| 1219 |
+
character, so long quoted passages add up quickly.
|
| 1220 |
+
|
| 1221 |
+
**"Prompts of one batch must have the same token count."** A list of different
|
| 1222 |
+
prompts in one Python call must have equal token counts. Run prompts of
|
| 1223 |
+
different lengths as separate calls, or use `num_images` to repeat one prompt.
|
| 1224 |
+
|
| 1225 |
+
**"This layout prompt was compiled for … the image is …"** A compiled layout is
|
| 1226 |
+
being used at a different size. Compile the stored layout again at the image
|
| 1227 |
+
size: in ComfyUI, set `width` and `height` on DFlow Layout Encode to the
|
| 1228 |
+
latent's size.
|
| 1229 |
+
|
| 1230 |
+
**"The schedule was built for … but the latent is …"** The DFlow Time Schedule
|
| 1231 |
+
node is connected to a different latent from the one being sampled. Connect the
|
| 1232 |
+
same latent to both.
|
| 1233 |
+
|
| 1234 |
+
**"Connect the sampler output of DFlow Time Schedule …"** SamplerCustomAdvanced
|
| 1235 |
+
is receiving the sampler from DFlow Sampler directly. See
|
| 1236 |
+
[DFlow Time Schedule](#dflow-time-schedule).
|
| 1237 |
+
|
| 1238 |
+
**"The latent batch is … but the conditioning holds … prompts."** Set the same
|
| 1239 |
+
`batch_size` on the text encode node and on DFlow Empty Latent.
|
| 1240 |
+
|
| 1241 |
+
**Large images look dark or burnt, or lose coherence.** Adjust the
|
| 1242 |
+
[self-attention gain](#self-attention-gain) for the image area.
|
NOTICE
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
dflow_2b
|
| 2 |
+
Copyright 2026 Data Archetype
|
| 3 |
+
|
| 4 |
+
Different parts of this repository are under different licences.
|
| 5 |
+
|
| 6 |
+
1. Model weights, dflow/ package, documentation and gallery images
|
| 7 |
+
|
| 8 |
+
The dflow_2b model weights (model.safetensors, config.json, release.json),
|
| 9 |
+
the dflow/ Python package, the documentation and the images under assets/
|
| 10 |
+
are licensed under the ModelGo Attribution-NonCommercial License 2.0
|
| 11 |
+
(MG-BY-NC-2.0). See LICENSE.
|
| 12 |
+
|
| 13 |
+
Required attribution notice:
|
| 14 |
+
|
| 15 |
+
This project uses dflow_2b by Data Archetype.
|
| 16 |
+
https://huggingface.co/data-archetype/dflow_2b
|
| 17 |
+
|
| 18 |
+
Distributions of dflow_2b or of Derivative Materials must retain this
|
| 19 |
+
notice and include a copy of LICENSE.
|
| 20 |
+
|
| 21 |
+
2. ComfyUI nodes
|
| 22 |
+
|
| 23 |
+
The files in comfyui/ and the root __init__.py are licensed under the GNU
|
| 24 |
+
General Public License, version 3 (GPL-3.0). See comfyui/LICENSE and
|
| 25 |
+
comfyui/NOTICE.
|
| 26 |
+
|
| 27 |
+
3. Text encoder
|
| 28 |
+
|
| 29 |
+
The files in text_encoder/ are a modified copy of part of Google's
|
| 30 |
+
T5Gemma 2 model google/t5gemma-2-270m-270m. They are not relicensed under
|
| 31 |
+
MG-BY-NC-2.0.
|
| 32 |
+
|
| 33 |
+
Gemma is provided under and subject to the Gemma Terms of Use found at
|
| 34 |
+
gemma.ai/resources/terms
|
| 35 |
+
|
| 36 |
+
The same terms were previously published at ai.google.dev/gemma/terms,
|
| 37 |
+
which now redirects to the address above. Earlier versions of the terms
|
| 38 |
+
worded this notice as: "Gemma is provided under and subject to the Gemma
|
| 39 |
+
Terms of Use found at ai.google.dev/gemma/terms".
|
| 40 |
+
|
| 41 |
+
A copy of the Gemma Terms of Use is in text_encoder/LICENSE-GEMMA.md. Use
|
| 42 |
+
of these files is subject to the use restrictions in Section 3.2 of those
|
| 43 |
+
terms, including the Gemma Prohibited Use Policy at
|
| 44 |
+
gemma.ai/resources/prohibited_use_policy.
|
| 45 |
+
|
| 46 |
+
Modification notice: Data Archetype modified the original files in
|
| 47 |
+
November 2026. The folder keeps the tokenizer, the token embeddings and
|
| 48 |
+
encoder layers 1 to 12, removes the remaining encoder layers and the
|
| 49 |
+
decoder, and stores the weights in bfloat16. See ATTRIBUTION.md.
|
| 50 |
+
|
| 51 |
+
4. Autoencoder
|
| 52 |
+
|
| 53 |
+
data-archetype/dinac3_96 is a separate repository that is downloaded at
|
| 54 |
+
run time and is not part of this one. Its own repository is the authority
|
| 55 |
+
for its licence and notices.
|
README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 8 |
+
- text-to-image
|
| 9 |
+
- flow-matching
|
| 10 |
+
- pytorch
|
| 11 |
+
- comfyui
|
| 12 |
+
- photography
|
| 13 |
+
base_model:
|
| 14 |
+
- google/t5gemma-2-270m-270m
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# dflow_2b
|
| 18 |
+
|
| 19 |
+
> [!WARNING]
|
| 20 |
+
> **Preview, version 0.2.** The model is still training, so checkpoints and
|
| 21 |
+
> behaviour will change between releases. Generations are still uneven, expect
|
| 22 |
+
> some seed hunting.
|
| 23 |
+
|
| 24 |
+
dflow_2b is an indie text-to-image model, trained from scratch on a single GPU,
|
| 25 |
+
mostly on photographs and classical art.
|
| 26 |
+
|
| 27 |
+
It takes ordinary captions, and also JSON layout captions (the same format as
|
| 28 |
+
[MOSS-Image](https://github.com/OpenMOSS/MOSS-Image)).
|
| 29 |
+
|
| 30 |
+
The package contains the weights, the `dflow` inference code and ComfyUI nodes.
|
| 31 |
+
|
| 32 |
+
[Example gallery](GALLERY.md) · [Manual](MANUAL.md) ·
|
| 33 |
+
[Technical report](TECHNICAL_REPORT.md) · [Release notes](RELEASES.md)
|
| 34 |
+
|
| 35 |
+
<table>
|
| 36 |
+
<tr>
|
| 37 |
+
<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>
|
| 38 |
+
<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>
|
| 39 |
+
<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>
|
| 40 |
+
<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>
|
| 41 |
+
</tr>
|
| 42 |
+
<tr>
|
| 43 |
+
<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>
|
| 44 |
+
<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>
|
| 45 |
+
<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>
|
| 46 |
+
<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>
|
| 47 |
+
</tr>
|
| 48 |
+
</table>
|
| 49 |
+
|
| 50 |
+
## What's included
|
| 51 |
+
|
| 52 |
+
- `model.safetensors`: the 2B denoiser.
|
| 53 |
+
- `text_encoder/`: the part of
|
| 54 |
+
[T5Gemma 2 270M](https://huggingface.co/google/t5gemma-2-270m-270m) the model
|
| 55 |
+
uses, under the Gemma Terms of Use.
|
| 56 |
+
- `dflow/`: the Python inference package.
|
| 57 |
+
- `comfyui/`: ComfyUI nodes and example workflows.
|
| 58 |
+
|
| 59 |
+
The autoencoder, [dinac3_96](https://huggingface.co/data-archetype/dinac3_96),
|
| 60 |
+
is our own and downloads automatically on first use. The
|
| 61 |
+
[technical report](TECHNICAL_REPORT.md) covers the architecture and training.
|
| 62 |
+
|
| 63 |
+
## Requirements
|
| 64 |
+
|
| 65 |
+
Python 3.12 or later, PyTorch 2.13 with CUDA, and an NVIDIA GPU with bfloat16
|
| 66 |
+
support and about 7 GB of free VRAM.
|
| 67 |
+
|
| 68 |
+
Generation is compiled with `torch.compile`. The first image takes an extra 30
|
| 69 |
+
to 45 seconds while it compiles; after that, an 832×1216 image takes about 10
|
| 70 |
+
seconds on an RTX 4090.
|
| 71 |
+
|
| 72 |
+
## ComfyUI
|
| 73 |
+
|
| 74 |
+
The repository is a ComfyUI custom-node folder. Download it into
|
| 75 |
+
`custom_nodes` and install its requirements:
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
cd ComfyUI/custom_nodes
|
| 79 |
+
hf download data-archetype/dflow_2b --local-dir dflow_2b
|
| 80 |
+
pip install -r dflow_2b/requirements.txt
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Load `dflow_2b/comfyui/workflows/dflow_default.json`, or drag any image from the
|
| 84 |
+
[gallery](GALLERY.md) onto the canvas to get the workflow that made it. Start
|
| 85 |
+
ComfyUI with `--preview-method auto` for live previews.
|
| 86 |
+
|
| 87 |
+
## Python
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
hf download data-archetype/dflow_2b --local-dir dflow_2b
|
| 91 |
+
pip install -e dflow_2b
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from dflow.inference import GenerationSettings
|
| 96 |
+
from dflow.pipeline import DFlowPipeline
|
| 97 |
+
|
| 98 |
+
pipe = DFlowPipeline.from_pretrained("dflow_2b")
|
| 99 |
+
image = pipe("A lighthouse on a cliff at dusk.", GenerationSettings(seed=7)).images[0]
|
| 100 |
+
image.save("lighthouse.png", pnginfo=pipe.png_info(image))
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
`from_pretrained` also takes the Hub id `data-archetype/dflow_2b`, in which case
|
| 104 |
+
the files go to the Hugging Face cache. If you have diffusers installed, a thin
|
| 105 |
+
diffusers-style wrapper is available as
|
| 106 |
+
`dflow.diffusers_pipeline.DFlowDiffusersPipeline`.
|
| 107 |
+
|
| 108 |
+
## Prompts
|
| 109 |
+
|
| 110 |
+
Write captions the way you would describe a photo or a painting: the subject,
|
| 111 |
+
the setting, the light and the medium. Long prompts are fine, up to 6,144
|
| 112 |
+
tokens.
|
| 113 |
+
|
| 114 |
+
Put text you want in the image in double quotes, as in
|
| 115 |
+
`A shop sign that reads "OPEN LATE"`. The model reads quoted text letter by
|
| 116 |
+
letter, which helps with spelling.
|
| 117 |
+
|
| 118 |
+
A layout describes the picture as a whole and then lists its elements, each
|
| 119 |
+
with a label, a caption and a box `[y0, x0, y1, x1]` on a 0–1000 scale. Text
|
| 120 |
+
elements carry the exact string to render:
|
| 121 |
+
|
| 122 |
+
```json
|
| 123 |
+
{"summary": {"canvas": "single",
|
| 124 |
+
"caption": "A travel poster of a mountain above a lake."},
|
| 125 |
+
"frame": {"caption": "The peak sits in the upper middle.",
|
| 126 |
+
"palette": ["#F3E6C8", "#2F5D62"]},
|
| 127 |
+
"items": [
|
| 128 |
+
{"label": "object", "caption": "A snow-capped mountain.",
|
| 129 |
+
"box_2d": [250, 180, 620, 820]},
|
| 130 |
+
{"label": "text", "caption": "The title in tall serif capitals.",
|
| 131 |
+
"text": "SILVER LAKE", "box_2d": [120, 110, 220, 890]}]}
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
Use it as the prompt in Python, or paste it into the DFlow Layout Encode node.
|
| 135 |
+
The [manual](MANUAL.md#json-layouts) covers every field and works through a
|
| 136 |
+
full poster.
|
| 137 |
+
|
| 138 |
+
## Limitations
|
| 139 |
+
|
| 140 |
+
- It is a preview, and quality varies from prompt to prompt and seed to seed.
|
| 141 |
+
- Hands and anatomy often go wrong.
|
| 142 |
+
- Small text and long passages of text are hit and miss.
|
| 143 |
+
- Above about one megapixel results get less reliable. For large images, move
|
| 144 |
+
the [self-attention gain](MANUAL.md#self-attention-gain) towards 0.
|
| 145 |
+
- Styles far from photography and classical art are weaker.
|
| 146 |
+
|
| 147 |
+
You are responsible for how you use the model and its outputs.
|
| 148 |
+
|
| 149 |
+
## Licence
|
| 150 |
+
|
| 151 |
+
- The weights, the `dflow` package, the documentation and the gallery images:
|
| 152 |
+
ModelGo Attribution-NonCommercial 2.0 (`MG-BY-NC-2.0`). See
|
| 153 |
+
[`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).
|
| 154 |
+
- `comfyui/` and the root `__init__.py`: GPL-3.0. See
|
| 155 |
+
[`comfyui/LICENSE`](comfyui/LICENSE).
|
| 156 |
+
- `text_encoder/`: Gemma is provided under and subject to the Gemma Terms of Use
|
| 157 |
+
found at [gemma.ai/resources/terms](https://gemma.ai/resources/terms). A copy
|
| 158 |
+
is in [`text_encoder/LICENSE-GEMMA.md`](text_encoder/LICENSE-GEMMA.md).
|
| 159 |
+
- dinac3_96 has its own licence, in
|
| 160 |
+
[its repository](https://huggingface.co/data-archetype/dinac3_96).
|
| 161 |
+
|
| 162 |
+
Third-party material is listed in [`ATTRIBUTION.md`](ATTRIBUTION.md).
|
| 163 |
+
|
| 164 |
+
## Citation
|
| 165 |
+
|
| 166 |
+
```bibtex
|
| 167 |
+
@misc{dflow_2b,
|
| 168 |
+
title = {dflow\_2b},
|
| 169 |
+
author = {{Data Archetype}},
|
| 170 |
+
year = {2026},
|
| 171 |
+
url = {https://huggingface.co/data-archetype/dflow_2b},
|
| 172 |
+
note = {Preview release, version 0.2}
|
| 173 |
+
}
|
| 174 |
+
```
|
RELEASES.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dflow_2b releases
|
| 2 |
+
|
| 3 |
+
[Model card](README.md) · [Manual](MANUAL.md) ·
|
| 4 |
+
[Technical report](TECHNICAL_REPORT.md) · [Example gallery](GALLERY.md)
|
| 5 |
+
|
| 6 |
+
## 0.2
|
| 7 |
+
|
| 8 |
+
Preview release. The model is still training, and later checkpoints will behave
|
| 9 |
+
differently. The weights are the exponential moving average (EMA) of the model
|
| 10 |
+
at training step 581,000.
|
| 11 |
+
|
| 12 |
+
Included:
|
| 13 |
+
|
| 14 |
+
- the denoiser weights;
|
| 15 |
+
- the part of the T5Gemma 2 270M-270M encoder the model uses;
|
| 16 |
+
- the `dflow` inference package, version 0.2.0, with an optional diffusers
|
| 17 |
+
wrapper;
|
| 18 |
+
- ComfyUI nodes with a default workflow and a layout poster workflow;
|
| 19 |
+
- the manual, the technical report and the example gallery, whose PNG files
|
| 20 |
+
carry their ComfyUI workflows.
|
| 21 |
+
|
| 22 |
+
The autoencoder, [dinac3_96](https://huggingface.co/data-archetype/dinac3_96),
|
| 23 |
+
downloads on first use, at a pinned commit.
|
TECHNICAL_REPORT.md
ADDED
|
@@ -0,0 +1,699 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dflow_2b Technical Report
|
| 2 |
+
|
| 3 |
+
[Model card](README.md) · [Manual](MANUAL.md) · [Example gallery](GALLERY.md) ·
|
| 4 |
+
[Release notes](RELEASES.md)
|
| 5 |
+
|
| 6 |
+
## Overview
|
| 7 |
+
|
| 8 |
+
dflow_2b is an indie text-to-image model, trained from scratch on a single GPU,
|
| 9 |
+
mostly on photographs and classical art. Its denoiser has 2.1 billion
|
| 10 |
+
parameters. It reads natural-language prompts and structured JSON layout
|
| 11 |
+
prompts.
|
| 12 |
+
|
| 13 |
+
A generation has three stages:
|
| 14 |
+
|
| 15 |
+
```text
|
| 16 |
+
prompt
|
| 17 |
+
-> T5Gemma 2 encoder (12 layers, three hidden-state taps)
|
| 18 |
+
-> projection to width 2304, learned suffix tokens
|
| 19 |
+
-> denoiser: 2 text-refiner blocks, then 30 joint text-image blocks
|
| 20 |
+
-> 96-channel latent at 1/16 resolution
|
| 21 |
+
-> dinac3_96 decoder
|
| 22 |
+
-> RGB image
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
Text and image tokens share one stream of joint attention. The middle of the
|
| 26 |
+
network is trained mostly on all tokens, a variant of SPRINT described under
|
| 27 |
+
[Dense SPRINT](#dense-sprint).
|
| 28 |
+
|
| 29 |
+
## Flow matching
|
| 30 |
+
|
| 31 |
+
Let \\(x_0\\) be a clean image latent and \\(\varepsilon \sim \mathcal{N}(0, I)\\)
|
| 32 |
+
Gaussian noise. The model is trained on the linear path
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
x_t = (1-t)\,x_0 + t\,\varepsilon, \qquad t \in [0,1],
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
so \\(t=0\\) is data and \\(t=1\\) is pure noise. The velocity along this path is
|
| 39 |
+
constant,
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\frac{\mathrm{d}x_t}{\mathrm{d}t} = \varepsilon - x_0,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
and the network \\(v_\theta\\) predicts it directly. Given a prediction
|
| 46 |
+
\\(v\\) at \\((x_t, t)\\), the clean estimate is \\(\hat{x}_0 = x_t - t\,v\\), and an
|
| 47 |
+
Euler step towards data is \\(x_{t-h} = x_t - h\,v\\).
|
| 48 |
+
|
| 49 |
+
Noise levels are compared through the log signal-to-noise ratio
|
| 50 |
+
\\(\lambda(t) = 2\ln\frac{1-t}{t}\\). Adding a shift \\(s\\) to \\(\lambda\\) moves a
|
| 51 |
+
time \\(t\\) to
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
t' = \sigma\!\left(\operatorname{logit}(t) - \tfrac{s}{2}\right),
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where \\(\sigma\\) is the logistic function. A negative shift moves times towards
|
| 58 |
+
the noisy end. Larger images need more noise to hide the same structure, so both
|
| 59 |
+
training and sampling use a shift that depends on the image size:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
s(A) = \min\!\left(0,\; -0.25 - \ln\frac{A}{256^2}\right),
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where \\(A\\) is the number of pixels in the image. For an 832×1216 image
|
| 66 |
+
this gives \\(s = -2.99\\).
|
| 67 |
+
|
| 68 |
+
| Symbol | Meaning |
|
| 69 |
+
| --- | --- |
|
| 70 |
+
| \\(x_0\\) | Clean dinac3_96 latent of an image |
|
| 71 |
+
| \\(\varepsilon\\) | Standard Gaussian noise with the shape of \\(x_0\\) |
|
| 72 |
+
| \\(t\\) | Flow time; 0 is data, 1 is noise |
|
| 73 |
+
| \\(x_t\\) | Noised latent on the linear path |
|
| 74 |
+
| \\(v_\theta\\) | The denoiser; it outputs a velocity |
|
| 75 |
+
| \\(\hat{x}_0\\) | Clean estimate \\(x_t - t\,v\\) |
|
| 76 |
+
| \\(\lambda(t)\\) | Log signal-to-noise ratio at time \\(t\\) |
|
| 77 |
+
| \\(s\\) | Additive shift on \\(\lambda\\) |
|
| 78 |
+
| \\(A\\) | Number of pixels in the image, width times height |
|
| 79 |
+
|
| 80 |
+
## Latent space
|
| 81 |
+
|
| 82 |
+
The denoiser works in the latent space of
|
| 83 |
+
[dinac3_96](https://huggingface.co/data-archetype/dinac3_96), our own
|
| 84 |
+
deterministic autoencoder. Its latent has 96 channels at a spatial stride of 16
|
| 85 |
+
pixels: 64 unconstrained channels that carry detail and 32 channels aligned
|
| 86 |
+
with DINOv3 features. Its own report describes the autoencoder and its
|
| 87 |
+
measurements.
|
| 88 |
+
|
| 89 |
+
The denoiser uses a patch size of 1: each latent cell is one image token. An
|
| 90 |
+
832×1216 image is a 52×76 grid, or 3,952 image tokens. Image width and height
|
| 91 |
+
must be multiples of 16.
|
| 92 |
+
|
| 93 |
+
## Text conditioning
|
| 94 |
+
|
| 95 |
+
### Encoder and taps
|
| 96 |
+
|
| 97 |
+
Google's T5Gemma 2 270M-270M is an encoder-decoder language model; dflow_2b
|
| 98 |
+
uses its encoder, frozen, and leaves out the decoder. The encoder's hidden width
|
| 99 |
+
is 640. Only layers 1 to 12 run. Hidden states are read
|
| 100 |
+
after layers 2, 6 and 12, so that the denoiser sees features from early layers,
|
| 101 |
+
which stay close to the tokens and their spelling, together with later, more
|
| 102 |
+
contextual ones.
|
| 103 |
+
|
| 104 |
+
Gemma hidden states contain a few channels with very large activations. Each
|
| 105 |
+
tap is therefore standardised per channel with fixed means and standard
|
| 106 |
+
deviations, computed once on 20,000 training captions. The three standardised
|
| 107 |
+
taps pass through three bias-free linear maps from 640 to 2304 channels and the
|
| 108 |
+
results are summed:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
e_i = \sum_{k \in \{2,6,12\}} P_k \,\frac{h^{(k)}_i - \operatorname{mean}_k}{\operatorname{std}_k},
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where \\(h^{(k)}_i\\) is the hidden state of token \\(i\\) after layer \\(k\\),
|
| 115 |
+
\\(\operatorname{mean}_k\\) and \\(\operatorname{std}_k\\) are the per-channel
|
| 116 |
+
statistics of that tap, the division is per channel, and \\(P_k\\) is the tap's
|
| 117 |
+
linear map.
|
| 118 |
+
|
| 119 |
+
### Learned tokens
|
| 120 |
+
|
| 121 |
+
Three learned tokens are appended to every prompt, so every caption ends with
|
| 122 |
+
the same three text positions whatever its length.
|
| 123 |
+
|
| 124 |
+
The null text used for classifier-free guidance is also learned: one
|
| 125 |
+
unconditional token followed by the same three suffix tokens, four tokens in
|
| 126 |
+
all. An empty prompt maps to this sequence.
|
| 127 |
+
|
| 128 |
+
### Tokenisation of visible text
|
| 129 |
+
|
| 130 |
+
Text that should appear in the image is tokenised one character at a time, so
|
| 131 |
+
each character of the string is its own token and the spelling is explicit in
|
| 132 |
+
the token sequence. LongCat-Image uses the same technique. In a plain prompt
|
| 133 |
+
this applies to every double-quoted span, quote marks included. In a JSON layout
|
| 134 |
+
prompt it applies to the value of every `"text"` field and to escaped-quote
|
| 135 |
+
spans inside other strings. Everything else uses the standard tokeniser.
|
| 136 |
+
|
| 137 |
+
Prompts can be up to 6,144 tokens long, the longest caption length used in
|
| 138 |
+
training. Longer prompts raise an error.
|
| 139 |
+
|
| 140 |
+
## Denoiser
|
| 141 |
+
|
| 142 |
+
### One stream for text and image
|
| 143 |
+
|
| 144 |
+
Each sample is a single sequence made of its image tokens and its text tokens.
|
| 145 |
+
Every layer applies self-attention over the whole sequence, so image tokens read
|
| 146 |
+
the text and each other in the same operation, and text tokens are updated along
|
| 147 |
+
with the image.
|
| 148 |
+
|
| 149 |
+
The projected text first passes through two text-only refiner blocks. These
|
| 150 |
+
blocks see only the text, so their output is computed once per prompt and
|
| 151 |
+
reused at every sampling step and by every guidance pass. The image latent is
|
| 152 |
+
embedded by a 1×1 convolution from 96 to 2304 channels.
|
| 153 |
+
|
| 154 |
+
All blocks have width 2304 and 18 attention heads of 128 channels.
|
| 155 |
+
|
| 156 |
+
### Position encoding
|
| 157 |
+
|
| 158 |
+
Position enters through 3D rotary position embeddings (3D RoPE) in attention.
|
| 159 |
+
Each token has a position on three axes, one for sequence order and two spatial
|
| 160 |
+
ones, and each head splits its 128 channels over the axes as 32, 48 and 48,
|
| 161 |
+
with frequency base 10,000.
|
| 162 |
+
|
| 163 |
+
For a prompt of \\(L\\) tokens and an image grid of \\(n_y\\) rows and \\(n_x\\)
|
| 164 |
+
columns of tokens:
|
| 165 |
+
|
| 166 |
+
- text token \\(i\\), counted from 1, sits at \\((i, 0, 0)\\);
|
| 167 |
+
- the image token in row \\(i_y\\) and column \\(i_x\\), both counted from 0, sits
|
| 168 |
+
at \\(\left(L+1,\; i_y - \tfrac{n_y-1}{2},\; i_x - \tfrac{n_x-1}{2}\right)\\).
|
| 169 |
+
|
| 170 |
+
The first axis orders the text and places the whole image one step after it.
|
| 171 |
+
This 3D layout follows modern single-stream image transformers such as
|
| 172 |
+
Z-Image. Following MOSS-Image, the spatial axes are also centred on the image
|
| 173 |
+
centre, so text tokens, at spatial position 0, sit at the centre of the image at
|
| 174 |
+
every size and aspect ratio, and the largest spatial offset between a text token
|
| 175 |
+
and an image token is half the grid. Attention between image tokens is unchanged
|
| 176 |
+
by the centring because RoPE depends only on position differences.
|
| 177 |
+
|
| 178 |
+
### Timestep conditioning
|
| 179 |
+
|
| 180 |
+
The timestep is embedded as 256 sinusoidal features of \\(1000\,t\\), followed by
|
| 181 |
+
a two-layer MLP with a hidden width of 1024 and an output \\(\tau(t)\\) of
|
| 182 |
+
width 256.
|
| 183 |
+
|
| 184 |
+
Every image block has its own linear projector from
|
| 185 |
+
\\(\operatorname{SiLU}(\tau(t))\\) to four vectors of width 2304: a scale and a gate
|
| 186 |
+
for attention, and a scale and a gate for the MLP. The time embedding is narrow
|
| 187 |
+
because a timestep is a single scalar: measured in model ablations, the per-layer modulation
|
| 188 |
+
signals occupied at most 14 dimensions at 99.99% of their energy.
|
| 189 |
+
With a 256-wide input, an unshared dense projector per layer costs 2.4M
|
| 190 |
+
parameters, 71M over the 30 layers.
|
| 191 |
+
|
| 192 |
+
### Block
|
| 193 |
+
|
| 194 |
+
Each block is a standard pre-norm transformer block with shift-free AdaLN
|
| 195 |
+
modulation and sandwich normalisation: an RMSNorm before and after both the
|
| 196 |
+
attention and the MLP branch. The modulation is a scale on the pre-norm output
|
| 197 |
+
and a tanh gate on the branch output:
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
z \leftarrow z + \tanh(\rho_{\mathrm{att}})\odot N_2\!\left(\operatorname{Attn}\!\left((1+\alpha_{\mathrm{att}})\odot N_1(z)\right)\right),
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
$$
|
| 204 |
+
z \leftarrow z + \tanh(\rho_{\mathrm{mlp}})\odot N_4\!\left(\operatorname{MLP}\!\left((1+\alpha_{\mathrm{mlp}})\odot N_3(z)\right)\right),
|
| 205 |
+
$$
|
| 206 |
+
|
| 207 |
+
where \\(z\\) is the token stream, \\(N_1\\) to \\(N_4\\) are RMSNorms with learned
|
| 208 |
+
weights, and \\(\alpha\\) and \\(\rho\\) are the layer's scales and gates from its
|
| 209 |
+
AdaLN projector. The modulation applies to every token in the stream, text
|
| 210 |
+
included. The two text-refiner blocks are the same block without modulation.
|
| 211 |
+
|
| 212 |
+
- **Attention:** fused bias-free QKV projection, RMSNorm on each head's queries
|
| 213 |
+
and keys, 3D RoPE, scaled dot-product attention, bias-free output projection.
|
| 214 |
+
- **MLP:** GELU, expansion ratio 4, with biases.
|
| 215 |
+
- **Output:** after the last block the image tokens pass through an RMSNorm, a
|
| 216 |
+
timestep scale and shift, and a linear head from 2304 to 96 channels that
|
| 217 |
+
predicts the velocity. The text tokens are dropped.
|
| 218 |
+
|
| 219 |
+
## SPRINT and path-drop guidance
|
| 220 |
+
|
| 221 |
+
The 30 image blocks are organised as in SPRINT (Park et al.).
|
| 222 |
+
[Dense SPRINT](#dense-sprint) describes what dflow_2b changes.
|
| 223 |
+
|
| 224 |
+
### Sparse middle
|
| 225 |
+
|
| 226 |
+
SPRINT splits a diffusion transformer into three parts. A short **prefix** runs
|
| 227 |
+
on every token. A long **middle** runs on a random subset: in the published
|
| 228 |
+
method 75% of the image tokens are dropped before the middle. A
|
| 229 |
+
short **suffix** again runs on every token. Between the middle and the suffix, a
|
| 230 |
+
**tail join** fuses the prefix output with the middle output, with a learned mask
|
| 231 |
+
token standing in at positions the middle did not process.
|
| 232 |
+
|
| 233 |
+
Most of the network's depth runs on a quarter of the tokens, which cuts
|
| 234 |
+
training cost. At inference the middle runs on all tokens. To close this gap
|
| 235 |
+
between training and inference, SPRINT finishes with a short fine-tuning stage
|
| 236 |
+
on all tokens.
|
| 237 |
+
|
| 238 |
+
### Path drop
|
| 239 |
+
|
| 240 |
+
For a fraction of the training samples the whole middle is skipped. The tail
|
| 241 |
+
join then receives the mask token at every position, and the output comes from
|
| 242 |
+
the prefix and suffix alone. This is called path drop. It trains a second,
|
| 243 |
+
shallower predictor inside the same weights.
|
| 244 |
+
|
| 245 |
+
### Path-drop guidance
|
| 246 |
+
|
| 247 |
+
Path-drop guidance (PDG) uses that shallow predictor as a guidance reference at
|
| 248 |
+
sampling time. Write \\(v_{\mathrm{full}}\\) for the prediction with every layer
|
| 249 |
+
and \\(v_{\mathrm{weak}}\\) for the prediction of the same network, same input and
|
| 250 |
+
same prompt, with the middle skipped. The guided velocity is
|
| 251 |
+
|
| 252 |
+
$$
|
| 253 |
+
v_{\mathrm{PDG}}
|
| 254 |
+
= v_{\mathrm{weak}} + w\left(v_{\mathrm{full}} - v_{\mathrm{weak}}\right),
|
| 255 |
+
$$
|
| 256 |
+
|
| 257 |
+
with scale \\(w \ge 1\\). Like autoguidance (Karras et al.), this extrapolates away
|
| 258 |
+
from a weaker version of the model itself, so it pushes along whatever the
|
| 259 |
+
skipped layers contribute. Both passes see the same prompt (the default weak
|
| 260 |
+
pass reads it with a [bias](#suffix-caption-bias)), so PDG works from the
|
| 261 |
+
prompt alone. The weak pass is cheap: in dflow_2b it runs 12 of the 30 image
|
| 262 |
+
blocks.
|
| 263 |
+
|
| 264 |
+
## Dense SPRINT
|
| 265 |
+
|
| 266 |
+
### What changed
|
| 267 |
+
|
| 268 |
+
dflow_2b keeps SPRINT's structure and its three routes through the middle, and
|
| 269 |
+
changes how often each is trained and how deep the outer parts are.
|
| 270 |
+
|
| 271 |
+
The layout is 6 prefix, 18 middle and 6 suffix blocks. Each training sample
|
| 272 |
+
takes one of three routes:
|
| 273 |
+
|
| 274 |
+
| Share of samples | Route | Middle runs on |
|
| 275 |
+
| ---: | --- | --- |
|
| 276 |
+
| 80% | Dense | every image and text token |
|
| 277 |
+
| 10% | Path drop | nothing; the middle is skipped |
|
| 278 |
+
| 10% | Three-quarter drop | one image token of each 2×2 group, chosen at random, and every text token |
|
| 279 |
+
|
| 280 |
+
A sparse mix trains most samples on the three-quarter route, for example 10%
|
| 281 |
+
dense, 10% path drop and 80% three-quarter drop. Here the middle is trained
|
| 282 |
+
mostly on full token grids from the first step. We call this arrangement dense
|
| 283 |
+
SPRINT.
|
| 284 |
+
|
| 285 |
+
Counting a block on all image tokens as 1 and a block on a quarter of them as
|
| 286 |
+
0.25, an average training sample costs about
|
| 287 |
+
\\(12 + 18\,(0.8 + 0.1\cdot 0.25) = 26.9\\) block evaluations. The sparse mix
|
| 288 |
+
above costs 17.4 on the same layout, and a network that runs every block on
|
| 289 |
+
every token costs 30. Dense SPRINT saves about 10% of the training compute and
|
| 290 |
+
that sparse mix about 40%.
|
| 291 |
+
|
| 292 |
+
### The tail join
|
| 293 |
+
|
| 294 |
+
Let \\(p\\) be the prefix output and \\(m\\) the middle output, both of width
|
| 295 |
+
\\(D = 2304\\). At rows the middle skipped, \\(m\\) is replaced by a learned mask
|
| 296 |
+
token \\(\mu\\); call the result \\(\tilde{m}\\). The join scales the two streams by
|
| 297 |
+
time-dependent gains, concatenates them and projects back to width \\(D\\). Rows
|
| 298 |
+
the middle skipped also receive a separate projection of the prefix stream:
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
z = W\left[\,(1+\gamma_p(t))\odot p \;;\; (1+\gamma_m(t))\odot \tilde{m}\,\right]
|
| 302 |
+
+ b + \chi\,R\left((1+\gamma_p(t))\odot p\right),
|
| 303 |
+
$$
|
| 304 |
+
|
| 305 |
+
where \\([\,\cdot\;;\;\cdot\,]\\) is concatenation along the channel axis.
|
| 306 |
+
|
| 307 |
+
| Symbol | Meaning |
|
| 308 |
+
| --- | --- |
|
| 309 |
+
| \\(p\\) | Prefix output for one token |
|
| 310 |
+
| \\(z\\) | Token entering the suffix |
|
| 311 |
+
| \\(\tilde{m}\\) | Middle output for that token, or the mask token \\(\mu\\) if the middle skipped it |
|
| 312 |
+
| \\(\gamma_p(t), \gamma_m(t)\\) | Gains of width \\(D\\) each, a linear function of \\(\operatorname{SiLU}(\tau(t))\\) |
|
| 313 |
+
| \\(W, b\\) | Projection from \\(2D\\) to \\(D\\) and its bias |
|
| 314 |
+
| \\(R\\) | Bias-free \\(D \times D\\) projection for skipped rows |
|
| 315 |
+
| \\(\chi\\) | 1 if the middle skipped the token, 0 otherwise |
|
| 316 |
+
|
| 317 |
+
Under path drop every row has \\(\chi = 1\\). Under the three-quarter route the
|
| 318 |
+
dropped image tokens have \\(\chi = 1\\) and the kept tokens and the text have
|
| 319 |
+
\\(\chi = 0\\). The extra projection \\(R\\) gives skipped rows weights of their own
|
| 320 |
+
for the prefix stream, and the time-dependent gains let the balance between the
|
| 321 |
+
two streams vary along the trajectory. In ablations against the plain
|
| 322 |
+
concatenation join of the original SPRINT, both gave a consistent improvement.
|
| 323 |
+
|
| 324 |
+
### Why train the middle dense
|
| 325 |
+
|
| 326 |
+
Sparse SPRINT gives good coherence and textures but struggles to place fine
|
| 327 |
+
detail and text precisely. Good detail never converges at low resolution and
|
| 328 |
+
still lags at high resolution. Training the middle mostly on all tokens
|
| 329 |
+
corrects this.
|
| 330 |
+
|
| 331 |
+
The two sparse routes stay in the mix for different reasons. The 10% path-drop
|
| 332 |
+
route trains the weak predictor of path-drop guidance, which works like
|
| 333 |
+
guidance by a weaker model and gives much better results than CFG. The 10%
|
| 334 |
+
three-quarter route acts as a regulariser and improves coherence and
|
| 335 |
+
convergence.
|
| 336 |
+
|
| 337 |
+
The weak predictor needs enough depth to be a useful guidance reference. The 2
|
| 338 |
+
to 4 outer blocks of the original SPRINT proved too few, and in ablations a weak
|
| 339 |
+
path of about a third of the main path's depth was the best compromise. dflow_2b
|
| 340 |
+
therefore has 6 prefix and 6 suffix blocks, 12 of its 30.
|
| 341 |
+
|
| 342 |
+
One drawback is that on the high-noise part of the trajectory, with \\(t\\) close
|
| 343 |
+
to 1, the full and path-drop predictions largely agree. This gives more
|
| 344 |
+
oversaturation than sparse SPRINT, which the
|
| 345 |
+
[self-attention gain](#self-attention-gain), a small increase of the attention
|
| 346 |
+
temperature, mitigates. Sparse SPRINT has much of the same issue and also
|
| 347 |
+
benefits from this softening.
|
| 348 |
+
|
| 349 |
+
### Alternatives that were tried
|
| 350 |
+
|
| 351 |
+
Two layouts that mix sparse and dense blocks inside the middle were tested in
|
| 352 |
+
small-scale experiments: one alternating two sparse blocks with one dense
|
| 353 |
+
block, and one with eight sparse blocks, a second join and four dense blocks.
|
| 354 |
+
Neither improved on the uniform middle that dflow_2b uses.
|
| 355 |
+
|
| 356 |
+
## Architecture summary
|
| 357 |
+
|
| 358 |
+
| Component | Setting |
|
| 359 |
+
| --- | --- |
|
| 360 |
+
| Latent | dinac3_96, 96 channels, stride 16, patch size 1 |
|
| 361 |
+
| Text encoder | T5Gemma 2 270M-270M encoder, layers 1–12, frozen |
|
| 362 |
+
| Text taps | After layers 2, 6 and 12, standardised per channel, three linear maps 640 → 2304, summed |
|
| 363 |
+
| Learned text tokens | 3 suffix tokens; 1 unconditional token for the null text |
|
| 364 |
+
| Maximum prompt length | 6,144 tokens |
|
| 365 |
+
| Width, heads | 2304; 18 heads of 128 |
|
| 366 |
+
| Text refiner | 2 blocks, text only, no timestep modulation |
|
| 367 |
+
| Image blocks | 30: 6 prefix, 18 middle, 6 suffix, joint self-attention over text and image |
|
| 368 |
+
| Attention | RMSNorm on queries and keys, bias-free projections |
|
| 369 |
+
| MLP | GELU, expansion ratio 4 |
|
| 370 |
+
| Position encoding | Centred 3D RoPE, 32/48/48 channels per head, base 10,000 |
|
| 371 |
+
| Timestep conditioning | 256-wide embedding; one projector per block to attention and MLP scales and gates |
|
| 372 |
+
| Tail join | Concatenation with time-dependent gains, mask token, separate prefix projection for skipped rows |
|
| 373 |
+
| Prediction | Velocity on the linear flow-matching path |
|
| 374 |
+
| Parameters | 2,133,866,592 |
|
| 375 |
+
|
| 376 |
+
## Sampling and guidance
|
| 377 |
+
|
| 378 |
+
### Default preset
|
| 379 |
+
|
| 380 |
+
| Setting | Default |
|
| 381 |
+
| --- | --- |
|
| 382 |
+
| Size | 832×1216 |
|
| 383 |
+
| Solver | ER-SDE, noise scale 1 |
|
| 384 |
+
| Schedule | 50 steps at the quantiles of Beta(1.25, 1.25) |
|
| 385 |
+
| Timestep shift | \\(s(A)\\), the training shift; −2.99 at 832×1216 |
|
| 386 |
+
| Guidance | PDG, constant scale 2.5, reference conditioned on the prompt with a −4 caption bias in its six suffix blocks |
|
| 387 |
+
| Classifier-free guidance | Off |
|
| 388 |
+
| Self-attention gain | −0.03 on the full pass, 0 on the reference pass |
|
| 389 |
+
|
| 390 |
+
The schedule places its 51 time points at equal-probability quantiles of a
|
| 391 |
+
Beta(1.25, 1.25) distribution, which is slightly denser in the middle of the
|
| 392 |
+
trajectory than a uniform grid, and then applies the shift \\(s(A)\\) from
|
| 393 |
+
[Flow matching](#flow-matching). Using the training shift at sampling time
|
| 394 |
+
means the sampler spends its steps where training placed its timesteps for that
|
| 395 |
+
image size.
|
| 396 |
+
|
| 397 |
+
ER-SDE (Cui et al.) is a stochastic solver for the reverse-time SDE; the release
|
| 398 |
+
uses its three-stage form. A noise scale of 1 is the solver's own noise level
|
| 399 |
+
and 0 makes it deterministic. The package also includes Euler, Euler–Maruyama,
|
| 400 |
+
DPM++ 2M, DPM++ 2M SDE and a two-stage Adams–Bashforth–Moulton solver.
|
| 401 |
+
|
| 402 |
+
Each step runs the full pass and the weak pass, so 50 steps are 100 denoiser
|
| 403 |
+
calls, of which the 50 weak calls run 12 of 30 blocks.
|
| 404 |
+
|
| 405 |
+
### Guidance formulas
|
| 406 |
+
|
| 407 |
+
With the prompt \\(c\\), scale \\(w\\), gain \\(g\\) and caption bias \\(b\\) defined below, the
|
| 408 |
+
default guided velocity is
|
| 409 |
+
|
| 410 |
+
$$
|
| 411 |
+
v = v_{\mathrm{weak}}(x_t, t, c;\, b)
|
| 412 |
+
+ w\left(v_{\mathrm{full}}(x_t, t, c;\, g) - v_{\mathrm{weak}}(x_t, t, c;\, b)\right),
|
| 413 |
+
\qquad w = 2.5,\; b = -4 .
|
| 414 |
+
$$
|
| 415 |
+
|
| 416 |
+
| Symbol | Meaning |
|
| 417 |
+
| --- | --- |
|
| 418 |
+
| \\(c\\) | Text conditioning of the prompt |
|
| 419 |
+
| \\(v_{\mathrm{full}}\\) | Prediction with all 30 image blocks |
|
| 420 |
+
| \\(v_{\mathrm{weak}}\\) | Prediction with the 18 middle blocks skipped |
|
| 421 |
+
| \\(w\\) | PDG scale; 1 is no guidance |
|
| 422 |
+
| \\(g\\) | Self-attention gain of the full pass |
|
| 423 |
+
| \\(b\\) | Caption bias of the weak pass, described under [Suffix caption bias](#suffix-caption-bias) |
|
| 424 |
+
|
| 425 |
+
### Self-attention gain
|
| 426 |
+
|
| 427 |
+
The gain \\(g\\) multiplies the queries of the 30 image blocks by \\(e^{g}\\) after
|
| 428 |
+
the query-key normalisation and RoPE. This divides every attention logit by a
|
| 429 |
+
temperature \\(e^{-g}\\), so a negative gain makes attention slightly more
|
| 430 |
+
diffuse.
|
| 431 |
+
|
| 432 |
+
The gain is applied to the full pass only. With \\(\delta\\) the change it makes to
|
| 433 |
+
the full prediction, PDG becomes
|
| 434 |
+
|
| 435 |
+
$$
|
| 436 |
+
v = v_{\mathrm{weak}} + w\left(v_{\mathrm{full}} - v_{\mathrm{weak}}\right) + w\,\delta ,
|
| 437 |
+
$$
|
| 438 |
+
|
| 439 |
+
so a small softening of the full pass reaches the output multiplied by the
|
| 440 |
+
guidance scale. The weak pass runs without the gain: the same change in both
|
| 441 |
+
passes would largely cancel in their difference. The gain counters the over-contrast and oversaturation that PDG adds, described
|
| 442 |
+
under [Why train the middle dense](#why-train-the-middle-dense), and reduces
|
| 443 |
+
structural errors with it.
|
| 444 |
+
|
| 445 |
+
The default of −0.03 suits images up to about one megapixel. Larger images need
|
| 446 |
+
a gain closer to 0, roughly linear in the logarithm of the area:
|
| 447 |
+
|
| 448 |
+
| Image area | Example sizes | Gain |
|
| 449 |
+
| --- | --- | --- |
|
| 450 |
+
| up to about 1.05 MP | 832×1216, 1216×832, 1024×1024 | −0.03 (default) |
|
| 451 |
+
| about 1.3 MP | 1536×832, 1216×1088 | −0.02 |
|
| 452 |
+
| about 1.6 MP | 1024×1536 | −0.015 |
|
| 453 |
+
| about 2.5 MP and above | 1280×1920 | 0 to −0.01 |
|
| 454 |
+
|
| 455 |
+
At about one megapixel, a gain closer to 0 gives oversaturation and more
|
| 456 |
+
structural defects. At larger sizes, too negative a gain gives washed-out
|
| 457 |
+
images.
|
| 458 |
+
|
| 459 |
+
### Suffix caption bias
|
| 460 |
+
|
| 461 |
+
By default the weak pass reads the prompt less in its six suffix blocks. In
|
| 462 |
+
those blocks every query, image or text, has a constant \\(b = -4\\) added to its
|
| 463 |
+
attention logits on the prompt's tokens:
|
| 464 |
+
|
| 465 |
+
$$
|
| 466 |
+
\ell_{ij} = \frac{q_i \cdot k_j}{\sqrt{d}} + b\,\chi_j .
|
| 467 |
+
$$
|
| 468 |
+
|
| 469 |
+
| Symbol | Meaning |
|
| 470 |
+
| --- | --- |
|
| 471 |
+
| \\(\ell_{ij}\\) | Attention logit of query \\(i\\) on key \\(j\\) |
|
| 472 |
+
| \\(q_i, k_j\\) | Normalised, rotated query and key of one head |
|
| 473 |
+
| \\(d\\) | Head width, 128 |
|
| 474 |
+
| \\(\chi_j\\) | 1 for a prompt token; 0 for image tokens and the three learned suffix tokens |
|
| 475 |
+
|
| 476 |
+
The bias applies on every step, to whichever text the weak pass reads: the
|
| 477 |
+
prompt in the default mode, the negative prompt or the null text in the
|
| 478 |
+
contrastive modes. The full pass and the CFG passes are unchanged. Because the
|
| 479 |
+
reference sees less of the prompt, more of the prompt's effect stays in
|
| 480 |
+
\\(v_{\mathrm{full}} - v_{\mathrm{weak}}\\) and is amplified by the guidance
|
| 481 |
+
scale. Prompt following improves, and colour and layout stay close to plain
|
| 482 |
+
PDG.
|
| 483 |
+
|
| 484 |
+
We also tried biasing the learned suffix tokens, biasing every block or only
|
| 485 |
+
part of the run, other bias strengths, contrastive and alternating references,
|
| 486 |
+
frequency-split guidance, CFG with skipped layers and projected guidance. In
|
| 487 |
+
blind side-by-side comparisons on 18 prompts with the released weights, the
|
| 488 |
+
biased reference was preferred on 16, with fewer anatomy errors and missed
|
| 489 |
+
prompt elements.
|
| 490 |
+
|
| 491 |
+
### Other guidance options
|
| 492 |
+
|
| 493 |
+
Contrastive PDG conditions the weak pass on a negative prompt, or on the
|
| 494 |
+
learned null text. It gives stronger guidance and less diversity, and we
|
| 495 |
+
generally prefer plain PDG. The [manual](MANUAL.md#guidance) describes it with
|
| 496 |
+
classifier-free guidance, scale ramps and curves, projected guidance and the
|
| 497 |
+
other options.
|
| 498 |
+
|
| 499 |
+
## Prompt emphasis
|
| 500 |
+
|
| 501 |
+
A phrase can be weighted with the markup `(phrase:weight)`. The weight
|
| 502 |
+
\\(\omega\\) is applied inside attention, with a global strength \\(\kappa\\) that
|
| 503 |
+
defaults to 1. For \\(\omega > 0\\), a bias is added to the attention logits of
|
| 504 |
+
every query towards the keys of the weighted tokens. The bias is
|
| 505 |
+
\\(\kappa \ln \omega\\) in the logarithmic mapping, which at \\(\kappa = 1\\)
|
| 506 |
+
multiplies those tokens' unnormalised attention weight by \\(\omega\\), or
|
| 507 |
+
\\(2\kappa(\omega - 1)\\) in the linear mapping. For \\(\omega \le 0\\), the tokens'
|
| 508 |
+
attention values are multiplied by \\(1 + \kappa(\omega - 1)\\), so 0 mutes them
|
| 509 |
+
and −1 subtracts them. The bias and scale apply in the text refiner and in all
|
| 510 |
+
30 image blocks, and optionally inside the text encoder's own attention.
|
| 511 |
+
Emphasis works on plain-text prompts only. A JSON layout is encoded exactly as
|
| 512 |
+
written, so parentheses and colons in its captions and text stay literal and
|
| 513 |
+
carry no weight.
|
| 514 |
+
|
| 515 |
+
## JSON layout prompts
|
| 516 |
+
|
| 517 |
+
The model was also trained on structured captions that describe an image as a
|
| 518 |
+
set of boxes. About 10% of the samples in the most recent training used one as
|
| 519 |
+
their caption.
|
| 520 |
+
|
| 521 |
+
A layout is a JSON object with three parts:
|
| 522 |
+
|
| 523 |
+
- `summary`: a list of `meta` tags, the `canvas` type and a `caption` of the
|
| 524 |
+
whole image;
|
| 525 |
+
- `frame`: a `caption`, `tags` and a colour `palette` for the canvas as a whole;
|
| 526 |
+
- `items`: a list of boxes. Each has a `label` (`character`, `object` or
|
| 527 |
+
`text`), an optional `caption`, `tags` and `palette`, and a box
|
| 528 |
+
`box_2d = [y0, x0, y1, x1]` on a 0–1000 scale. Text items also carry the exact
|
| 529 |
+
`text` to render.
|
| 530 |
+
|
| 531 |
+
The optional fields were dropped at random during training, so they can be
|
| 532 |
+
omitted.
|
| 533 |
+
|
| 534 |
+
Before encoding, a layout is compiled for the image size: the frame becomes a
|
| 535 |
+
first item covering the whole canvas, and every box is converted to pixels
|
| 536 |
+
measured from the image centre, the same origin as the denoiser's position
|
| 537 |
+
encoding. The compiled format follows the layout prompts of MOSS-Image. The
|
| 538 |
+
[manual](MANUAL.md#json-layouts) gives the format field by field and the
|
| 539 |
+
compilation rules.
|
| 540 |
+
|
| 541 |
+
## Training
|
| 542 |
+
|
| 543 |
+
### Objective
|
| 544 |
+
|
| 545 |
+
Each training sample draws a noise \\(\varepsilon\\), a time \\(t\\), a route \\(r\\)
|
| 546 |
+
through the middle and a possibly dropped caption \\(\tilde{c}\\), and contributes
|
| 547 |
+
a squared velocity error:
|
| 548 |
+
|
| 549 |
+
$$
|
| 550 |
+
\mathcal{L}
|
| 551 |
+
= \mathbb{E}_{x_0,\,\varepsilon,\,t,\,r,\,\tilde{c}}
|
| 552 |
+
\left\lVert v_\theta(x_t, t, \tilde{c};\, r) - (\varepsilon - x_0) \right\rVert_2^2 .
|
| 553 |
+
$$
|
| 554 |
+
|
| 555 |
+
| Symbol | Sampling |
|
| 556 |
+
| --- | --- |
|
| 557 |
+
| \\(t\\) | Beta(2, 2), then log-SNR shifted by \\(s(A) = \min\left(0,\, -0.25 - \ln\frac{A}{256^2}\right)\\) for the sample's pixel area \\(A\\): −0.25 at 256×256, −1.64 at 512×512, −2.99 at 832×1216 ([flow matching](#flow-matching)). 1% of samples are set to \\(t = 1\\) |
|
| 558 |
+
| \\(r\\) | Dense with probability 0.8, path drop 0.1, three-quarter drop 0.1 |
|
| 559 |
+
| \\(\tilde{c}\\) | The caption, replaced by the learned null text with probability 0.1 |
|
| 560 |
+
|
| 561 |
+
Every sample is one forward pass on one route, and the loss above is the whole
|
| 562 |
+
objective.
|
| 563 |
+
|
| 564 |
+
### Optimisation
|
| 565 |
+
|
| 566 |
+
| Setting | Value |
|
| 567 |
+
| --- | --- |
|
| 568 |
+
| Optimiser | Dion ([dionw](https://github.com/JTriggerFish/dionw) implementation) on the large weight matrices, AdamW on the remaining parameters |
|
| 569 |
+
| Learning rate | \\(5 \times 10^{-5}\\), linear warmup over 4,000 steps, then constant |
|
| 570 |
+
| AdamW betas | (0.9, 0.95) |
|
| 571 |
+
| Weight decay | 0.01 |
|
| 572 |
+
| Gradient clipping | Norm 1.0 |
|
| 573 |
+
| Batch size | 128, with gradient accumulation |
|
| 574 |
+
| Precision | bfloat16 autocast |
|
| 575 |
+
| EMA | Updated every 10 steps; half-life 4,000 steps, 2,000 from step 400,000 |
|
| 576 |
+
| Hardware | One GPU |
|
| 577 |
+
|
| 578 |
+
At 512 px a batch is accumulated over 4 micro-batches. At 1024 px it is
|
| 579 |
+
accumulated over 16, or over 24 when the batch contains very long captions.
|
| 580 |
+
|
| 581 |
+
For an EMA half-life of \\(T\\) steps and an update every 10 steps, each update
|
| 582 |
+
uses the decay \\(2^{-10/T}\\).
|
| 583 |
+
|
| 584 |
+
### Resolution stages
|
| 585 |
+
|
| 586 |
+
Training uses aspect-ratio buckets: each nominal resolution is a family of
|
| 587 |
+
landscape, square and portrait shapes of similar area, and every batch holds
|
| 588 |
+
images of one shape.
|
| 589 |
+
|
| 590 |
+
| Stage | Steps | Training images |
|
| 591 |
+
| --- | --- | ---: |
|
| 592 |
+
| 256 and 384 px buckets | 0 – 400,000 | about 21 million |
|
| 593 |
+
| 512 px buckets, with 10% of batches at 1024 px | 400,000 – 540,412 | about 20 million |
|
| 594 |
+
| 1024 px buckets | from 540,412 | about 10 million |
|
| 595 |
+
|
| 596 |
+
Structured layout captions were introduced in the 1024 px stage and make up
|
| 597 |
+
about 10% of its recent samples.
|
| 598 |
+
|
| 599 |
+
The released weights are the EMA at step 581,000.
|
| 600 |
+
|
| 601 |
+
## Limitations
|
| 602 |
+
|
| 603 |
+
- This is a preview of a model that is still training. Quality varies between
|
| 604 |
+
prompts and seeds, and later checkpoints will behave differently.
|
| 605 |
+
- Anatomy errors are common, in limbs and hands especially.
|
| 606 |
+
- Small text and long passages of text are unreliable.
|
| 607 |
+
- The model was trained on aspect-ratio buckets of about one megapixel. It is
|
| 608 |
+
less reliable at sizes far from those shapes and well above one megapixel. The
|
| 609 |
+
default guidance settings were tuned at 832×1216; larger images need a
|
| 610 |
+
self-attention gain closer to 0.
|
| 611 |
+
- The training data is mostly photographs and classical art, and other styles
|
| 612 |
+
are covered less well.
|
| 613 |
+
- A compiled layout prompt is valid for one image size only.
|
| 614 |
+
|
| 615 |
+
## References
|
| 616 |
+
|
| 617 |
+
### Flow matching
|
| 618 |
+
|
| 619 |
+
Lipman et al., “Flow Matching for Generative Modeling,” ICLR 2023.
|
| 620 |
+
[arXiv:2210.02747](https://arxiv.org/abs/2210.02747).
|
| 621 |
+
|
| 622 |
+
Liu et al., “Flow Straight and Fast: Learning to Generate and Transfer Data with
|
| 623 |
+
Rectified Flow,” ICLR 2023.
|
| 624 |
+
[arXiv:2209.03003](https://arxiv.org/abs/2209.03003).
|
| 625 |
+
|
| 626 |
+
### SPRINT and path-drop guidance
|
| 627 |
+
|
| 628 |
+
Park et al., “Sprint: Sparse-Dense Residual Fusion for Efficient Diffusion
|
| 629 |
+
Transformers,” 2025. [arXiv:2510.21986](https://arxiv.org/abs/2510.21986).
|
| 630 |
+
Path-drop guidance is introduced in the same paper.
|
| 631 |
+
|
| 632 |
+
### Autoguidance
|
| 633 |
+
|
| 634 |
+
Karras et al., “Guiding a Diffusion Model with a Bad Version of Itself,”
|
| 635 |
+
NeurIPS 2024. [arXiv:2406.02507](https://arxiv.org/abs/2406.02507).
|
| 636 |
+
|
| 637 |
+
### Classifier-free guidance
|
| 638 |
+
|
| 639 |
+
Ho and Salimans, “Classifier-Free Diffusion Guidance,” 2022.
|
| 640 |
+
[arXiv:2207.12598](https://arxiv.org/abs/2207.12598).
|
| 641 |
+
|
| 642 |
+
### Adaptive projected guidance
|
| 643 |
+
|
| 644 |
+
Sadat et al., “Eliminating Oversaturation and Artifacts of High Guidance Scales
|
| 645 |
+
in Diffusion Models,” ICLR 2025.
|
| 646 |
+
[arXiv:2410.02416](https://arxiv.org/abs/2410.02416).
|
| 647 |
+
|
| 648 |
+
### ER-SDE
|
| 649 |
+
|
| 650 |
+
Cui et al., “Elucidating the Solution Space of Extended Reverse-Time SDE for
|
| 651 |
+
Diffusion Models,” 2023. [arXiv:2309.06169](https://arxiv.org/abs/2309.06169).
|
| 652 |
+
|
| 653 |
+
### Rotary position embedding
|
| 654 |
+
|
| 655 |
+
Su et al., “RoFormer: Enhanced Transformer with Rotary Position Embedding,”
|
| 656 |
+
2021. [arXiv:2104.09864](https://arxiv.org/abs/2104.09864).
|
| 657 |
+
|
| 658 |
+
### Z-Image
|
| 659 |
+
|
| 660 |
+
Z-Image Team, “Z-Image: An Efficient Image Generation Foundation Model with
|
| 661 |
+
Single-Stream Diffusion Transformer,” 2025.
|
| 662 |
+
[arXiv:2511.22699](https://arxiv.org/abs/2511.22699).
|
| 663 |
+
|
| 664 |
+
### T5Gemma 2
|
| 665 |
+
|
| 666 |
+
Zhang et al., “T5Gemma 2: Seeing, Reading, and Understanding Longer,” 2025.
|
| 667 |
+
[arXiv:2512.14856](https://arxiv.org/abs/2512.14856).
|
| 668 |
+
[Model card](https://huggingface.co/google/t5gemma-2-270m-270m).
|
| 669 |
+
|
| 670 |
+
### LongCat-Image
|
| 671 |
+
|
| 672 |
+
Meituan LongCat Team, “LongCat-Image Technical Report,” 2025.
|
| 673 |
+
[arXiv:2512.07584](https://arxiv.org/abs/2512.07584).
|
| 674 |
+
|
| 675 |
+
### DINOv3 and dinac3_96
|
| 676 |
+
|
| 677 |
+
Siméoni et al., “DINOv3,” 2025.
|
| 678 |
+
[arXiv:2508.10104](https://arxiv.org/abs/2508.10104).
|
| 679 |
+
|
| 680 |
+
data-archetype, “dinac3_96,” 2026.
|
| 681 |
+
[Model and technical report](https://huggingface.co/data-archetype/dinac3_96).
|
| 682 |
+
|
| 683 |
+
### Dion
|
| 684 |
+
|
| 685 |
+
Ahn et al., “Dion: Distributed Orthonormalized Updates,” 2025.
|
| 686 |
+
[arXiv:2504.05295](https://arxiv.org/abs/2504.05295).
|
| 687 |
+
|
| 688 |
+
Our implementation, used for training:
|
| 689 |
+
[github.com/JTriggerFish/dionw](https://github.com/JTriggerFish/dionw).
|
| 690 |
+
|
| 691 |
+
### AdamW
|
| 692 |
+
|
| 693 |
+
Loshchilov and Hutter, “Decoupled Weight Decay Regularization,” ICLR 2019.
|
| 694 |
+
[arXiv:1711.05101](https://arxiv.org/abs/1711.05101).
|
| 695 |
+
|
| 696 |
+
### MOSS-Image
|
| 697 |
+
|
| 698 |
+
MOSI.AI, “MOSS-Image Technical Report,” 2026.
|
| 699 |
+
[arXiv:2610.23374](https://arxiv.org/abs/2610.23374).
|
__init__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""ComfyUI entry point of the dflow_2b repository (installed as its root
|
| 4 |
+
``__init__.py``).
|
| 5 |
+
|
| 6 |
+
ComfyUI imports the repository folder as a package and reads
|
| 7 |
+
``NODE_CLASS_MAPPINGS``, ``NODE_DISPLAY_NAME_MAPPINGS`` and ``WEB_DIRECTORY``.
|
| 8 |
+
Outside a package (a pip build, or a test run collecting this file) nothing
|
| 9 |
+
is imported, so ``comfy`` is never required there.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
if __package__:
|
| 13 |
+
from .comfyui.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
| 14 |
+
|
| 15 |
+
WEB_DIRECTORY = "./comfyui/web"
|
| 16 |
+
|
| 17 |
+
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
|
assets/gallery/army.png
ADDED
|
Git LFS Details
|
assets/gallery/beetle.png
ADDED
|
Git LFS Details
|
assets/gallery/boardwalk.png
ADDED
|
Git LFS Details
|
assets/gallery/cat_grass.png
ADDED
|
Git LFS Details
|
assets/gallery/closet.png
ADDED
|
Git LFS Details
|
assets/gallery/collier.png
ADDED
|
Git LFS Details
|
assets/gallery/constable.png
ADDED
|
Git LFS Details
|
assets/gallery/hokusai.png
ADDED
|
Git LFS Details
|
assets/gallery/larson.png
ADDED
|
Git LFS Details
|
assets/gallery/leopard.png
ADDED
|
Git LFS Details
|
assets/gallery/man.png
ADDED
|
Git LFS Details
|
assets/gallery/man_outside.png
ADDED
|
Git LFS Details
|
assets/gallery/marina.png
ADDED
|
Git LFS Details
|
assets/gallery/nissan.png
ADDED
|
Git LFS Details
|
assets/gallery/poster_film.png
ADDED
|
Git LFS Details
|
assets/gallery/poster_jazz.png
ADDED
|
Git LFS Details
|
assets/gallery/poster_travel.png
ADDED
|
Git LFS Details
|
assets/gallery/red_perfume.png
ADDED
|
Git LFS Details
|
assets/gallery/renoir.png
ADDED
|
Git LFS Details
|
assets/gallery/rooster.png
ADDED
|
Git LFS Details
|
assets/gallery/rousseau.png
ADDED
|
Git LFS Details
|
assets/gallery/snail.png
ADDED
|
Git LFS Details
|
assets/gallery/station.png
ADDED
|
Git LFS Details
|
assets/gallery/still_woman.png
ADDED
|
Git LFS Details
|
assets/gallery/street.png
ADDED
|
Git LFS Details
|
assets/gallery/wahlberg.png
ADDED
|
Git LFS Details
|
assets/gallery/weenix.png
ADDED
|
Git LFS Details
|
comfyui/LICENSE
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 635 |
+
Copyright (C) <year> <name of author>
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
<program> Copyright (C) <year> <name of author>
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<https://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
comfyui/NOTICE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
dflow_2b ComfyUI nodes
|
| 2 |
+
Copyright 2026 Data Archetype
|
| 3 |
+
|
| 4 |
+
The files in this comfyui/ folder and the repository's root __init__.py (the
|
| 5 |
+
ComfyUI entry point) are licensed under the GNU General Public License,
|
| 6 |
+
version 3 (GPL-3.0). See LICENSE in this folder.
|
| 7 |
+
|
| 8 |
+
Everything else in this repository, including the model weights, the dflow/
|
| 9 |
+
Python package, the documentation and the gallery images, is licensed under
|
| 10 |
+
the ModelGo Attribution-NonCommercial License 2.0 (MG-BY-NC-2.0); see the
|
| 11 |
+
LICENSE and NOTICE files at the repository root. The bundled T5Gemma2 text
|
| 12 |
+
encoder remains under the Gemma terms, and the dinac3_96 autoencoder, which is
|
| 13 |
+
downloaded separately, under its own licence.
|
| 14 |
+
|
| 15 |
+
The nodes call the dflow package through its public API at run time. The GPL
|
| 16 |
+
covers the node code only; it does not change the licence of the weights or
|
| 17 |
+
of the dflow package.
|
comfyui/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""ComfyUI nodes for dflow_2b (GPL-3.0; see LICENSE and NOTICE here).
|
| 4 |
+
|
| 5 |
+
The node classes are in ``nodes``; the repository root's ``__init__.py``
|
| 6 |
+
registers them with ComfyUI. This folder calls only the public API of the
|
| 7 |
+
``dflow`` package next to it.
|
| 8 |
+
"""
|
comfyui/loader.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""Where the loader node finds the release, and loading it.
|
| 4 |
+
|
| 5 |
+
The node folder is the Hugging Face repository checkout, so the default
|
| 6 |
+
source is the folder itself. A clone without its large files holds Git LFS
|
| 7 |
+
pointer files instead; the loader detects them and says how to download the
|
| 8 |
+
weights.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import TYPE_CHECKING
|
| 15 |
+
|
| 16 |
+
from ..dflow.loading import CONFIG_FILENAME, MODEL_FILENAME, RELEASE_FILENAME
|
| 17 |
+
from ..dflow.pipeline import REPOSITORY, TEXT_ENCODER_DIRNAME, DFlowComponents
|
| 18 |
+
from ..dflow.preview import LatentRgbPreview
|
| 19 |
+
from .types import DFlowModelHandle, DFlowWeightSource
|
| 20 |
+
|
| 21 |
+
if TYPE_CHECKING:
|
| 22 |
+
import torch
|
| 23 |
+
|
| 24 |
+
NODE_FOLDER = Path(__file__).parents[1]
|
| 25 |
+
"""The custom-node folder (the repository root)."""
|
| 26 |
+
|
| 27 |
+
BUNDLED_FILES = (
|
| 28 |
+
CONFIG_FILENAME,
|
| 29 |
+
RELEASE_FILENAME,
|
| 30 |
+
MODEL_FILENAME,
|
| 31 |
+
f"{TEXT_ENCODER_DIRNAME}/config.json",
|
| 32 |
+
f"{TEXT_ENCODER_DIRNAME}/model.safetensors",
|
| 33 |
+
f"{TEXT_ENCODER_DIRNAME}/tokenizer.json",
|
| 34 |
+
)
|
| 35 |
+
"""Release files the bundled source needs, relative to the node folder."""
|
| 36 |
+
|
| 37 |
+
_LFS_POINTER_PREFIX = b"version https://git-lfs.github.com/spec/"
|
| 38 |
+
# Git LFS pointer files are about 130 bytes; real release files are larger.
|
| 39 |
+
_LFS_POINTER_MAX_BYTES = 1024
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def is_lfs_pointer(path: Path) -> bool:
|
| 43 |
+
"""Whether ``path`` is a Git LFS pointer file instead of its content."""
|
| 44 |
+
|
| 45 |
+
if path.stat().st_size > _LFS_POINTER_MAX_BYTES:
|
| 46 |
+
return False
|
| 47 |
+
with path.open("rb") as handle:
|
| 48 |
+
return handle.read(len(_LFS_POINTER_PREFIX)) == _LFS_POINTER_PREFIX
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def bundled_release_dir(folder: Path = NODE_FOLDER) -> Path:
|
| 52 |
+
"""Return the node folder after checking it holds the release files.
|
| 53 |
+
|
| 54 |
+
Raises:
|
| 55 |
+
FileNotFoundError: If a file is missing or is a Git LFS pointer; the
|
| 56 |
+
message gives the download command.
|
| 57 |
+
"""
|
| 58 |
+
|
| 59 |
+
missing = [name for name in BUNDLED_FILES if not (folder / name).is_file()]
|
| 60 |
+
pointers = [
|
| 61 |
+
name
|
| 62 |
+
for name in BUNDLED_FILES
|
| 63 |
+
if name not in missing and is_lfs_pointer(folder / name)
|
| 64 |
+
]
|
| 65 |
+
if missing or pointers:
|
| 66 |
+
problems = [f"missing {name}" for name in missing] + [
|
| 67 |
+
f"{name} is a Git LFS pointer" for name in pointers
|
| 68 |
+
]
|
| 69 |
+
raise FileNotFoundError(
|
| 70 |
+
f"The dflow_2b weights are not in the node folder {folder} "
|
| 71 |
+
f"({'; '.join(problems)}). Download them with:\n"
|
| 72 |
+
f" hf download {REPOSITORY} --local-dir {folder}\n"
|
| 73 |
+
"or choose the hub source in DFlow Loader."
|
| 74 |
+
)
|
| 75 |
+
return folder
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def release_location(
|
| 79 |
+
source: DFlowWeightSource, *, local_dir: str, repository: str
|
| 80 |
+
) -> Path | str:
|
| 81 |
+
"""The release directory or Hub repository a source reads.
|
| 82 |
+
|
| 83 |
+
Each source reads only its own field: BUNDLED neither, LOCAL_DIR
|
| 84 |
+
``local_dir``, HUB ``repository``.
|
| 85 |
+
|
| 86 |
+
Raises:
|
| 87 |
+
FileNotFoundError: For missing bundled files or local directory.
|
| 88 |
+
ValueError: For an empty field the source needs.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
match source:
|
| 92 |
+
case DFlowWeightSource.BUNDLED:
|
| 93 |
+
return bundled_release_dir()
|
| 94 |
+
case DFlowWeightSource.LOCAL_DIR:
|
| 95 |
+
if not local_dir.strip():
|
| 96 |
+
raise ValueError("The local_dir source needs local_dir.")
|
| 97 |
+
path = Path(local_dir.strip()).expanduser()
|
| 98 |
+
if not path.is_dir():
|
| 99 |
+
raise FileNotFoundError(f"No release directory at {path}.")
|
| 100 |
+
return path
|
| 101 |
+
case DFlowWeightSource.HUB:
|
| 102 |
+
if not repository.strip():
|
| 103 |
+
raise ValueError("The hub source needs a repository id.")
|
| 104 |
+
return repository.strip()
|
| 105 |
+
case _ as unreachable:
|
| 106 |
+
raise ValueError(f"Unsupported weight source: {unreachable}")
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def load_model(
|
| 110 |
+
location: Path | str,
|
| 111 |
+
*,
|
| 112 |
+
device: torch.device,
|
| 113 |
+
compile_model: bool,
|
| 114 |
+
revision: str | None,
|
| 115 |
+
cache_dir: Path | None,
|
| 116 |
+
) -> DFlowModelHandle:
|
| 117 |
+
"""Load the release and the preview projection onto ``device``."""
|
| 118 |
+
|
| 119 |
+
components = DFlowComponents.from_pretrained(
|
| 120 |
+
location,
|
| 121 |
+
device=device,
|
| 122 |
+
compile=compile_model,
|
| 123 |
+
revision=revision,
|
| 124 |
+
cache_dir=cache_dir,
|
| 125 |
+
)
|
| 126 |
+
return DFlowModelHandle(
|
| 127 |
+
components=components, preview=LatentRgbPreview.bundled().to(device)
|
| 128 |
+
)
|
comfyui/nodes.py
ADDED
|
@@ -0,0 +1,941 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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flow_2b.
|
| 4 |
+
|
| 5 |
+
A graph is: DFlow Loader -> DFlow Text Encode (or Layout Encode) -> DFlow
|
| 6 |
+
Guider; DFlow Sampler -> DFlow Time Schedule; DFlow Empty Latent; then the
|
| 7 |
+
stock RandomNoise, SamplerCustomAdvanced, VAEDecode and SaveImage nodes. Every
|
| 8 |
+
default is the release's default preset (``dflow.inference.GenerationSettings``).
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from dataclasses import replace
|
| 14 |
+
from enum import StrEnum
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
from typing import Protocol
|
| 17 |
+
|
| 18 |
+
import comfy.model_management
|
| 19 |
+
import torch
|
| 20 |
+
from torch import Tensor
|
| 21 |
+
|
| 22 |
+
from ..dflow.guidance import (
|
| 23 |
+
SELF_ATTENTION_GAIN_MAX,
|
| 24 |
+
SELF_ATTENTION_GAIN_MIN,
|
| 25 |
+
SUFFIX_CAPTION_BIAS_MAX,
|
| 26 |
+
SUFFIX_CAPTION_BIAS_MIN,
|
| 27 |
+
BezierPdgCurve,
|
| 28 |
+
CfgGuidance,
|
| 29 |
+
ConstantPdgScale,
|
| 30 |
+
EndpointCurveKind,
|
| 31 |
+
EndpointPdgCurve,
|
| 32 |
+
GuidanceSettings,
|
| 33 |
+
PdgGuidance,
|
| 34 |
+
PdgMode,
|
| 35 |
+
PdgScaleSchedule,
|
| 36 |
+
ProjectedGuidance,
|
| 37 |
+
ProjectionMode,
|
| 38 |
+
RampPdgScale,
|
| 39 |
+
SparseMiddleSteps,
|
| 40 |
+
SparseStepSchedule,
|
| 41 |
+
StepWindow,
|
| 42 |
+
)
|
| 43 |
+
from ..dflow.inference import (
|
| 44 |
+
DEFAULT_HEIGHT,
|
| 45 |
+
DEFAULT_WIDTH,
|
| 46 |
+
GenerationSettings,
|
| 47 |
+
SamplingSettings,
|
| 48 |
+
)
|
| 49 |
+
from ..dflow.layout import compile_layout, is_compiled_layout, is_stored_layout
|
| 50 |
+
from ..dflow.prompt_emphasis import EmphasisMapping, EmphasisSettings
|
| 51 |
+
from ..dflow.schedules import ScheduleKind, TimeSchedule
|
| 52 |
+
from ..dflow.solvers import Solver
|
| 53 |
+
from ..dflow.vae import LATENT_CHANNELS, LATENT_STRIDE
|
| 54 |
+
from .loader import load_model, release_location
|
| 55 |
+
from .preview import build_model_patcher
|
| 56 |
+
from .sampling import DFlowGuider
|
| 57 |
+
from .types import (
|
| 58 |
+
DFlowConditioning,
|
| 59 |
+
DFlowLatent,
|
| 60 |
+
DFlowModelHandle,
|
| 61 |
+
DFlowSamplerSpec,
|
| 62 |
+
DFlowTextEncoderHandle,
|
| 63 |
+
DFlowWeightSource,
|
| 64 |
+
PdgCurveChoice,
|
| 65 |
+
ScheduleBinding,
|
| 66 |
+
)
|
| 67 |
+
from .vae import DFlowVaeAdapter
|
| 68 |
+
|
| 69 |
+
type InputTypes = dict[str, dict[str, tuple[object, ...]]]
|
| 70 |
+
|
| 71 |
+
CATEGORY = "DFlow"
|
| 72 |
+
MAX_BATCH = 16
|
| 73 |
+
MAX_SIDE = 8192
|
| 74 |
+
MAX_STEP_INDEX = 9999
|
| 75 |
+
OPEN_STOP_STEP = -1
|
| 76 |
+
"""A stop step of -1 runs a guidance window to the last step."""
|
| 77 |
+
|
| 78 |
+
# Release defaults, read from the package so the nodes cannot drift from it.
|
| 79 |
+
_GENERATION = GenerationSettings()
|
| 80 |
+
_SAMPLING: SamplingSettings = _GENERATION.sampling
|
| 81 |
+
_GUIDANCE: GuidanceSettings = _GENERATION.guidance
|
| 82 |
+
_PDG = PdgGuidance()
|
| 83 |
+
_PDG_SCALE = ConstantPdgScale().scale
|
| 84 |
+
_EMPHASIS = EmphasisSettings()
|
| 85 |
+
_ENDPOINT = EndpointPdgCurve()
|
| 86 |
+
_RAMP = RampPdgScale()
|
| 87 |
+
_BEZIER = BezierPdgCurve()
|
| 88 |
+
_PROJECTION = ProjectedGuidance()
|
| 89 |
+
_SPARSE = SparseMiddleSteps()
|
| 90 |
+
_CFG_SCALE = 4.0
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def _choices[E: StrEnum](
|
| 94 |
+
members: type[E], default: E, tooltip: str
|
| 95 |
+
) -> tuple[object, ...]:
|
| 96 |
+
"""A combo input listing an enum's values."""
|
| 97 |
+
|
| 98 |
+
return (
|
| 99 |
+
[member.value for member in members],
|
| 100 |
+
{"default": default.value, "tooltip": tooltip},
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def _float(
|
| 105 |
+
default: float, low: float, high: float, step: float, tooltip: str
|
| 106 |
+
) -> tuple[object, ...]:
|
| 107 |
+
"""A FLOAT input."""
|
| 108 |
+
|
| 109 |
+
return (
|
| 110 |
+
"FLOAT",
|
| 111 |
+
{
|
| 112 |
+
"default": default,
|
| 113 |
+
"min": low,
|
| 114 |
+
"max": high,
|
| 115 |
+
"step": step,
|
| 116 |
+
"round": False,
|
| 117 |
+
"tooltip": tooltip,
|
| 118 |
+
},
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
def _int(default: int, low: int, high: int, tooltip: str) -> tuple[object, ...]:
|
| 123 |
+
"""An INT input."""
|
| 124 |
+
|
| 125 |
+
return (
|
| 126 |
+
"INT",
|
| 127 |
+
{"default": default, "min": low, "max": high, "step": 1, "tooltip": tooltip},
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def _bool(default: bool, tooltip: str) -> tuple[object, ...]:
|
| 132 |
+
"""A BOOLEAN input."""
|
| 133 |
+
|
| 134 |
+
return ("BOOLEAN", {"default": default, "tooltip": tooltip})
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def _side(default: int, tooltip: str) -> tuple[object, ...]:
|
| 138 |
+
"""An image side in pixels, a multiple of 16."""
|
| 139 |
+
|
| 140 |
+
return (
|
| 141 |
+
"INT",
|
| 142 |
+
{
|
| 143 |
+
"default": default,
|
| 144 |
+
"min": LATENT_STRIDE,
|
| 145 |
+
"max": MAX_SIDE,
|
| 146 |
+
"step": LATENT_STRIDE,
|
| 147 |
+
"tooltip": tooltip,
|
| 148 |
+
},
|
| 149 |
+
)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def _window(start: int, stop: int) -> StepWindow:
|
| 153 |
+
"""A guidance step window; ``stop`` -1 is open-ended.
|
| 154 |
+
|
| 155 |
+
Raises:
|
| 156 |
+
ValueError: For a stop below -1 or before the start.
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
if stop < OPEN_STOP_STEP:
|
| 160 |
+
raise ValueError(f"A stop step must be -1 or a step index, got {stop}.")
|
| 161 |
+
return StepWindow(start, None if stop == OPEN_STOP_STEP else stop)
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def _latent_size(latent: DFlowLatent) -> tuple[int, int]:
|
| 165 |
+
"""``(width, height)`` in pixels of a dflow latent.
|
| 166 |
+
|
| 167 |
+
Raises:
|
| 168 |
+
ValueError: If the latent does not have 96 channels.
|
| 169 |
+
"""
|
| 170 |
+
|
| 171 |
+
samples = latent["samples"]
|
| 172 |
+
if samples.ndim != 4 or int(samples.shape[1]) != LATENT_CHANNELS:
|
| 173 |
+
raise ValueError(
|
| 174 |
+
f"Expected a dflow latent [batch, {LATENT_CHANNELS}, height, width] "
|
| 175 |
+
f"(DFlow Empty Latent); got {tuple(samples.shape)}."
|
| 176 |
+
)
|
| 177 |
+
return int(samples.shape[3]) * LATENT_STRIDE, int(samples.shape[2]) * LATENT_STRIDE
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
def _encode(
|
| 181 |
+
encoder: DFlowTextEncoderHandle,
|
| 182 |
+
prompts: tuple[str, ...],
|
| 183 |
+
emphasis: EmphasisSettings | None,
|
| 184 |
+
) -> DFlowConditioning:
|
| 185 |
+
"""Encode and refine a prompt batch (as ``DFlowEngine.prepare_texts``)."""
|
| 186 |
+
|
| 187 |
+
engine = encoder.model.engine
|
| 188 |
+
with torch.inference_mode():
|
| 189 |
+
text = engine.model.prepare_text(
|
| 190 |
+
engine.text_encoder.encode(list(prompts), emphasis=emphasis)
|
| 191 |
+
)
|
| 192 |
+
return DFlowConditioning(
|
| 193 |
+
model=encoder.model, prompts=prompts, text=text, emphasis=emphasis
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def _cfg(
|
| 198 |
+
enabled: bool, scale: float, window: StepWindow, pdg: PdgGuidance | None
|
| 199 |
+
) -> CfgGuidance:
|
| 200 |
+
"""CFG settings; the scale is kept when CFG or a CFG-using PDG mode runs."""
|
| 201 |
+
|
| 202 |
+
needed = enabled or (pdg is not None and pdg.mode.uses_cfg)
|
| 203 |
+
return CfgGuidance(enabled=enabled, scale=scale if needed else None, window=window)
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def _dflow_guider(guider: object) -> DFlowGuider:
|
| 207 |
+
"""The dflow guider behind a GUIDER input.
|
| 208 |
+
|
| 209 |
+
Raises:
|
| 210 |
+
TypeError: For a guider of another node pack.
|
| 211 |
+
"""
|
| 212 |
+
|
| 213 |
+
match guider:
|
| 214 |
+
case DFlowGuider():
|
| 215 |
+
return guider
|
| 216 |
+
case _:
|
| 217 |
+
raise TypeError(
|
| 218 |
+
f"Expected the guider of DFlow Guider, got {type(guider).__name__}."
|
| 219 |
+
)
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
def _dflow_sampler(sampler: object) -> DFlowSamplerSpec:
|
| 223 |
+
"""The dflow sampler behind a SAMPLER input.
|
| 224 |
+
|
| 225 |
+
Raises:
|
| 226 |
+
TypeError: For a sampler of another node pack.
|
| 227 |
+
"""
|
| 228 |
+
|
| 229 |
+
match sampler:
|
| 230 |
+
case DFlowSamplerSpec():
|
| 231 |
+
return sampler
|
| 232 |
+
case _:
|
| 233 |
+
raise TypeError(
|
| 234 |
+
f"Expected the sampler of DFlow Sampler, got {type(sampler).__name__}."
|
| 235 |
+
)
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
class DFlowLoader:
|
| 239 |
+
"""Load the dflow_2b denoiser, text encoder and dinac3_96 autoencoder."""
|
| 240 |
+
|
| 241 |
+
DESCRIPTION = (
|
| 242 |
+
"bundled reads the weights in this node folder; local_dir another "
|
| 243 |
+
"release folder; hub a Hugging Face repository at a revision. The "
|
| 244 |
+
"autoencoder downloads from data-archetype/dinac3_96 on first use. "
|
| 245 |
+
"compile_model compiles the blocks (30 to 45 seconds on first use)."
|
| 246 |
+
)
|
| 247 |
+
RETURN_TYPES = ("DFLOW_MODEL", "DFLOW_TEXT_ENCODER", "VAE")
|
| 248 |
+
RETURN_NAMES = ("model", "text_encoder", "vae")
|
| 249 |
+
FUNCTION = "load"
|
| 250 |
+
CATEGORY = CATEGORY
|
| 251 |
+
|
| 252 |
+
@classmethod
|
| 253 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 254 |
+
"""Source, its location fields, compile switch and cache directory."""
|
| 255 |
+
|
| 256 |
+
return {
|
| 257 |
+
"required": {
|
| 258 |
+
"source": _choices(
|
| 259 |
+
DFlowWeightSource,
|
| 260 |
+
DFlowWeightSource.BUNDLED,
|
| 261 |
+
"Where the weights are read from.",
|
| 262 |
+
),
|
| 263 |
+
"local_dir": (
|
| 264 |
+
"STRING",
|
| 265 |
+
{"default": "", "tooltip": "Release folder (local_dir only)."},
|
| 266 |
+
),
|
| 267 |
+
"repository": (
|
| 268 |
+
"STRING",
|
| 269 |
+
{
|
| 270 |
+
"default": "data-archetype/dflow_2b",
|
| 271 |
+
"tooltip": "Hugging Face repository (hub only).",
|
| 272 |
+
},
|
| 273 |
+
),
|
| 274 |
+
"revision": (
|
| 275 |
+
"STRING",
|
| 276 |
+
{"default": "", "tooltip": "Hub revision; empty for main."},
|
| 277 |
+
),
|
| 278 |
+
"compile_model": _bool(True, "torch.compile the model (faster)."),
|
| 279 |
+
"cache_dir": (
|
| 280 |
+
"STRING",
|
| 281 |
+
{"default": "", "tooltip": "Hugging Face cache; empty: default."},
|
| 282 |
+
),
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
def load(
|
| 287 |
+
self,
|
| 288 |
+
*,
|
| 289 |
+
source: str,
|
| 290 |
+
local_dir: str,
|
| 291 |
+
repository: str,
|
| 292 |
+
revision: str,
|
| 293 |
+
compile_model: bool,
|
| 294 |
+
cache_dir: str,
|
| 295 |
+
) -> tuple[DFlowModelHandle, DFlowTextEncoderHandle, DFlowVaeAdapter]:
|
| 296 |
+
"""Load the release onto ComfyUI's torch device."""
|
| 297 |
+
|
| 298 |
+
device = comfy.model_management.get_torch_device()
|
| 299 |
+
model = load_model(
|
| 300 |
+
release_location(
|
| 301 |
+
DFlowWeightSource(source), local_dir=local_dir, repository=repository
|
| 302 |
+
),
|
| 303 |
+
device=device,
|
| 304 |
+
compile_model=compile_model,
|
| 305 |
+
revision=revision.strip() or None,
|
| 306 |
+
cache_dir=Path(cache_dir.strip()).expanduser()
|
| 307 |
+
if cache_dir.strip()
|
| 308 |
+
else None,
|
| 309 |
+
)
|
| 310 |
+
return (
|
| 311 |
+
model,
|
| 312 |
+
DFlowTextEncoderHandle(model),
|
| 313 |
+
DFlowVaeAdapter(model.components.vae, device=device),
|
| 314 |
+
)
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
class DFlowTextEncode:
|
| 318 |
+
"""Encode a prompt with the bundled text encoder."""
|
| 319 |
+
|
| 320 |
+
DESCRIPTION = (
|
| 321 |
+
"Plain prompts and compiled layout prompts. (phrase:weight) markup "
|
| 322 |
+
"weights a phrase when emphasis is on; quoted text is spelled out "
|
| 323 |
+
"character by character. Use DFlow Layout Encode for stored layouts."
|
| 324 |
+
)
|
| 325 |
+
RETURN_TYPES = ("DFLOW_CONDITIONING",)
|
| 326 |
+
RETURN_NAMES = ("conditioning",)
|
| 327 |
+
FUNCTION = "encode"
|
| 328 |
+
CATEGORY = f"{CATEGORY}/conditioning"
|
| 329 |
+
|
| 330 |
+
@classmethod
|
| 331 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 332 |
+
"""Text, batch size and the prompt-emphasis settings."""
|
| 333 |
+
|
| 334 |
+
return {
|
| 335 |
+
"required": {
|
| 336 |
+
"text_encoder": ("DFLOW_TEXT_ENCODER",),
|
| 337 |
+
"text": ("STRING", {"default": "", "multiline": True}),
|
| 338 |
+
"batch_size": _int(1, 1, MAX_BATCH, "Copies of the prompt."),
|
| 339 |
+
"emphasis": _bool(True, "Apply (phrase:weight) markup."),
|
| 340 |
+
"emphasis_mapping": _choices(
|
| 341 |
+
EmphasisMapping,
|
| 342 |
+
_EMPHASIS.mapping,
|
| 343 |
+
"Weight to attention-bias mapping for weights above 0.",
|
| 344 |
+
),
|
| 345 |
+
"emphasis_strength": _float(
|
| 346 |
+
_EMPHASIS.strength, 0.0, 4.0, 0.05, "Multiplier on every weight."
|
| 347 |
+
),
|
| 348 |
+
"emphasis_encoder": _bool(
|
| 349 |
+
_EMPHASIS.encoder, "Also weight inside the text encoder."
|
| 350 |
+
),
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
def encode(
|
| 355 |
+
self,
|
| 356 |
+
*,
|
| 357 |
+
text_encoder: DFlowTextEncoderHandle,
|
| 358 |
+
text: str,
|
| 359 |
+
batch_size: int,
|
| 360 |
+
emphasis: bool,
|
| 361 |
+
emphasis_mapping: str,
|
| 362 |
+
emphasis_strength: float,
|
| 363 |
+
emphasis_encoder: bool,
|
| 364 |
+
) -> tuple[DFlowConditioning]:
|
| 365 |
+
"""Encode ``batch_size`` copies of the prompt.
|
| 366 |
+
|
| 367 |
+
Raises:
|
| 368 |
+
ValueError: For a stored layout (it needs the image size).
|
| 369 |
+
"""
|
| 370 |
+
|
| 371 |
+
if is_stored_layout(text):
|
| 372 |
+
raise ValueError(
|
| 373 |
+
"This is a stored layout; use DFlow Layout Encode, which compiles "
|
| 374 |
+
"it at the image size."
|
| 375 |
+
)
|
| 376 |
+
settings = (
|
| 377 |
+
EmphasisSettings(
|
| 378 |
+
mapping=EmphasisMapping(emphasis_mapping),
|
| 379 |
+
strength=emphasis_strength,
|
| 380 |
+
encoder=emphasis_encoder,
|
| 381 |
+
)
|
| 382 |
+
if emphasis
|
| 383 |
+
else None
|
| 384 |
+
)
|
| 385 |
+
return (_encode(text_encoder, (text,) * batch_size, settings),)
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
class DFlowLayoutEncode:
|
| 389 |
+
"""Compile a stored layout at the image size and encode it."""
|
| 390 |
+
|
| 391 |
+
DESCRIPTION = (
|
| 392 |
+
"Takes the stored layout JSON (summary, frame, items with box_2d on a "
|
| 393 |
+
"0-1000 grid) or a compiled layout. width and height must match the "
|
| 394 |
+
"latent; the guider checks it."
|
| 395 |
+
)
|
| 396 |
+
RETURN_TYPES = ("DFLOW_CONDITIONING",)
|
| 397 |
+
RETURN_NAMES = ("conditioning",)
|
| 398 |
+
FUNCTION = "encode"
|
| 399 |
+
CATEGORY = f"{CATEGORY}/conditioning"
|
| 400 |
+
|
| 401 |
+
@classmethod
|
| 402 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 403 |
+
"""Layout JSON, image size and batch size."""
|
| 404 |
+
|
| 405 |
+
return {
|
| 406 |
+
"required": {
|
| 407 |
+
"text_encoder": ("DFLOW_TEXT_ENCODER",),
|
| 408 |
+
"layout_json": ("STRING", {"default": "", "multiline": True}),
|
| 409 |
+
"width": _side(DEFAULT_WIDTH, "Image width the layout is for."),
|
| 410 |
+
"height": _side(DEFAULT_HEIGHT, "Image height the layout is for."),
|
| 411 |
+
"batch_size": _int(1, 1, MAX_BATCH, "Copies of the prompt."),
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
def encode(
|
| 416 |
+
self,
|
| 417 |
+
*,
|
| 418 |
+
text_encoder: DFlowTextEncoderHandle,
|
| 419 |
+
layout_json: str,
|
| 420 |
+
width: int,
|
| 421 |
+
height: int,
|
| 422 |
+
batch_size: int,
|
| 423 |
+
) -> tuple[DFlowConditioning]:
|
| 424 |
+
"""Compile (or size-check) the layout and encode it verbatim.
|
| 425 |
+
|
| 426 |
+
Raises:
|
| 427 |
+
ValueError: If the text is not a layout, or for a malformed layout.
|
| 428 |
+
"""
|
| 429 |
+
|
| 430 |
+
if not (is_stored_layout(layout_json) or is_compiled_layout(layout_json)):
|
| 431 |
+
raise ValueError(
|
| 432 |
+
"layout_json is not a layout (a JSON object with summary and "
|
| 433 |
+
"items); use DFlow Text Encode for plain prompts."
|
| 434 |
+
)
|
| 435 |
+
compiled = compile_layout(layout_json, width, height)
|
| 436 |
+
return (_encode(text_encoder, (compiled,) * batch_size, None),)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
class DFlowGuiderNode:
|
| 440 |
+
"""Path-drop guidance (PDG), CFG and the self-attention gain."""
|
| 441 |
+
|
| 442 |
+
DESCRIPTION = (
|
| 443 |
+
"PDG compares the model with a copy that skips its middle layers. The "
|
| 444 |
+
"optional negative is read by CFG and the contrastive PDG modes; "
|
| 445 |
+
"without it they use the learned null text. The PDG reference reads "
|
| 446 |
+
"the prompt with a negative attention bias in its last six layers "
|
| 447 |
+
"(pdg_suffix_caption_bias). Step windows count solver steps from 0; a "
|
| 448 |
+
"stop step of -1 runs to the end."
|
| 449 |
+
)
|
| 450 |
+
RETURN_TYPES = ("GUIDER",)
|
| 451 |
+
RETURN_NAMES = ("guider",)
|
| 452 |
+
FUNCTION = "build"
|
| 453 |
+
CATEGORY = f"{CATEGORY}/sampling"
|
| 454 |
+
|
| 455 |
+
@classmethod
|
| 456 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 457 |
+
"""PDG, CFG, windows, the PDG suffix caption bias and the gain;
|
| 458 |
+
defaults are the release preset."""
|
| 459 |
+
|
| 460 |
+
return {
|
| 461 |
+
"required": {
|
| 462 |
+
"model": ("DFLOW_MODEL",),
|
| 463 |
+
"positive": ("DFLOW_CONDITIONING",),
|
| 464 |
+
"pdg_enabled": _bool(_GUIDANCE.pdg is not None, "Path-drop guidance."),
|
| 465 |
+
"pdg_mode": _choices(PdgMode, _PDG.mode, "PDG reference policy."),
|
| 466 |
+
"pdg_scale": _float(
|
| 467 |
+
_PDG_SCALE, 0.0, 30.0, 0.05, "PDG scale (1: none)."
|
| 468 |
+
),
|
| 469 |
+
"pdg_start_step": _int(0, 0, MAX_STEP_INDEX, "First PDG step."),
|
| 470 |
+
"pdg_stop_step": _int(
|
| 471 |
+
OPEN_STOP_STEP, OPEN_STOP_STEP, MAX_STEP_INDEX, "Last PDG step."
|
| 472 |
+
),
|
| 473 |
+
"pdg_suffix_caption_bias": _float(
|
| 474 |
+
_PDG.suffix_caption_bias,
|
| 475 |
+
SUFFIX_CAPTION_BIAS_MIN,
|
| 476 |
+
SUFFIX_CAPTION_BIAS_MAX,
|
| 477 |
+
0.25,
|
| 478 |
+
"Attention-logit bias on the prompt's keys in the suffix layers "
|
| 479 |
+
"of the PDG reference (0: none).",
|
| 480 |
+
),
|
| 481 |
+
"cfg_enabled": _bool(
|
| 482 |
+
_GUIDANCE.cfg.enabled, "Classifier-free guidance."
|
| 483 |
+
),
|
| 484 |
+
"cfg_scale": _float(
|
| 485 |
+
_CFG_SCALE, 0.0, 30.0, 0.05, "CFG scale; also the CFG modes'."
|
| 486 |
+
),
|
| 487 |
+
"cfg_start_step": _int(0, 0, MAX_STEP_INDEX, "First CFG step."),
|
| 488 |
+
"cfg_stop_step": _int(
|
| 489 |
+
OPEN_STOP_STEP, OPEN_STOP_STEP, MAX_STEP_INDEX, "Last CFG step."
|
| 490 |
+
),
|
| 491 |
+
"self_attention_gain": _float(
|
| 492 |
+
_GUIDANCE.self_attention_gain,
|
| 493 |
+
SELF_ATTENTION_GAIN_MIN,
|
| 494 |
+
SELF_ATTENTION_GAIN_MAX,
|
| 495 |
+
0.005,
|
| 496 |
+
"Image self-attention logit gain of the main pass.",
|
| 497 |
+
),
|
| 498 |
+
},
|
| 499 |
+
"optional": {"negative": ("DFLOW_CONDITIONING",)},
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
def build(
|
| 503 |
+
self,
|
| 504 |
+
*,
|
| 505 |
+
model: DFlowModelHandle,
|
| 506 |
+
positive: DFlowConditioning,
|
| 507 |
+
pdg_enabled: bool,
|
| 508 |
+
pdg_mode: str,
|
| 509 |
+
pdg_scale: float,
|
| 510 |
+
pdg_start_step: int,
|
| 511 |
+
pdg_stop_step: int,
|
| 512 |
+
pdg_suffix_caption_bias: float,
|
| 513 |
+
cfg_enabled: bool,
|
| 514 |
+
cfg_scale: float,
|
| 515 |
+
cfg_start_step: int,
|
| 516 |
+
cfg_stop_step: int,
|
| 517 |
+
self_attention_gain: float,
|
| 518 |
+
negative: DFlowConditioning | None = None,
|
| 519 |
+
) -> tuple[DFlowGuider]:
|
| 520 |
+
"""Build the guider."""
|
| 521 |
+
|
| 522 |
+
pdg = (
|
| 523 |
+
PdgGuidance(
|
| 524 |
+
mode=PdgMode(pdg_mode),
|
| 525 |
+
scale=ConstantPdgScale(pdg_scale),
|
| 526 |
+
window=_window(pdg_start_step, pdg_stop_step),
|
| 527 |
+
suffix_caption_bias=pdg_suffix_caption_bias,
|
| 528 |
+
)
|
| 529 |
+
if pdg_enabled
|
| 530 |
+
else None
|
| 531 |
+
)
|
| 532 |
+
guidance = GuidanceSettings(
|
| 533 |
+
pdg=pdg,
|
| 534 |
+
cfg=_cfg(
|
| 535 |
+
cfg_enabled, cfg_scale, _window(cfg_start_step, cfg_stop_step), pdg
|
| 536 |
+
),
|
| 537 |
+
self_attention_gain=self_attention_gain,
|
| 538 |
+
)
|
| 539 |
+
return (_guider(model, positive, negative, guidance),)
|
| 540 |
+
|
| 541 |
+
|
| 542 |
+
def _guider(
|
| 543 |
+
model: DFlowModelHandle,
|
| 544 |
+
positive: DFlowConditioning,
|
| 545 |
+
negative: DFlowConditioning | None,
|
| 546 |
+
guidance: GuidanceSettings,
|
| 547 |
+
) -> DFlowGuider:
|
| 548 |
+
"""A guider with the model's preview patcher."""
|
| 549 |
+
|
| 550 |
+
return DFlowGuider(
|
| 551 |
+
model=model,
|
| 552 |
+
positive=positive,
|
| 553 |
+
negative=negative,
|
| 554 |
+
guidance=guidance,
|
| 555 |
+
model_patcher=build_model_patcher(model.preview, device=model.device),
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
class DFlowGuiderAdvanced:
|
| 560 |
+
"""Extra guidance controls on top of a DFlow Guider."""
|
| 561 |
+
|
| 562 |
+
DESCRIPTION = (
|
| 563 |
+
"pdg_curve replaces the constant PDG scale: ramp goes from "
|
| 564 |
+
"ramp_start_scale to ramp_end_scale over the first ramp_length of the "
|
| 565 |
+
"schedule; the endpoint curves go from curve_noisy_scale to "
|
| 566 |
+
"curve_clean_scale; bezier is 1 + bezier_multiplier times a fitted "
|
| 567 |
+
"curve. Projected guidance (APG) and rescale tame over-saturation and "
|
| 568 |
+
"exclude each other. Sparse middle steps run the main pass with one "
|
| 569 |
+
"token per 2x2 group through the middle layers (faster)."
|
| 570 |
+
)
|
| 571 |
+
RETURN_TYPES = ("GUIDER",)
|
| 572 |
+
RETURN_NAMES = ("guider",)
|
| 573 |
+
FUNCTION = "build"
|
| 574 |
+
CATEGORY = f"{CATEGORY}/sampling"
|
| 575 |
+
|
| 576 |
+
@classmethod
|
| 577 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 578 |
+
"""Curve, APG, rescale, sparse-step and guidance-gain controls."""
|
| 579 |
+
|
| 580 |
+
return {
|
| 581 |
+
"required": {
|
| 582 |
+
"guider": ("GUIDER",),
|
| 583 |
+
"guidance_self_attention_gain": _float(
|
| 584 |
+
_GUIDANCE.guidance_self_attention_gain,
|
| 585 |
+
SELF_ATTENTION_GAIN_MIN,
|
| 586 |
+
SELF_ATTENTION_GAIN_MAX,
|
| 587 |
+
0.005,
|
| 588 |
+
"Self-attention gain of the guidance passes.",
|
| 589 |
+
),
|
| 590 |
+
"pdg_curve": _choices(
|
| 591 |
+
PdgCurveChoice, PdgCurveChoice.CONSTANT, "PDG scale schedule."
|
| 592 |
+
),
|
| 593 |
+
"curve_noisy_scale": _float(
|
| 594 |
+
_ENDPOINT.noisy_scale, 0.0, 30.0, 0.05, "Scale at the first step."
|
| 595 |
+
),
|
| 596 |
+
"curve_clean_scale": _float(
|
| 597 |
+
_ENDPOINT.clean_scale, 0.0, 30.0, 0.05, "Scale at the last step."
|
| 598 |
+
),
|
| 599 |
+
"curve_power": _float(_ENDPOINT.power, 0.01, 20.0, 0.05, "power."),
|
| 600 |
+
"s_curve_knee": _float(
|
| 601 |
+
_ENDPOINT.s_curve_knee, 0.0, 1.0, 0.01, "s_curve midpoint."
|
| 602 |
+
),
|
| 603 |
+
"s_curve_sharpness": _float(
|
| 604 |
+
_ENDPOINT.s_curve_sharpness, 0.01, 50.0, 0.1, "s_curve slope."
|
| 605 |
+
),
|
| 606 |
+
"ramp_start_scale": _float(
|
| 607 |
+
_RAMP.start_scale, 0.0, 30.0, 0.05, "Ramp scale at the noisy end."
|
| 608 |
+
),
|
| 609 |
+
"ramp_end_scale": _float(
|
| 610 |
+
_RAMP.end_scale, 0.0, 30.0, 0.05, "Ramp scale after the ramp."
|
| 611 |
+
),
|
| 612 |
+
"ramp_length": _float(
|
| 613 |
+
_RAMP.length, 0.01, 1.0, 0.01, "Fraction of the schedule."
|
| 614 |
+
),
|
| 615 |
+
"bezier_multiplier": _float(
|
| 616 |
+
_BEZIER.multiplier, 0.0, 30.0, 0.05, "Bezier curve height."
|
| 617 |
+
),
|
| 618 |
+
"projection": _choices(
|
| 619 |
+
ProjectionMode, _PROJECTION.mode, "Projected guidance (APG)."
|
| 620 |
+
),
|
| 621 |
+
"projection_parallel_weight": _float(
|
| 622 |
+
_PROJECTION.parallel_weight, 0.0, 1.0, 0.01, "APG parallel part."
|
| 623 |
+
),
|
| 624 |
+
"projection_first_band": _int(
|
| 625 |
+
_PROJECTION.first_band, 0, 4, "per_band: first projected band."
|
| 626 |
+
),
|
| 627 |
+
"rescale": _float(
|
| 628 |
+
_GUIDANCE.rescale, 0.0, 1.0, 0.01, "Guidance rescale (0: off)."
|
| 629 |
+
),
|
| 630 |
+
"sparse_middle_percent": _float(
|
| 631 |
+
_SPARSE.percent, 0.0, 100.0, 1.0, "Percent of sparse steps."
|
| 632 |
+
),
|
| 633 |
+
"sparse_middle_schedule": _choices(
|
| 634 |
+
SparseStepSchedule, _SPARSE.schedule, "Which steps are sparse."
|
| 635 |
+
),
|
| 636 |
+
}
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
def build(
|
| 640 |
+
self,
|
| 641 |
+
*,
|
| 642 |
+
guider: object,
|
| 643 |
+
guidance_self_attention_gain: float,
|
| 644 |
+
pdg_curve: str,
|
| 645 |
+
curve_noisy_scale: float,
|
| 646 |
+
curve_clean_scale: float,
|
| 647 |
+
curve_power: float,
|
| 648 |
+
s_curve_knee: float,
|
| 649 |
+
s_curve_sharpness: float,
|
| 650 |
+
ramp_start_scale: float,
|
| 651 |
+
ramp_end_scale: float,
|
| 652 |
+
ramp_length: float,
|
| 653 |
+
bezier_multiplier: float,
|
| 654 |
+
projection: str,
|
| 655 |
+
projection_parallel_weight: float,
|
| 656 |
+
projection_first_band: int,
|
| 657 |
+
rescale: float,
|
| 658 |
+
sparse_middle_percent: float,
|
| 659 |
+
sparse_middle_schedule: str,
|
| 660 |
+
) -> tuple[DFlowGuider]:
|
| 661 |
+
"""Return the input guider with these settings applied.
|
| 662 |
+
|
| 663 |
+
Raises:
|
| 664 |
+
TypeError: For a guider of another node pack.
|
| 665 |
+
ValueError: For a PDG curve with PDG off, or invalid settings.
|
| 666 |
+
"""
|
| 667 |
+
|
| 668 |
+
base = _dflow_guider(guider)
|
| 669 |
+
curve = PdgCurveChoice(pdg_curve)
|
| 670 |
+
endpoint = EndpointPdgCurve(
|
| 671 |
+
kind=EndpointCurveKind.POWER,
|
| 672 |
+
noisy_scale=curve_noisy_scale,
|
| 673 |
+
clean_scale=curve_clean_scale,
|
| 674 |
+
power=curve_power,
|
| 675 |
+
s_curve_knee=s_curve_knee,
|
| 676 |
+
s_curve_sharpness=s_curve_sharpness,
|
| 677 |
+
)
|
| 678 |
+
ramp = RampPdgScale(ramp_start_scale, ramp_end_scale, ramp_length)
|
| 679 |
+
settings = replace(
|
| 680 |
+
base.guidance,
|
| 681 |
+
pdg=_with_curve(
|
| 682 |
+
base.guidance.pdg, curve, endpoint, ramp, bezier_multiplier
|
| 683 |
+
),
|
| 684 |
+
guidance_self_attention_gain=guidance_self_attention_gain,
|
| 685 |
+
projection=ProjectedGuidance(
|
| 686 |
+
mode=ProjectionMode(projection),
|
| 687 |
+
parallel_weight=projection_parallel_weight,
|
| 688 |
+
first_band=projection_first_band,
|
| 689 |
+
),
|
| 690 |
+
rescale=rescale,
|
| 691 |
+
sparse_middle=SparseMiddleSteps(
|
| 692 |
+
percent=sparse_middle_percent,
|
| 693 |
+
schedule=SparseStepSchedule(sparse_middle_schedule),
|
| 694 |
+
),
|
| 695 |
+
)
|
| 696 |
+
return (base.with_guidance(settings),)
|
| 697 |
+
|
| 698 |
+
|
| 699 |
+
def _with_curve(
|
| 700 |
+
pdg: PdgGuidance | None,
|
| 701 |
+
curve: PdgCurveChoice,
|
| 702 |
+
endpoint: EndpointPdgCurve,
|
| 703 |
+
ramp: RampPdgScale,
|
| 704 |
+
bezier_multiplier: float,
|
| 705 |
+
) -> PdgGuidance | None:
|
| 706 |
+
"""``pdg`` with its scale schedule replaced by the chosen curve.
|
| 707 |
+
|
| 708 |
+
Raises:
|
| 709 |
+
ValueError: For a curve other than constant while PDG is off.
|
| 710 |
+
"""
|
| 711 |
+
|
| 712 |
+
if pdg is None:
|
| 713 |
+
if curve is not PdgCurveChoice.CONSTANT:
|
| 714 |
+
raise ValueError(f"pdg_curve {curve.value} needs PDG on in the guider.")
|
| 715 |
+
return None
|
| 716 |
+
scale: PdgScaleSchedule
|
| 717 |
+
match curve:
|
| 718 |
+
case PdgCurveChoice.CONSTANT:
|
| 719 |
+
scale = pdg.scale
|
| 720 |
+
case PdgCurveChoice.RAMP:
|
| 721 |
+
scale = ramp
|
| 722 |
+
case (
|
| 723 |
+
PdgCurveChoice.LINEAR
|
| 724 |
+
| PdgCurveChoice.LINEAR_LOGSNR
|
| 725 |
+
| PdgCurveChoice.POWER
|
| 726 |
+
| PdgCurveChoice.S_CURVE
|
| 727 |
+
):
|
| 728 |
+
scale = replace(endpoint, kind=EndpointCurveKind(curve.value))
|
| 729 |
+
case PdgCurveChoice.BEZIER:
|
| 730 |
+
scale = BezierPdgCurve(multiplier=bezier_multiplier)
|
| 731 |
+
case _ as unreachable:
|
| 732 |
+
raise ValueError(f"Unsupported PDG curve: {unreachable}")
|
| 733 |
+
return replace(pdg, scale=scale)
|
| 734 |
+
|
| 735 |
+
|
| 736 |
+
class DFlowSampler:
|
| 737 |
+
"""Choose dflow's solver and its noise scale."""
|
| 738 |
+
|
| 739 |
+
DESCRIPTION = (
|
| 740 |
+
"noise_scale multiplies the injected noise of the stochastic solvers "
|
| 741 |
+
"(eta for dpmpp_2m_sde); deterministic solvers ignore it. Connect it "
|
| 742 |
+
"to DFlow Time Schedule, whose sampler output goes to "
|
| 743 |
+
"SamplerCustomAdvanced."
|
| 744 |
+
)
|
| 745 |
+
RETURN_TYPES = ("SAMPLER",)
|
| 746 |
+
RETURN_NAMES = ("sampler",)
|
| 747 |
+
FUNCTION = "build"
|
| 748 |
+
CATEGORY = f"{CATEGORY}/sampling"
|
| 749 |
+
|
| 750 |
+
@classmethod
|
| 751 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 752 |
+
"""Solver and noise scale."""
|
| 753 |
+
|
| 754 |
+
return {
|
| 755 |
+
"required": {
|
| 756 |
+
"solver": _choices(Solver, _SAMPLING.solver, "Numerical solver."),
|
| 757 |
+
"noise_scale": _float(
|
| 758 |
+
_SAMPLING.noise_scale, 0.0, 10.0, 0.05, "SDE noise multiplier."
|
| 759 |
+
),
|
| 760 |
+
}
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
def build(self, *, solver: str, noise_scale: float) -> tuple[DFlowSamplerSpec]:
|
| 764 |
+
"""The sampler, not yet paired with a schedule."""
|
| 765 |
+
|
| 766 |
+
return (DFlowSamplerSpec(Solver(solver), noise_scale, binding=None),)
|
| 767 |
+
|
| 768 |
+
|
| 769 |
+
def _schedule_inputs(steps_min: int) -> dict[str, tuple[object, ...]]:
|
| 770 |
+
"""Inputs shared by the schedule nodes."""
|
| 771 |
+
|
| 772 |
+
schedule = _SAMPLING.schedule
|
| 773 |
+
return {
|
| 774 |
+
"sampler": ("SAMPLER",),
|
| 775 |
+
"latent": ("LATENT",),
|
| 776 |
+
"schedule": _choices(ScheduleKind, schedule.kind, "Step spacing."),
|
| 777 |
+
"steps": _int(schedule.steps, steps_min, 1000, "Solver steps."),
|
| 778 |
+
"base_log_snr_shift": _float(
|
| 779 |
+
_SAMPLING.base_log_snr_shift, -20.0, 20.0, 0.05, "Size-free shift."
|
| 780 |
+
),
|
| 781 |
+
"resolution_shift": _bool(
|
| 782 |
+
_SAMPLING.resolution_shift, "Add the trained image-size shift."
|
| 783 |
+
),
|
| 784 |
+
"beta_mean": _float(schedule.beta_mean, 0.01, 0.99, 0.01, "custom_beta."),
|
| 785 |
+
"beta_concentration": _float(
|
| 786 |
+
schedule.beta_concentration, 0.01, 100.0, 0.05, "custom_beta."
|
| 787 |
+
),
|
| 788 |
+
}
|
| 789 |
+
|
| 790 |
+
|
| 791 |
+
def _full_schedule(
|
| 792 |
+
sampler: object,
|
| 793 |
+
latent: DFlowLatent,
|
| 794 |
+
schedule: TimeSchedule,
|
| 795 |
+
base_log_snr_shift: float,
|
| 796 |
+
resolution_shift: bool,
|
| 797 |
+
) -> tuple[Tensor, DFlowSamplerSpec]:
|
| 798 |
+
"""The full CPU schedule for the latent's size and the bound sampler.
|
| 799 |
+
|
| 800 |
+
The schedule is computed on the model's device, as the package does, then
|
| 801 |
+
copied to the CPU.
|
| 802 |
+
"""
|
| 803 |
+
|
| 804 |
+
spec = _dflow_sampler(sampler)
|
| 805 |
+
width, height = _latent_size(latent)
|
| 806 |
+
sampling = SamplingSettings(
|
| 807 |
+
solver=spec.solver,
|
| 808 |
+
noise_scale=spec.noise_scale,
|
| 809 |
+
schedule=schedule,
|
| 810 |
+
base_log_snr_shift=base_log_snr_shift,
|
| 811 |
+
resolution_shift=resolution_shift,
|
| 812 |
+
)
|
| 813 |
+
device = comfy.model_management.get_torch_device()
|
| 814 |
+
sigmas = sampling.timesteps(width, height, device).cpu()
|
| 815 |
+
binding = ScheduleBinding(
|
| 816 |
+
schedule=schedule,
|
| 817 |
+
log_snr_shift=sampling.log_snr_shift(width, height),
|
| 818 |
+
width=width,
|
| 819 |
+
height=height,
|
| 820 |
+
)
|
| 821 |
+
return sigmas, spec.bound(binding)
|
| 822 |
+
|
| 823 |
+
|
| 824 |
+
class DFlowTimeSchedule:
|
| 825 |
+
"""Build dflow's timestep schedule for the latent's size."""
|
| 826 |
+
|
| 827 |
+
DESCRIPTION = (
|
| 828 |
+
"Connect both outputs to SamplerCustomAdvanced. The shift moves steps "
|
| 829 |
+
"toward the noisy end; with resolution_shift the trained image-size "
|
| 830 |
+
"term -ln(width*height/256^2) is added (capped at 0)."
|
| 831 |
+
)
|
| 832 |
+
RETURN_TYPES = ("SIGMAS", "SAMPLER")
|
| 833 |
+
RETURN_NAMES = ("sigmas", "sampler")
|
| 834 |
+
FUNCTION = "build"
|
| 835 |
+
CATEGORY = f"{CATEGORY}/sampling"
|
| 836 |
+
|
| 837 |
+
@classmethod
|
| 838 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 839 |
+
"""Sampler, latent, schedule family, steps and shift."""
|
| 840 |
+
|
| 841 |
+
return {"required": _schedule_inputs(steps_min=1)}
|
| 842 |
+
|
| 843 |
+
def build(
|
| 844 |
+
self,
|
| 845 |
+
*,
|
| 846 |
+
sampler: object,
|
| 847 |
+
latent: DFlowLatent,
|
| 848 |
+
schedule: str,
|
| 849 |
+
steps: int,
|
| 850 |
+
base_log_snr_shift: float,
|
| 851 |
+
resolution_shift: bool,
|
| 852 |
+
beta_mean: float,
|
| 853 |
+
beta_concentration: float,
|
| 854 |
+
) -> tuple[Tensor, DFlowSamplerSpec]:
|
| 855 |
+
"""The schedule and the sampler paired with it."""
|
| 856 |
+
|
| 857 |
+
return _full_schedule(
|
| 858 |
+
sampler,
|
| 859 |
+
latent,
|
| 860 |
+
TimeSchedule(ScheduleKind(schedule), steps, beta_mean, beta_concentration),
|
| 861 |
+
base_log_snr_shift,
|
| 862 |
+
resolution_shift,
|
| 863 |
+
)
|
| 864 |
+
|
| 865 |
+
|
| 866 |
+
class DFlowEmptyLatent:
|
| 867 |
+
"""An empty 96-channel dflow latent."""
|
| 868 |
+
|
| 869 |
+
RETURN_TYPES = ("LATENT",)
|
| 870 |
+
RETURN_NAMES = ("latent",)
|
| 871 |
+
FUNCTION = "create"
|
| 872 |
+
CATEGORY = f"{CATEGORY}/latent"
|
| 873 |
+
|
| 874 |
+
@classmethod
|
| 875 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 876 |
+
"""Image size and batch size."""
|
| 877 |
+
|
| 878 |
+
return {
|
| 879 |
+
"required": {
|
| 880 |
+
"width": _side(_GENERATION.width, "Image width (multiple of 16)."),
|
| 881 |
+
"height": _side(_GENERATION.height, "Image height (multiple of 16)."),
|
| 882 |
+
"batch_size": _int(1, 1, MAX_BATCH, "Images per run."),
|
| 883 |
+
}
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
def create(self, *, width: int, height: int, batch_size: int) -> tuple[DFlowLatent]:
|
| 887 |
+
"""Zeros ``[batch, 96, height / 16, width / 16]`` on the CPU.
|
| 888 |
+
|
| 889 |
+
Raises:
|
| 890 |
+
ValueError: For a side that is not a multiple of 16.
|
| 891 |
+
"""
|
| 892 |
+
|
| 893 |
+
for name, value in (("width", width), ("height", height)):
|
| 894 |
+
if value <= 0 or value % LATENT_STRIDE:
|
| 895 |
+
raise ValueError(
|
| 896 |
+
f"{name} must be a positive multiple of {LATENT_STRIDE}, "
|
| 897 |
+
f"got {value}."
|
| 898 |
+
)
|
| 899 |
+
samples = torch.zeros(
|
| 900 |
+
(
|
| 901 |
+
batch_size,
|
| 902 |
+
LATENT_CHANNELS,
|
| 903 |
+
height // LATENT_STRIDE,
|
| 904 |
+
width // LATENT_STRIDE,
|
| 905 |
+
),
|
| 906 |
+
dtype=torch.float32,
|
| 907 |
+
device="cpu",
|
| 908 |
+
)
|
| 909 |
+
return ({"samples": samples, "downscale_ratio_spacial": LATENT_STRIDE},)
|
| 910 |
+
|
| 911 |
+
|
| 912 |
+
class ComfyNodeClass(Protocol):
|
| 913 |
+
"""What ComfyUI reads from a node class (beyond its declared constants)."""
|
| 914 |
+
|
| 915 |
+
@classmethod
|
| 916 |
+
def INPUT_TYPES(cls) -> InputTypes: # noqa: N802 (ComfyUI API)
|
| 917 |
+
"""The node's inputs."""
|
| 918 |
+
...
|
| 919 |
+
|
| 920 |
+
|
| 921 |
+
NODE_CLASS_MAPPINGS: dict[str, type[ComfyNodeClass]] = {
|
| 922 |
+
"DFlowLoader": DFlowLoader,
|
| 923 |
+
"DFlowTextEncode": DFlowTextEncode,
|
| 924 |
+
"DFlowLayoutEncode": DFlowLayoutEncode,
|
| 925 |
+
"DFlowGuider": DFlowGuiderNode,
|
| 926 |
+
"DFlowGuiderAdvanced": DFlowGuiderAdvanced,
|
| 927 |
+
"DFlowSampler": DFlowSampler,
|
| 928 |
+
"DFlowTimeSchedule": DFlowTimeSchedule,
|
| 929 |
+
"DFlowEmptyLatent": DFlowEmptyLatent,
|
| 930 |
+
}
|
| 931 |
+
|
| 932 |
+
NODE_DISPLAY_NAME_MAPPINGS: dict[str, str] = {
|
| 933 |
+
"DFlowLoader": "DFlow Loader",
|
| 934 |
+
"DFlowTextEncode": "DFlow Text Encode",
|
| 935 |
+
"DFlowLayoutEncode": "DFlow Layout Encode",
|
| 936 |
+
"DFlowGuider": "DFlow Guider",
|
| 937 |
+
"DFlowGuiderAdvanced": "DFlow Guider Advanced",
|
| 938 |
+
"DFlowSampler": "DFlow Sampler",
|
| 939 |
+
"DFlowTimeSchedule": "DFlow Time Schedule",
|
| 940 |
+
"DFlowEmptyLatent": "DFlow Empty Latent",
|
| 941 |
+
}
|
comfyui/preview.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""Live sampling previews and the minimal model surface ComfyUI's custom
|
| 4 |
+
sampler node reads from a guider.
|
| 5 |
+
|
| 6 |
+
ComfyUI's ``Latent2RGBPreviewer`` applies a per-pixel linear map after an
|
| 7 |
+
optional reshape hook. dflow's preview is a 3x3 convolution to 2x2 RGB cells,
|
| 8 |
+
so the hook runs that projection and the linear map is the identity.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from typing import TYPE_CHECKING
|
| 14 |
+
|
| 15 |
+
from comfy.latent_formats import LatentFormat
|
| 16 |
+
|
| 17 |
+
from ..dflow.vae import LATENT_CHANNELS, LATENT_STRIDE
|
| 18 |
+
|
| 19 |
+
if TYPE_CHECKING:
|
| 20 |
+
import torch
|
| 21 |
+
from torch import Tensor
|
| 22 |
+
|
| 23 |
+
from ..dflow.preview import LatentRgbPreview
|
| 24 |
+
|
| 25 |
+
_RGB_IDENTITY = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class DFlowLatentFormat(LatentFormat):
|
| 29 |
+
"""dflow's latent format: 96 whitened channels at stride 16, unscaled."""
|
| 30 |
+
|
| 31 |
+
latent_channels = LATENT_CHANNELS
|
| 32 |
+
spacial_downscale_ratio = LATENT_STRIDE
|
| 33 |
+
scale_factor = 1.0
|
| 34 |
+
latent_rgb_factors = _RGB_IDENTITY
|
| 35 |
+
|
| 36 |
+
def __init__(self, preview: LatentRgbPreview) -> None:
|
| 37 |
+
"""Use ``preview`` (on the sampling device) for live previews."""
|
| 38 |
+
|
| 39 |
+
self.preview = preview
|
| 40 |
+
self.latent_rgb_factors_reshape = self.project_first
|
| 41 |
+
|
| 42 |
+
def project_first(self, latents: Tensor) -> Tensor:
|
| 43 |
+
"""RGB ``[1, 3, 2h, 2w]`` in ``[-1, 1]`` of the batch's first latent
|
| 44 |
+
(the previewer shows only that one)."""
|
| 45 |
+
|
| 46 |
+
return self.preview.project(latents[:1])
|
| 47 |
+
|
| 48 |
+
def process_in(self, latent: Tensor) -> Tensor:
|
| 49 |
+
"""dflow latents enter the model unchanged."""
|
| 50 |
+
|
| 51 |
+
return latent
|
| 52 |
+
|
| 53 |
+
def process_out(self, latent: Tensor) -> Tensor:
|
| 54 |
+
"""dflow latents leave the model unchanged."""
|
| 55 |
+
|
| 56 |
+
return latent
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class DFlowPreviewModel:
|
| 60 |
+
"""The ``model_patcher.model`` attributes the custom sampler reads."""
|
| 61 |
+
|
| 62 |
+
def __init__(self, latent_format: DFlowLatentFormat) -> None:
|
| 63 |
+
self.latent_format = latent_format
|
| 64 |
+
|
| 65 |
+
@staticmethod
|
| 66 |
+
def process_latent_out(latents: Tensor) -> Tensor:
|
| 67 |
+
"""Denoised latents are already in dflow's latent space."""
|
| 68 |
+
|
| 69 |
+
return latents
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class DFlowModelPatcher:
|
| 73 |
+
"""The ``guider.model_patcher`` surface ``SamplerCustomAdvanced`` uses:
|
| 74 |
+
the device, the latent format and the preview model."""
|
| 75 |
+
|
| 76 |
+
def __init__(self, *, device: torch.device, model: DFlowPreviewModel) -> None:
|
| 77 |
+
self.load_device = device
|
| 78 |
+
self.model = model
|
| 79 |
+
|
| 80 |
+
def get_model_object(self, name: str) -> DFlowLatentFormat:
|
| 81 |
+
"""Return the latent format (the only object dflow exposes).
|
| 82 |
+
|
| 83 |
+
Raises:
|
| 84 |
+
KeyError: For any other name.
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
match name:
|
| 88 |
+
case "latent_format":
|
| 89 |
+
return self.model.latent_format
|
| 90 |
+
case _:
|
| 91 |
+
raise KeyError(f"dflow does not expose the model object {name!r}.")
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def build_model_patcher(
|
| 95 |
+
preview: LatentRgbPreview, *, device: torch.device
|
| 96 |
+
) -> DFlowModelPatcher:
|
| 97 |
+
"""The preview-only model patcher of a dflow guider."""
|
| 98 |
+
|
| 99 |
+
return DFlowModelPatcher(
|
| 100 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""The dflow guider: ``dflow``'s guidance plan and solver behind ComfyUI's
|
| 4 |
+
GUIDER interface, driven by the stock ``SamplerCustomAdvanced`` node.
|
| 5 |
+
|
| 6 |
+
Noise and seed contract (the same as ``dflow.inference``):
|
| 7 |
+
|
| 8 |
+
- The initial noise is the NOISE input's tensor. Stock ``RandomNoise`` draws
|
| 9 |
+
it with ``torch.randn`` of the latent shape from a CPU generator seeded with
|
| 10 |
+
its seed, which is exactly the noise ``DFlowEngine.sample`` draws for that
|
| 11 |
+
seed, so a stock graph reproduces the package bit for bit.
|
| 12 |
+
- Stochastic solvers draw from a fresh CPU generator seeded with the NOISE
|
| 13 |
+
node's seed; the three-quarter routing from a CUDA generator with that seed.
|
| 14 |
+
- A schedule that starts at the noisy end (``t >= 1 - 1e-4``) starts from the
|
| 15 |
+
noise alone, as ``DFlowEngine.sample`` does without image-to-image; the
|
| 16 |
+
latent input is ignored there, as stock samplers ignore it at full denoise.
|
| 17 |
+
A schedule that starts later (a sliced SIGMAS) noises the latent to
|
| 18 |
+
its first time, ``(1 - t) latent + t noise``, as ``ImageToImage`` does.
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
from __future__ import annotations
|
| 22 |
+
|
| 23 |
+
from collections.abc import Callable
|
| 24 |
+
from dataclasses import replace
|
| 25 |
+
from typing import TYPE_CHECKING
|
| 26 |
+
|
| 27 |
+
import comfy.sampler_helpers
|
| 28 |
+
import torch
|
| 29 |
+
from torch import Tensor
|
| 30 |
+
|
| 31 |
+
from ..dflow.guidance import (
|
| 32 |
+
BranchCall,
|
| 33 |
+
BranchText,
|
| 34 |
+
GuidancePlan,
|
| 35 |
+
GuidanceSettings,
|
| 36 |
+
build_guidance_plan,
|
| 37 |
+
check_three_quarter_size,
|
| 38 |
+
)
|
| 39 |
+
from ..dflow.layout import compile_layout, is_compiled_layout
|
| 40 |
+
from ..dflow.modeling import PreparedText, self_attention_gain_tensor
|
| 41 |
+
from ..dflow.schedules import FINITE_NOISY_ENDPOINT_EPSILON
|
| 42 |
+
from ..dflow.solvers import solve, solver_is_stochastic
|
| 43 |
+
from ..dflow.types import DFlowPath
|
| 44 |
+
from ..dflow.vae import LATENT_CHANNELS, LATENT_STRIDE
|
| 45 |
+
from .types import (
|
| 46 |
+
DFlowConditioning,
|
| 47 |
+
DFlowModelHandle,
|
| 48 |
+
DFlowSamplerSpec,
|
| 49 |
+
ScheduleBinding,
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
if TYPE_CHECKING:
|
| 53 |
+
from .preview import DFlowModelPatcher
|
| 54 |
+
|
| 55 |
+
ComfySamplerCallback = Callable[[int, Tensor, Tensor, int], None]
|
| 56 |
+
VelocityFn = Callable[[Tensor, Tensor, int], Tensor]
|
| 57 |
+
|
| 58 |
+
# First schedule times at or above this start from the noise alone.
|
| 59 |
+
NOISE_START_TIME = float(
|
| 60 |
+
torch.tensor(1.0 - FINITE_NOISY_ENDPOINT_EPSILON, dtype=torch.float32)
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class DFlowGuider:
|
| 65 |
+
"""Guided dflow sampling for ``SamplerCustomAdvanced``.
|
| 66 |
+
|
| 67 |
+
Args:
|
| 68 |
+
model: The loaded model.
|
| 69 |
+
positive: The prompt conditioning.
|
| 70 |
+
negative: The negative conditioning, or None for the learned null
|
| 71 |
+
text (used only by CFG and the contrastive PDG modes).
|
| 72 |
+
guidance: Validated guidance settings.
|
| 73 |
+
model_patcher: Preview surface ComfyUI reads from the guider.
|
| 74 |
+
|
| 75 |
+
Raises:
|
| 76 |
+
ValueError: If a conditioning came from another model or the batches
|
| 77 |
+
differ.
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
def __init__(
|
| 81 |
+
self,
|
| 82 |
+
*,
|
| 83 |
+
model: DFlowModelHandle,
|
| 84 |
+
positive: DFlowConditioning,
|
| 85 |
+
negative: DFlowConditioning | None,
|
| 86 |
+
guidance: GuidanceSettings,
|
| 87 |
+
model_patcher: DFlowModelPatcher,
|
| 88 |
+
) -> None:
|
| 89 |
+
_require_model(model, positive, "positive")
|
| 90 |
+
if negative is not None:
|
| 91 |
+
_require_model(model, negative, "negative")
|
| 92 |
+
if negative.batch != positive.batch:
|
| 93 |
+
raise ValueError(
|
| 94 |
+
f"The negative conditioning has batch {negative.batch}, the "
|
| 95 |
+
f"positive {positive.batch}; set the same batch_size on both."
|
| 96 |
+
)
|
| 97 |
+
self.model = model
|
| 98 |
+
self.positive = positive
|
| 99 |
+
self.negative = negative
|
| 100 |
+
self.guidance = guidance
|
| 101 |
+
self.model_patcher = model_patcher
|
| 102 |
+
|
| 103 |
+
def with_guidance(self, guidance: GuidanceSettings) -> DFlowGuider:
|
| 104 |
+
"""A guider with the same model and conditioning and new settings."""
|
| 105 |
+
|
| 106 |
+
return DFlowGuider(
|
| 107 |
+
model=self.model,
|
| 108 |
+
positive=self.positive,
|
| 109 |
+
negative=self.negative,
|
| 110 |
+
guidance=guidance,
|
| 111 |
+
model_patcher=self.model_patcher,
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
def sample(
|
| 115 |
+
self,
|
| 116 |
+
noise: Tensor,
|
| 117 |
+
latent_image: Tensor,
|
| 118 |
+
sampler: object,
|
| 119 |
+
sigmas: Tensor,
|
| 120 |
+
*,
|
| 121 |
+
denoise_mask: Tensor | None = None,
|
| 122 |
+
callback: ComfySamplerCallback | None = None,
|
| 123 |
+
disable_pbar: bool = False,
|
| 124 |
+
seed: int | None = None,
|
| 125 |
+
) -> Tensor:
|
| 126 |
+
"""Sample latents (ComfyUI's ``GUIDER.sample`` signature).
|
| 127 |
+
|
| 128 |
+
Args:
|
| 129 |
+
noise: ``[B, 96, h, w]`` initial noise from the NOISE node.
|
| 130 |
+
latent_image: ``[B, 96, h, w]`` start latents (zeros for an empty
|
| 131 |
+
latent).
|
| 132 |
+
sampler: The SAMPLER output of ``DFlow Time Schedule`` or
|
| 133 |
+
a sliced schedule.
|
| 134 |
+
sigmas: The descending schedule from the same node.
|
| 135 |
+
denoise_mask: ComfyUI noise mask, or None.
|
| 136 |
+
callback: ComfyUI's per-step preview and progress callback.
|
| 137 |
+
disable_pbar: Unused (ComfyUI reports progress via ``callback``).
|
| 138 |
+
seed: The NOISE node's seed.
|
| 139 |
+
|
| 140 |
+
Returns:
|
| 141 |
+
Float32 latents ``[B, 96, h, w]`` on the model's device.
|
| 142 |
+
|
| 143 |
+
Raises:
|
| 144 |
+
TypeError: For a sampler that is not a scheduled dflow sampler or a
|
| 145 |
+
missing seed.
|
| 146 |
+
ValueError: For inconsistent shapes, sizes or layout prompts.
|
| 147 |
+
"""
|
| 148 |
+
|
| 149 |
+
del disable_pbar
|
| 150 |
+
spec, binding = _scheduled_sampler(sampler)
|
| 151 |
+
seed_value = _require_seed(seed)
|
| 152 |
+
self._validate_inputs(noise, latent_image, binding)
|
| 153 |
+
device = self.model.device
|
| 154 |
+
with torch.inference_mode():
|
| 155 |
+
timesteps = sigmas.to(device=device, dtype=torch.float32).contiguous()
|
| 156 |
+
host_times = timesteps.tolist()
|
| 157 |
+
plan = self._plan(binding, host_times)
|
| 158 |
+
device_noise = noise.to(device=device, dtype=torch.float32)
|
| 159 |
+
device_latent = latent_image.to(device=device, dtype=torch.float32)
|
| 160 |
+
velocity = self._velocity(plan, seed_value, len(noise))
|
| 161 |
+
if denoise_mask is not None:
|
| 162 |
+
velocity = _masked(
|
| 163 |
+
velocity,
|
| 164 |
+
latent=device_latent,
|
| 165 |
+
noise=device_noise,
|
| 166 |
+
mask=comfy.sampler_helpers.prepare_mask(
|
| 167 |
+
denoise_mask, noise.shape, device
|
| 168 |
+
).to(dtype=torch.float32),
|
| 169 |
+
)
|
| 170 |
+
return solve(
|
| 171 |
+
velocity,
|
| 172 |
+
_start_state(device_noise, device_latent, timesteps, host_times[0]),
|
| 173 |
+
timesteps,
|
| 174 |
+
solver=spec.solver,
|
| 175 |
+
noise_scale=spec.noise_scale,
|
| 176 |
+
generator=(
|
| 177 |
+
torch.Generator(device="cpu").manual_seed(seed_value)
|
| 178 |
+
if solver_is_stochastic(spec.solver)
|
| 179 |
+
else None
|
| 180 |
+
),
|
| 181 |
+
callback=_comfy_callback(callback),
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
def _validate_inputs(
|
| 185 |
+
self, noise: Tensor, latent_image: Tensor, binding: ScheduleBinding
|
| 186 |
+
) -> None:
|
| 187 |
+
"""Check shapes, batch, the schedule's size and layout prompt sizes.
|
| 188 |
+
|
| 189 |
+
Raises:
|
| 190 |
+
ValueError: On any mismatch.
|
| 191 |
+
"""
|
| 192 |
+
|
| 193 |
+
if noise.ndim != 4 or int(noise.shape[1]) != LATENT_CHANNELS:
|
| 194 |
+
raise ValueError(
|
| 195 |
+
f"dflow samples [batch, {LATENT_CHANNELS}, height, width] latents; "
|
| 196 |
+
f"got noise of shape {tuple(noise.shape)}."
|
| 197 |
+
)
|
| 198 |
+
if tuple(latent_image.shape) != tuple(noise.shape):
|
| 199 |
+
raise ValueError(
|
| 200 |
+
f"The latent {tuple(latent_image.shape)} and the noise "
|
| 201 |
+
f"{tuple(noise.shape)} differ in shape."
|
| 202 |
+
)
|
| 203 |
+
if int(noise.shape[0]) != self.positive.batch:
|
| 204 |
+
raise ValueError(
|
| 205 |
+
f"The latent batch is {noise.shape[0]} but the conditioning holds "
|
| 206 |
+
f"{self.positive.batch} prompts; set the same batch_size on the "
|
| 207 |
+
"text encode and latent nodes."
|
| 208 |
+
)
|
| 209 |
+
width = int(noise.shape[3]) * LATENT_STRIDE
|
| 210 |
+
height = int(noise.shape[2]) * LATENT_STRIDE
|
| 211 |
+
if (binding.width, binding.height) != (width, height):
|
| 212 |
+
raise ValueError(
|
| 213 |
+
f"The schedule was built for {binding.width}x{binding.height} but "
|
| 214 |
+
f"the latent is {width}x{height}; connect the sampled latent to "
|
| 215 |
+
"the schedule node."
|
| 216 |
+
)
|
| 217 |
+
check_three_quarter_size(self.guidance, width, height)
|
| 218 |
+
conditionings = (
|
| 219 |
+
[self.positive]
|
| 220 |
+
if self.negative is None
|
| 221 |
+
else [
|
| 222 |
+
self.positive,
|
| 223 |
+
self.negative,
|
| 224 |
+
]
|
| 225 |
+
)
|
| 226 |
+
for conditioning in conditionings:
|
| 227 |
+
for prompt in conditioning.prompts:
|
| 228 |
+
if is_compiled_layout(prompt):
|
| 229 |
+
compile_layout(prompt, width, height)
|
| 230 |
+
|
| 231 |
+
def _plan(self, binding: ScheduleBinding, host_times: list[float]) -> GuidancePlan:
|
| 232 |
+
"""The guidance plan over ``host_times`` (as ``DFlowEngine.sample``)."""
|
| 233 |
+
|
| 234 |
+
return build_guidance_plan(
|
| 235 |
+
self.guidance,
|
| 236 |
+
schedule=replace(binding.schedule, steps=len(host_times) - 1),
|
| 237 |
+
log_snr_shift=binding.log_snr_shift,
|
| 238 |
+
timesteps=host_times,
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
def _texts(self, batch: int) -> dict[BranchText, PreparedText]:
|
| 242 |
+
"""The positive text and, when guidance needs it, the negative text
|
| 243 |
+
(the learned null text when no negative is connected)."""
|
| 244 |
+
|
| 245 |
+
texts = {BranchText.POSITIVE: self.positive.text}
|
| 246 |
+
if self.guidance.uses_negative:
|
| 247 |
+
texts[BranchText.NEGATIVE] = (
|
| 248 |
+
self.negative.text
|
| 249 |
+
if self.negative is not None
|
| 250 |
+
else _null_text(self.model, batch)
|
| 251 |
+
)
|
| 252 |
+
return texts
|
| 253 |
+
|
| 254 |
+
def _velocity(self, plan: GuidancePlan, seed: int, batch: int) -> VelocityFn:
|
| 255 |
+
"""The guided velocity function the solver integrates."""
|
| 256 |
+
|
| 257 |
+
model = self.model.engine.model
|
| 258 |
+
device = self.model.device
|
| 259 |
+
texts = self._texts(batch)
|
| 260 |
+
routing = torch.Generator(device=device).manual_seed(seed)
|
| 261 |
+
gains: dict[float, Tensor] = {}
|
| 262 |
+
|
| 263 |
+
def evaluate_at(state: Tensor, time: Tensor) -> Callable[[BranchCall], Tensor]:
|
| 264 |
+
def evaluate(call: BranchCall) -> Tensor:
|
| 265 |
+
path = call.branch.path
|
| 266 |
+
if call.self_attention_gain not in gains:
|
| 267 |
+
gains[call.self_attention_gain] = self_attention_gain_tensor(
|
| 268 |
+
call.self_attention_gain, device=device
|
| 269 |
+
)
|
| 270 |
+
return model(
|
| 271 |
+
state,
|
| 272 |
+
time,
|
| 273 |
+
texts[call.branch.text],
|
| 274 |
+
path=path,
|
| 275 |
+
self_attention_gain=gains[call.self_attention_gain],
|
| 276 |
+
suffix_caption_bias=call.suffix_caption_bias,
|
| 277 |
+
generator=routing if path is DFlowPath.THREE_QUARTER else None,
|
| 278 |
+
)
|
| 279 |
+
|
| 280 |
+
return evaluate
|
| 281 |
+
|
| 282 |
+
def velocity(state: Tensor, time: Tensor, index: int) -> Tensor:
|
| 283 |
+
return plan.guided_velocity(index, state, time, evaluate_at(state, time))
|
| 284 |
+
|
| 285 |
+
return velocity
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
def _require_model(
|
| 289 |
+
model: DFlowModelHandle, conditioning: DFlowConditioning, name: str
|
| 290 |
+
) -> None:
|
| 291 |
+
"""Require conditioning encoded by ``model``.
|
| 292 |
+
|
| 293 |
+
Raises:
|
| 294 |
+
ValueError: Otherwise.
|
| 295 |
+
"""
|
| 296 |
+
|
| 297 |
+
if conditioning.model is not model:
|
| 298 |
+
raise ValueError(
|
| 299 |
+
f"The {name} conditioning was encoded by a different DFlow Loader; "
|
| 300 |
+
"connect the text encoder and model outputs of the same loader."
|
| 301 |
+
)
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
def _scheduled_sampler(sampler: object) -> tuple[DFlowSamplerSpec, ScheduleBinding]:
|
| 305 |
+
"""The dflow sampler and the schedule it is paired with.
|
| 306 |
+
|
| 307 |
+
Raises:
|
| 308 |
+
TypeError: If ``sampler`` is not a dflow sampler with a schedule.
|
| 309 |
+
"""
|
| 310 |
+
|
| 311 |
+
match sampler:
|
| 312 |
+
case DFlowSamplerSpec(binding=None):
|
| 313 |
+
raise TypeError(
|
| 314 |
+
"Connect the sampler output of DFlow Time Schedule to "
|
| 315 |
+
"SamplerCustomAdvanced, not the DFlow Sampler "
|
| 316 |
+
"output: guidance needs the schedule the sigmas came from."
|
| 317 |
+
)
|
| 318 |
+
case DFlowSamplerSpec(binding=ScheduleBinding() as binding) as spec:
|
| 319 |
+
return spec, binding
|
| 320 |
+
case _:
|
| 321 |
+
raise TypeError(
|
| 322 |
+
"The dflow guider runs dflow's own solvers; connect the sampler "
|
| 323 |
+
f"output of DFlow Time Schedule, not {type(sampler).__name__}."
|
| 324 |
+
)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def _require_seed(seed: int | None) -> int:
|
| 328 |
+
"""The NOISE node's seed.
|
| 329 |
+
|
| 330 |
+
Raises:
|
| 331 |
+
TypeError: If the noise source has no integer seed.
|
| 332 |
+
"""
|
| 333 |
+
|
| 334 |
+
if seed is None or isinstance(seed, bool) or not isinstance(seed, int):
|
| 335 |
+
raise TypeError(
|
| 336 |
+
"dflow sampling needs the integer seed of a NOISE node such as "
|
| 337 |
+
f"RandomNoise; got {seed!r}."
|
| 338 |
+
)
|
| 339 |
+
return seed
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
def _null_text(model: DFlowModelHandle, batch: int) -> PreparedText:
|
| 343 |
+
"""The learned null text for ``batch`` rows, refined."""
|
| 344 |
+
|
| 345 |
+
engine = model.engine
|
| 346 |
+
return engine.model.prepare_text(
|
| 347 |
+
engine.text_encoder.encode([""] * batch, emphasis=None)
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
def _start_state(
|
| 352 |
+
noise: Tensor, latent: Tensor, timesteps: Tensor, first_time: float
|
| 353 |
+
) -> Tensor:
|
| 354 |
+
"""The solver's initial state (see the module docstring)."""
|
| 355 |
+
|
| 356 |
+
if first_time >= NOISE_START_TIME:
|
| 357 |
+
return noise.contiguous(memory_format=torch.channels_last)
|
| 358 |
+
time = timesteps[0]
|
| 359 |
+
return ((1.0 - time) * latent + time * noise).contiguous(
|
| 360 |
+
memory_format=torch.channels_last
|
| 361 |
+
)
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
def _masked(
|
| 365 |
+
velocity: VelocityFn, *, latent: Tensor, noise: Tensor, mask: Tensor
|
| 366 |
+
) -> VelocityFn:
|
| 367 |
+
"""Keep the latent outside the mask.
|
| 368 |
+
|
| 369 |
+
There the velocity is the one whose clean estimate is the latent at the
|
| 370 |
+
current state, ``(x_t - latent) / t``, so the region returns to the latent
|
| 371 |
+
even after a stochastic solver injects noise; at ``t = 0`` it is the
|
| 372 |
+
straight-path velocity ``noise - latent``.
|
| 373 |
+
"""
|
| 374 |
+
|
| 375 |
+
straight = noise - latent
|
| 376 |
+
|
| 377 |
+
def masked(state: Tensor, time: Tensor, index: int) -> Tensor:
|
| 378 |
+
t = time.to(dtype=state.dtype).view(-1, 1, 1, 1)
|
| 379 |
+
kept = torch.where(
|
| 380 |
+
t > 0.0,
|
| 381 |
+
(state - latent) / t.clamp_min(torch.finfo(state.dtype).tiny),
|
| 382 |
+
straight,
|
| 383 |
+
)
|
| 384 |
+
return mask * velocity(state, time, index) + (1.0 - mask) * kept
|
| 385 |
+
|
| 386 |
+
return masked
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
def _comfy_callback(
|
| 390 |
+
callback: ComfySamplerCallback | None,
|
| 391 |
+
) -> Callable[[Tensor, int, int], None] | None:
|
| 392 |
+
"""Forward each update's clean estimate to ComfyUI's preview callback."""
|
| 393 |
+
|
| 394 |
+
if callback is None:
|
| 395 |
+
return None
|
| 396 |
+
|
| 397 |
+
def publish(predicted_x0: Tensor, completed: int, total: int) -> None:
|
| 398 |
+
callback(completed - 1, predicted_x0, predicted_x0, total)
|
| 399 |
+
|
| 400 |
+
return publish
|
comfyui/types.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""Values passed between the dflow ComfyUI nodes.
|
| 4 |
+
|
| 5 |
+
Every handle is a frozen dataclass around ``dflow`` objects; the nodes never
|
| 6 |
+
hand ComfyUI anything untyped except the latent mapping ComfyUI itself
|
| 7 |
+
defines.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import math
|
| 13 |
+
from dataclasses import dataclass, replace
|
| 14 |
+
from enum import StrEnum
|
| 15 |
+
from typing import TYPE_CHECKING, TypedDict
|
| 16 |
+
|
| 17 |
+
if TYPE_CHECKING:
|
| 18 |
+
import torch
|
| 19 |
+
from torch import Tensor
|
| 20 |
+
|
| 21 |
+
from ..dflow.inference import DFlowEngine
|
| 22 |
+
from ..dflow.modeling import PreparedText
|
| 23 |
+
from ..dflow.pipeline import DFlowComponents
|
| 24 |
+
from ..dflow.preview import LatentRgbPreview
|
| 25 |
+
from ..dflow.prompt_emphasis import EmphasisSettings
|
| 26 |
+
from ..dflow.schedules import TimeSchedule
|
| 27 |
+
from ..dflow.solvers import Solver
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class DFlowWeightSource(StrEnum):
|
| 31 |
+
"""Where the loader node reads the release from.
|
| 32 |
+
|
| 33 |
+
BUNDLED: the node folder itself (the Hugging Face repository checkout).
|
| 34 |
+
LOCAL_DIR: another local release directory.
|
| 35 |
+
HUB: a Hugging Face repository at a revision.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
BUNDLED = "bundled"
|
| 39 |
+
LOCAL_DIR = "local_dir"
|
| 40 |
+
HUB = "hub"
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class PdgCurveChoice(StrEnum):
|
| 44 |
+
"""PDG scale schedules offered by the advanced guider node.
|
| 45 |
+
|
| 46 |
+
CONSTANT: the guider's constant PDG scale.
|
| 47 |
+
RAMP: linear in the schedule quantile from a start to an end scale.
|
| 48 |
+
LINEAR, LINEAR_LOGSNR, POWER, S_CURVE: per-step endpoint curves.
|
| 49 |
+
BEZIER: the cubic Bezier curve over flow time.
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
CONSTANT = "constant"
|
| 53 |
+
RAMP = "ramp"
|
| 54 |
+
LINEAR = "linear"
|
| 55 |
+
LINEAR_LOGSNR = "linear_logsnr"
|
| 56 |
+
POWER = "power"
|
| 57 |
+
S_CURVE = "s_curve"
|
| 58 |
+
BEZIER = "bezier"
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class DFlowLatent(TypedDict):
|
| 62 |
+
"""ComfyUI's latent mapping for dflow latents ``[B, 96, H/16, W/16]``."""
|
| 63 |
+
|
| 64 |
+
samples: Tensor
|
| 65 |
+
downscale_ratio_spacial: int
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
@dataclass(frozen=True)
|
| 69 |
+
class DFlowModelHandle:
|
| 70 |
+
"""The loaded release and the preview projection on its device.
|
| 71 |
+
|
| 72 |
+
Attributes:
|
| 73 |
+
components: Denoiser, text encoder and autoencoder.
|
| 74 |
+
preview: Latent-to-RGB preview projection on the model's device.
|
| 75 |
+
"""
|
| 76 |
+
|
| 77 |
+
components: DFlowComponents
|
| 78 |
+
preview: LatentRgbPreview
|
| 79 |
+
|
| 80 |
+
@property
|
| 81 |
+
def engine(self) -> DFlowEngine:
|
| 82 |
+
"""The sampling engine (denoiser and text encoder)."""
|
| 83 |
+
|
| 84 |
+
return self.components.engine
|
| 85 |
+
|
| 86 |
+
@property
|
| 87 |
+
def device(self) -> torch.device:
|
| 88 |
+
"""The CUDA device the model runs on."""
|
| 89 |
+
|
| 90 |
+
return self.components.engine.device
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
@dataclass(frozen=True)
|
| 94 |
+
class DFlowTextEncoderHandle:
|
| 95 |
+
"""The text-encoder output of the loader; encodes for one model."""
|
| 96 |
+
|
| 97 |
+
model: DFlowModelHandle
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
@dataclass(frozen=True)
|
| 101 |
+
class DFlowConditioning:
|
| 102 |
+
"""An encoded and refined prompt batch.
|
| 103 |
+
|
| 104 |
+
Attributes:
|
| 105 |
+
model: The model that encoded it (guiders reject other models').
|
| 106 |
+
prompts: The texts the encoder read, one per batch row (layouts in
|
| 107 |
+
their compiled form).
|
| 108 |
+
text: The refined text tokens.
|
| 109 |
+
emphasis: The prompt-emphasis settings used, or None for verbatim.
|
| 110 |
+
"""
|
| 111 |
+
|
| 112 |
+
model: DFlowModelHandle
|
| 113 |
+
prompts: tuple[str, ...]
|
| 114 |
+
text: PreparedText
|
| 115 |
+
emphasis: EmphasisSettings | None
|
| 116 |
+
|
| 117 |
+
@property
|
| 118 |
+
def batch(self) -> int:
|
| 119 |
+
"""Number of prompts (latents) in the batch."""
|
| 120 |
+
|
| 121 |
+
return len(self.prompts)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
@dataclass(frozen=True)
|
| 125 |
+
class ScheduleBinding:
|
| 126 |
+
"""The schedule a SIGMAS tensor was built from, as guidance needs it.
|
| 127 |
+
|
| 128 |
+
The quantile ramp and the linear-logSNR curve read the schedule family and
|
| 129 |
+
the shift; the size check ties the shift to the latent being sampled.
|
| 130 |
+
|
| 131 |
+
Attributes:
|
| 132 |
+
schedule: Family and beta parameters (``steps`` is the full count).
|
| 133 |
+
log_snr_shift: Effective shift the schedule was built with.
|
| 134 |
+
width: Image width the shift was computed for.
|
| 135 |
+
height: Image height the shift was computed for.
|
| 136 |
+
"""
|
| 137 |
+
|
| 138 |
+
schedule: TimeSchedule
|
| 139 |
+
log_snr_shift: float
|
| 140 |
+
width: int
|
| 141 |
+
height: int
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
@dataclass(frozen=True)
|
| 145 |
+
class DFlowSamplerSpec:
|
| 146 |
+
"""The SAMPLER value: solver, noise scale and, once a dflow schedule node
|
| 147 |
+
has seen it, the schedule it is paired with.
|
| 148 |
+
|
| 149 |
+
Raises:
|
| 150 |
+
ValueError: For a negative or non-finite noise scale.
|
| 151 |
+
"""
|
| 152 |
+
|
| 153 |
+
solver: Solver
|
| 154 |
+
noise_scale: float
|
| 155 |
+
binding: ScheduleBinding | None = None
|
| 156 |
+
|
| 157 |
+
def __post_init__(self) -> None:
|
| 158 |
+
"""Validate the noise scale."""
|
| 159 |
+
|
| 160 |
+
if not math.isfinite(self.noise_scale) or self.noise_scale < 0.0:
|
| 161 |
+
raise ValueError(f"noise_scale must be >= 0, got {self.noise_scale}.")
|
| 162 |
+
|
| 163 |
+
def bound(self, binding: ScheduleBinding) -> DFlowSamplerSpec:
|
| 164 |
+
"""Return this sampler paired with a schedule."""
|
| 165 |
+
|
| 166 |
+
return replace(self, binding=binding)
|
comfyui/vae.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
# Copyright 2026 Data Archetype
|
| 3 |
+
"""The dinac3_96 autoencoder behind ComfyUI's VAE interface.
|
| 4 |
+
|
| 5 |
+
Stock ``VAEDecode`` and ``VAEEncode`` call ``decode(latents)`` and
|
| 6 |
+
``encode(pixels)``; ComfyUI images are ``[B, H, W, C]`` floats in ``[0, 1]``.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import comfy.model_management
|
| 12 |
+
import torch
|
| 13 |
+
from torch import Tensor
|
| 14 |
+
|
| 15 |
+
from ..dflow.vae import LATENT_CHANNELS, LATENT_STRIDE, DFlowVae
|
| 16 |
+
|
| 17 |
+
_RGB_CHANNELS = 3
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class DFlowVaeAdapter:
|
| 21 |
+
"""``DFlowVae`` with ComfyUI's decode/encode conventions."""
|
| 22 |
+
|
| 23 |
+
latent_channels = LATENT_CHANNELS
|
| 24 |
+
latent_dim = 2
|
| 25 |
+
|
| 26 |
+
def __init__(self, vae: DFlowVae, *, device: torch.device) -> None:
|
| 27 |
+
"""Wrap a loaded autoencoder that runs on ``device``."""
|
| 28 |
+
|
| 29 |
+
self.vae = vae
|
| 30 |
+
self.device = device
|
| 31 |
+
|
| 32 |
+
def decode(self, latents: Tensor) -> Tensor:
|
| 33 |
+
"""Decode ``[B, 96, h, w]`` latents to ``[B, 16h, 16w, 3]`` images.
|
| 34 |
+
|
| 35 |
+
Raises:
|
| 36 |
+
ValueError: If the latents do not have 96 channels.
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
if latents.ndim != 4 or int(latents.shape[1]) != LATENT_CHANNELS:
|
| 40 |
+
raise ValueError(
|
| 41 |
+
f"dflow latents have shape [batch, {LATENT_CHANNELS}, height, "
|
| 42 |
+
f"width]; got {tuple(latents.shape)}. Use the dflow VAE only with "
|
| 43 |
+
"dflow latents."
|
| 44 |
+
)
|
| 45 |
+
device_latents = latents.to(device=self.device, dtype=torch.float32)
|
| 46 |
+
rgb = self.vae.decode(
|
| 47 |
+
device_latents.contiguous(memory_format=torch.channels_last)
|
| 48 |
+
).clamp(-1.0, 1.0)
|
| 49 |
+
images = rgb.add(1.0).mul(0.5).movedim(1, -1)
|
| 50 |
+
return images.to(comfy.model_management.intermediate_device())
|
| 51 |
+
|
| 52 |
+
def encode(self, pixels: Tensor) -> Tensor:
|
| 53 |
+
"""Encode ``[B, H, W, C]`` images (RGB first) to ``[B, 96, H/16, W/16]``.
|
| 54 |
+
|
| 55 |
+
Raises:
|
| 56 |
+
ValueError: If the image has fewer than three channels, or a side
|
| 57 |
+
is not a multiple of 16.
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
if pixels.ndim != 4 or int(pixels.shape[-1]) < _RGB_CHANNELS:
|
| 61 |
+
raise ValueError(
|
| 62 |
+
f"ComfyUI images have shape [batch, height, width, channels>=3]; "
|
| 63 |
+
f"got {tuple(pixels.shape)}."
|
| 64 |
+
)
|
| 65 |
+
images = (
|
| 66 |
+
pixels[..., :_RGB_CHANNELS]
|
| 67 |
+
.movedim(-1, 1)
|
| 68 |
+
.to(device=self.device, dtype=torch.float32)
|
| 69 |
+
.mul(2.0)
|
| 70 |
+
.sub(1.0)
|
| 71 |
+
.contiguous(memory_format=torch.channels_last)
|
| 72 |
+
)
|
| 73 |
+
latents = self.vae.encode(images)
|
| 74 |
+
return latents.to(comfy.model_management.intermediate_device())
|
| 75 |
+
|
| 76 |
+
@staticmethod
|
| 77 |
+
def spacial_compression_decode() -> int:
|
| 78 |
+
"""Pixels per latent along each side."""
|
| 79 |
+
|
| 80 |
+
return LATENT_STRIDE
|
| 81 |
+
|
| 82 |
+
@staticmethod
|
| 83 |
+
def spacial_compression_encode() -> int:
|
| 84 |
+
"""Pixels per latent along each side."""
|
| 85 |
+
|
| 86 |
+
return LATENT_STRIDE
|
| 87 |
+
|
| 88 |
+
@staticmethod
|
| 89 |
+
def temporal_compression_decode() -> None:
|
| 90 |
+
"""Image-only autoencoder: no temporal axis."""
|
| 91 |
+
|
| 92 |
+
return None
|
comfyui/web/dflow_solver.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// SPDX-License-Identifier: GPL-3.0-only
|
| 2 |
+
// Copyright 2026 Data Archetype
|
| 3 |
+
// DFlow Sampler: choosing a solver sets noise_scale to that solver's default
|
| 4 |
+
// (eta 0.5 for DPM++ 2M SDE, 1.0 otherwise), as dflow.solvers.default_noise_scale.
|
| 5 |
+
import { app } from "../../scripts/app.js";
|
| 6 |
+
|
| 7 |
+
const NODE = "DFlowSampler";
|
| 8 |
+
const SOLVER = "solver";
|
| 9 |
+
const NOISE_SCALE = "noise_scale";
|
| 10 |
+
const DEFAULT_NOISE_SCALE = 1.0;
|
| 11 |
+
const SOLVER_NOISE_SCALE = { dpmpp_2m_sde: 0.5 };
|
| 12 |
+
|
| 13 |
+
/** Return a named widget, or fail when the node's inputs have changed. */
|
| 14 |
+
function requiredWidget(node, name) {
|
| 15 |
+
const widget = node.widgets?.find((candidate) => candidate.name === name);
|
| 16 |
+
if (!widget) {
|
| 17 |
+
throw new Error(`${NODE} is missing its ${name} widget.`);
|
| 18 |
+
}
|
| 19 |
+
return widget;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
app.registerExtension({
|
| 23 |
+
name: "DFlow.SolverDefaults",
|
| 24 |
+
nodeCreated(node) {
|
| 25 |
+
if (node.comfyClass !== NODE) {
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
const solver = requiredWidget(node, SOLVER);
|
| 29 |
+
const noiseScale = requiredWidget(node, NOISE_SCALE);
|
| 30 |
+
const original = solver.callback;
|
| 31 |
+
solver.callback = function (value, ...args) {
|
| 32 |
+
original?.call(this, value, ...args);
|
| 33 |
+
noiseScale.value = SOLVER_NOISE_SCALE[value] ?? DEFAULT_NOISE_SCALE;
|
| 34 |
+
node.setDirtyCanvas(true, true);
|
| 35 |
+
};
|
| 36 |
+
},
|
| 37 |
+
});
|
comfyui/workflows/dflow_default.json
ADDED
|
@@ -0,0 +1,869 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 14 |
+
"size": [
|
| 15 |
+
360,
|
| 16 |
+
230
|
| 17 |
+
],
|
| 18 |
+
"flags": {},
|
| 19 |
+
"order": 0,
|
| 20 |
+
"mode": 0,
|
| 21 |
+
"inputs": [
|
| 22 |
+
{
|
| 23 |
+
"name": "source",
|
| 24 |
+
"type": "COMBO",
|
| 25 |
+
"widget": {
|
| 26 |
+
"name": "source"
|
| 27 |
+
},
|
| 28 |
+
"link": null
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"name": "local_dir",
|
| 32 |
+
"type": "STRING",
|
| 33 |
+
"widget": {
|
| 34 |
+
"name": "local_dir"
|
| 35 |
+
},
|
| 36 |
+
"link": null
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "repository",
|
| 40 |
+
"type": "STRING",
|
| 41 |
+
"widget": {
|
| 42 |
+
"name": "repository"
|
| 43 |
+
},
|
| 44 |
+
"link": null
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"name": "revision",
|
| 48 |
+
"type": "STRING",
|
| 49 |
+
"widget": {
|
| 50 |
+
"name": "revision"
|
| 51 |
+
},
|
| 52 |
+
"link": null
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"name": "compile_model",
|
| 56 |
+
"type": "BOOLEAN",
|
| 57 |
+
"widget": {
|
| 58 |
+
"name": "compile_model"
|
| 59 |
+
},
|
| 60 |
+
"link": null
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"name": "cache_dir",
|
| 64 |
+
"type": "STRING",
|
| 65 |
+
"widget": {
|
| 66 |
+
"name": "cache_dir"
|
| 67 |
+
},
|
| 68 |
+
"link": null
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"outputs": [
|
| 72 |
+
{
|
| 73 |
+
"name": "model",
|
| 74 |
+
"type": "DFLOW_MODEL",
|
| 75 |
+
"slot_index": 0,
|
| 76 |
+
"links": [
|
| 77 |
+
1
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"name": "text_encoder",
|
| 82 |
+
"type": "DFLOW_TEXT_ENCODER",
|
| 83 |
+
"slot_index": 1,
|
| 84 |
+
"links": [
|
| 85 |
+
2
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"name": "vae",
|
| 90 |
+
"type": "VAE",
|
| 91 |
+
"slot_index": 2,
|
| 92 |
+
"links": [
|
| 93 |
+
3
|
| 94 |
+
]
|
| 95 |
+
}
|
| 96 |
+
],
|
| 97 |
+
"properties": {
|
| 98 |
+
"Node name for S&R": "DFlowLoader"
|
| 99 |
+
},
|
| 100 |
+
"widgets_values": [
|
| 101 |
+
"bundled",
|
| 102 |
+
"",
|
| 103 |
+
"data-archetype/dflow_2b",
|
| 104 |
+
"",
|
| 105 |
+
true,
|
| 106 |
+
""
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"id": 2,
|
| 111 |
+
"type": "DFlowTextEncode",
|
| 112 |
+
"pos": [
|
| 113 |
+
-400,
|
| 114 |
+
-420
|
| 115 |
+
],
|
| 116 |
+
"size": [
|
| 117 |
+
440,
|
| 118 |
+
420
|
| 119 |
+
],
|
| 120 |
+
"flags": {},
|
| 121 |
+
"order": 1,
|
| 122 |
+
"mode": 0,
|
| 123 |
+
"inputs": [
|
| 124 |
+
{
|
| 125 |
+
"name": "text_encoder",
|
| 126 |
+
"type": "DFLOW_TEXT_ENCODER",
|
| 127 |
+
"link": 2
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"name": "text",
|
| 131 |
+
"type": "STRING",
|
| 132 |
+
"widget": {
|
| 133 |
+
"name": "text"
|
| 134 |
+
},
|
| 135 |
+
"link": null
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"name": "batch_size",
|
| 139 |
+
"type": "INT",
|
| 140 |
+
"widget": {
|
| 141 |
+
"name": "batch_size"
|
| 142 |
+
},
|
| 143 |
+
"link": null
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"name": "emphasis",
|
| 147 |
+
"type": "BOOLEAN",
|
| 148 |
+
"widget": {
|
| 149 |
+
"name": "emphasis"
|
| 150 |
+
},
|
| 151 |
+
"link": null
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"name": "emphasis_mapping",
|
| 155 |
+
"type": "COMBO",
|
| 156 |
+
"widget": {
|
| 157 |
+
"name": "emphasis_mapping"
|
| 158 |
+
},
|
| 159 |
+
"link": null
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"name": "emphasis_strength",
|
| 163 |
+
"type": "FLOAT",
|
| 164 |
+
"widget": {
|
| 165 |
+
"name": "emphasis_strength"
|
| 166 |
+
},
|
| 167 |
+
"link": null
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"name": "emphasis_encoder",
|
| 171 |
+
"type": "BOOLEAN",
|
| 172 |
+
"widget": {
|
| 173 |
+
"name": "emphasis_encoder"
|
| 174 |
+
},
|
| 175 |
+
"link": null
|
| 176 |
+
}
|
| 177 |
+
],
|
| 178 |
+
"outputs": [
|
| 179 |
+
{
|
| 180 |
+
"name": "conditioning",
|
| 181 |
+
"type": "DFLOW_CONDITIONING",
|
| 182 |
+
"slot_index": 0,
|
| 183 |
+
"links": [
|
| 184 |
+
4
|
| 185 |
+
]
|
| 186 |
+
}
|
| 187 |
+
],
|
| 188 |
+
"properties": {
|
| 189 |
+
"Node name for S&R": "DFlowTextEncode"
|
| 190 |
+
},
|
| 191 |
+
"widgets_values": [
|
| 192 |
+
"Wide angle photo of a weathered wooden boardwalk descending steeply from rocky cliffs toward a rugged coastline. The boardwalk, constructed from aged planks with visible cracks and moss growth, is bordered by rustic wooden railings on both sides. Surrounding terrain features uneven, eroded rock formations covered in patches of green vegetation and low-lying shrubs. Below, a crescent-shaped sandy beach meets crashing waves of a deep blue ocean under a stormy, overcast sky with dark clouds and hints of distant sunlight breaking through. The horizon shows turbulent waves colliding with rocky outcrops, creating white foam.",
|
| 193 |
+
1,
|
| 194 |
+
true,
|
| 195 |
+
"linear",
|
| 196 |
+
1.0,
|
| 197 |
+
true
|
| 198 |
+
]
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"id": 3,
|
| 202 |
+
"type": "DFlowGuider",
|
| 203 |
+
"pos": [
|
| 204 |
+
80,
|
| 205 |
+
-420
|
| 206 |
+
],
|
| 207 |
+
"size": [
|
| 208 |
+
340,
|
| 209 |
+
446
|
| 210 |
+
],
|
| 211 |
+
"flags": {},
|
| 212 |
+
"order": 2,
|
| 213 |
+
"mode": 0,
|
| 214 |
+
"inputs": [
|
| 215 |
+
{
|
| 216 |
+
"name": "model",
|
| 217 |
+
"type": "DFLOW_MODEL",
|
| 218 |
+
"link": 1
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"name": "positive",
|
| 222 |
+
"type": "DFLOW_CONDITIONING",
|
| 223 |
+
"link": 4
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"name": "pdg_enabled",
|
| 227 |
+
"type": "BOOLEAN",
|
| 228 |
+
"widget": {
|
| 229 |
+
"name": "pdg_enabled"
|
| 230 |
+
},
|
| 231 |
+
"link": null
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"name": "pdg_mode",
|
| 235 |
+
"type": "COMBO",
|
| 236 |
+
"widget": {
|
| 237 |
+
"name": "pdg_mode"
|
| 238 |
+
},
|
| 239 |
+
"link": null
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"name": "pdg_scale",
|
| 243 |
+
"type": "FLOAT",
|
| 244 |
+
"widget": {
|
| 245 |
+
"name": "pdg_scale"
|
| 246 |
+
},
|
| 247 |
+
"link": null
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"name": "pdg_start_step",
|
| 251 |
+
"type": "INT",
|
| 252 |
+
"widget": {
|
| 253 |
+
"name": "pdg_start_step"
|
| 254 |
+
},
|
| 255 |
+
"link": null
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"name": "pdg_stop_step",
|
| 259 |
+
"type": "INT",
|
| 260 |
+
"widget": {
|
| 261 |
+
"name": "pdg_stop_step"
|
| 262 |
+
},
|
| 263 |
+
"link": null
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"name": "pdg_suffix_caption_bias",
|
| 267 |
+
"type": "FLOAT",
|
| 268 |
+
"widget": {
|
| 269 |
+
"name": "pdg_suffix_caption_bias"
|
| 270 |
+
},
|
| 271 |
+
"link": null
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"name": "cfg_enabled",
|
| 275 |
+
"type": "BOOLEAN",
|
| 276 |
+
"widget": {
|
| 277 |
+
"name": "cfg_enabled"
|
| 278 |
+
},
|
| 279 |
+
"link": null
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"name": "cfg_scale",
|
| 283 |
+
"type": "FLOAT",
|
| 284 |
+
"widget": {
|
| 285 |
+
"name": "cfg_scale"
|
| 286 |
+
},
|
| 287 |
+
"link": null
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"name": "cfg_start_step",
|
| 291 |
+
"type": "INT",
|
| 292 |
+
"widget": {
|
| 293 |
+
"name": "cfg_start_step"
|
| 294 |
+
},
|
| 295 |
+
"link": null
|
| 296 |
+
},
|
| 297 |
+
{
|
| 298 |
+
"name": "cfg_stop_step",
|
| 299 |
+
"type": "INT",
|
| 300 |
+
"widget": {
|
| 301 |
+
"name": "cfg_stop_step"
|
| 302 |
+
},
|
| 303 |
+
"link": null
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"name": "self_attention_gain",
|
| 307 |
+
"type": "FLOAT",
|
| 308 |
+
"widget": {
|
| 309 |
+
"name": "self_attention_gain"
|
| 310 |
+
},
|
| 311 |
+
"link": null
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"name": "negative",
|
| 315 |
+
"type": "DFLOW_CONDITIONING",
|
| 316 |
+
"link": null,
|
| 317 |
+
"shape": 7
|
| 318 |
+
}
|
| 319 |
+
],
|
| 320 |
+
"outputs": [
|
| 321 |
+
{
|
| 322 |
+
"name": "guider",
|
| 323 |
+
"type": "GUIDER",
|
| 324 |
+
"slot_index": 0,
|
| 325 |
+
"links": [
|
| 326 |
+
8
|
| 327 |
+
]
|
| 328 |
+
}
|
| 329 |
+
],
|
| 330 |
+
"properties": {
|
| 331 |
+
"Node name for S&R": "DFlowGuider"
|
| 332 |
+
},
|
| 333 |
+
"widgets_values": [
|
| 334 |
+
true,
|
| 335 |
+
"full",
|
| 336 |
+
2.5,
|
| 337 |
+
0,
|
| 338 |
+
-1,
|
| 339 |
+
-4.0,
|
| 340 |
+
false,
|
| 341 |
+
4.0,
|
| 342 |
+
0,
|
| 343 |
+
-1,
|
| 344 |
+
-0.03
|
| 345 |
+
]
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"id": 4,
|
| 349 |
+
"type": "DFlowSampler",
|
| 350 |
+
"pos": [
|
| 351 |
+
-400,
|
| 352 |
+
120
|
| 353 |
+
],
|
| 354 |
+
"size": [
|
| 355 |
+
320,
|
| 356 |
+
110
|
| 357 |
+
],
|
| 358 |
+
"flags": {},
|
| 359 |
+
"order": 3,
|
| 360 |
+
"mode": 0,
|
| 361 |
+
"inputs": [
|
| 362 |
+
{
|
| 363 |
+
"name": "solver",
|
| 364 |
+
"type": "COMBO",
|
| 365 |
+
"widget": {
|
| 366 |
+
"name": "solver"
|
| 367 |
+
},
|
| 368 |
+
"link": null
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"name": "noise_scale",
|
| 372 |
+
"type": "FLOAT",
|
| 373 |
+
"widget": {
|
| 374 |
+
"name": "noise_scale"
|
| 375 |
+
},
|
| 376 |
+
"link": null
|
| 377 |
+
}
|
| 378 |
+
],
|
| 379 |
+
"outputs": [
|
| 380 |
+
{
|
| 381 |
+
"name": "sampler",
|
| 382 |
+
"type": "SAMPLER",
|
| 383 |
+
"slot_index": 0,
|
| 384 |
+
"links": [
|
| 385 |
+
5
|
| 386 |
+
]
|
| 387 |
+
}
|
| 388 |
+
],
|
| 389 |
+
"properties": {
|
| 390 |
+
"Node name for S&R": "DFlowSampler"
|
| 391 |
+
},
|
| 392 |
+
"widgets_values": [
|
| 393 |
+
"er_sde",
|
| 394 |
+
1.0
|
| 395 |
+
]
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
"id": 5,
|
| 399 |
+
"type": "DFlowTimeSchedule",
|
| 400 |
+
"pos": [
|
| 401 |
+
80,
|
| 402 |
+
120
|
| 403 |
+
],
|
| 404 |
+
"size": [
|
| 405 |
+
340,
|
| 406 |
+
270
|
| 407 |
+
],
|
| 408 |
+
"flags": {},
|
| 409 |
+
"order": 6,
|
| 410 |
+
"mode": 0,
|
| 411 |
+
"inputs": [
|
| 412 |
+
{
|
| 413 |
+
"name": "sampler",
|
| 414 |
+
"type": "SAMPLER",
|
| 415 |
+
"link": 5
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"name": "latent",
|
| 419 |
+
"type": "LATENT",
|
| 420 |
+
"link": 6
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"name": "schedule",
|
| 424 |
+
"type": "COMBO",
|
| 425 |
+
"widget": {
|
| 426 |
+
"name": "schedule"
|
| 427 |
+
},
|
| 428 |
+
"link": null
|
| 429 |
+
},
|
| 430 |
+
{
|
| 431 |
+
"name": "steps",
|
| 432 |
+
"type": "INT",
|
| 433 |
+
"widget": {
|
| 434 |
+
"name": "steps"
|
| 435 |
+
},
|
| 436 |
+
"link": null
|
| 437 |
+
},
|
| 438 |
+
{
|
| 439 |
+
"name": "base_log_snr_shift",
|
| 440 |
+
"type": "FLOAT",
|
| 441 |
+
"widget": {
|
| 442 |
+
"name": "base_log_snr_shift"
|
| 443 |
+
},
|
| 444 |
+
"link": null
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"name": "resolution_shift",
|
| 448 |
+
"type": "BOOLEAN",
|
| 449 |
+
"widget": {
|
| 450 |
+
"name": "resolution_shift"
|
| 451 |
+
},
|
| 452 |
+
"link": null
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"name": "beta_mean",
|
| 456 |
+
"type": "FLOAT",
|
| 457 |
+
"widget": {
|
| 458 |
+
"name": "beta_mean"
|
| 459 |
+
},
|
| 460 |
+
"link": null
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"name": "beta_concentration",
|
| 464 |
+
"type": "FLOAT",
|
| 465 |
+
"widget": {
|
| 466 |
+
"name": "beta_concentration"
|
| 467 |
+
},
|
| 468 |
+
"link": null
|
| 469 |
+
}
|
| 470 |
+
],
|
| 471 |
+
"outputs": [
|
| 472 |
+
{
|
| 473 |
+
"name": "sigmas",
|
| 474 |
+
"type": "SIGMAS",
|
| 475 |
+
"slot_index": 0,
|
| 476 |
+
"links": [
|
| 477 |
+
10
|
| 478 |
+
]
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"name": "sampler",
|
| 482 |
+
"type": "SAMPLER",
|
| 483 |
+
"slot_index": 1,
|
| 484 |
+
"links": [
|
| 485 |
+
9
|
| 486 |
+
]
|
| 487 |
+
}
|
| 488 |
+
],
|
| 489 |
+
"properties": {
|
| 490 |
+
"Node name for S&R": "DFlowTimeSchedule"
|
| 491 |
+
},
|
| 492 |
+
"widgets_values": [
|
| 493 |
+
"beta_1_25",
|
| 494 |
+
50,
|
| 495 |
+
-0.25,
|
| 496 |
+
true,
|
| 497 |
+
0.5,
|
| 498 |
+
0.6
|
| 499 |
+
]
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
"id": 6,
|
| 503 |
+
"type": "DFlowEmptyLatent",
|
| 504 |
+
"pos": [
|
| 505 |
+
-400,
|
| 506 |
+
280
|
| 507 |
+
],
|
| 508 |
+
"size": [
|
| 509 |
+
320,
|
| 510 |
+
130
|
| 511 |
+
],
|
| 512 |
+
"flags": {},
|
| 513 |
+
"order": 4,
|
| 514 |
+
"mode": 0,
|
| 515 |
+
"inputs": [
|
| 516 |
+
{
|
| 517 |
+
"name": "width",
|
| 518 |
+
"type": "INT",
|
| 519 |
+
"widget": {
|
| 520 |
+
"name": "width"
|
| 521 |
+
},
|
| 522 |
+
"link": null
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"name": "height",
|
| 526 |
+
"type": "INT",
|
| 527 |
+
"widget": {
|
| 528 |
+
"name": "height"
|
| 529 |
+
},
|
| 530 |
+
"link": null
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"name": "batch_size",
|
| 534 |
+
"type": "INT",
|
| 535 |
+
"widget": {
|
| 536 |
+
"name": "batch_size"
|
| 537 |
+
},
|
| 538 |
+
"link": null
|
| 539 |
+
}
|
| 540 |
+
],
|
| 541 |
+
"outputs": [
|
| 542 |
+
{
|
| 543 |
+
"name": "latent",
|
| 544 |
+
"type": "LATENT",
|
| 545 |
+
"slot_index": 0,
|
| 546 |
+
"links": [
|
| 547 |
+
6,
|
| 548 |
+
11
|
| 549 |
+
]
|
| 550 |
+
}
|
| 551 |
+
],
|
| 552 |
+
"properties": {
|
| 553 |
+
"Node name for S&R": "DFlowEmptyLatent"
|
| 554 |
+
},
|
| 555 |
+
"widgets_values": [
|
| 556 |
+
832,
|
| 557 |
+
1216,
|
| 558 |
+
1
|
| 559 |
+
]
|
| 560 |
+
},
|
| 561 |
+
{
|
| 562 |
+
"id": 7,
|
| 563 |
+
"type": "RandomNoise",
|
| 564 |
+
"pos": [
|
| 565 |
+
80,
|
| 566 |
+
430
|
| 567 |
+
],
|
| 568 |
+
"size": [
|
| 569 |
+
320,
|
| 570 |
+
110
|
| 571 |
+
],
|
| 572 |
+
"flags": {},
|
| 573 |
+
"order": 5,
|
| 574 |
+
"mode": 0,
|
| 575 |
+
"inputs": [
|
| 576 |
+
{
|
| 577 |
+
"name": "noise_seed",
|
| 578 |
+
"type": "INT",
|
| 579 |
+
"widget": {
|
| 580 |
+
"name": "noise_seed"
|
| 581 |
+
},
|
| 582 |
+
"link": null
|
| 583 |
+
}
|
| 584 |
+
],
|
| 585 |
+
"outputs": [
|
| 586 |
+
{
|
| 587 |
+
"name": "NOISE",
|
| 588 |
+
"type": "NOISE",
|
| 589 |
+
"slot_index": 0,
|
| 590 |
+
"links": [
|
| 591 |
+
7
|
| 592 |
+
]
|
| 593 |
+
}
|
| 594 |
+
],
|
| 595 |
+
"properties": {
|
| 596 |
+
"Node name for S&R": "RandomNoise"
|
| 597 |
+
},
|
| 598 |
+
"widgets_values": [
|
| 599 |
+
42,
|
| 600 |
+
"fixed"
|
| 601 |
+
]
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"id": 8,
|
| 605 |
+
"type": "SamplerCustomAdvanced",
|
| 606 |
+
"pos": [
|
| 607 |
+
480,
|
| 608 |
+
-40
|
| 609 |
+
],
|
| 610 |
+
"size": [
|
| 611 |
+
300,
|
| 612 |
+
330
|
| 613 |
+
],
|
| 614 |
+
"flags": {},
|
| 615 |
+
"order": 7,
|
| 616 |
+
"mode": 0,
|
| 617 |
+
"inputs": [
|
| 618 |
+
{
|
| 619 |
+
"name": "noise",
|
| 620 |
+
"type": "NOISE",
|
| 621 |
+
"link": 7
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"name": "guider",
|
| 625 |
+
"type": "GUIDER",
|
| 626 |
+
"link": 8
|
| 627 |
+
},
|
| 628 |
+
{
|
| 629 |
+
"name": "sampler",
|
| 630 |
+
"type": "SAMPLER",
|
| 631 |
+
"link": 9
|
| 632 |
+
},
|
| 633 |
+
{
|
| 634 |
+
"name": "sigmas",
|
| 635 |
+
"type": "SIGMAS",
|
| 636 |
+
"link": 10
|
| 637 |
+
},
|
| 638 |
+
{
|
| 639 |
+
"name": "latent_image",
|
| 640 |
+
"type": "LATENT",
|
| 641 |
+
"link": 11
|
| 642 |
+
}
|
| 643 |
+
],
|
| 644 |
+
"outputs": [
|
| 645 |
+
{
|
| 646 |
+
"name": "output",
|
| 647 |
+
"type": "LATENT",
|
| 648 |
+
"slot_index": 0,
|
| 649 |
+
"links": [
|
| 650 |
+
12
|
| 651 |
+
]
|
| 652 |
+
},
|
| 653 |
+
{
|
| 654 |
+
"name": "denoised_output",
|
| 655 |
+
"type": "LATENT",
|
| 656 |
+
"slot_index": 1,
|
| 657 |
+
"links": []
|
| 658 |
+
}
|
| 659 |
+
],
|
| 660 |
+
"properties": {
|
| 661 |
+
"Node name for S&R": "SamplerCustomAdvanced"
|
| 662 |
+
},
|
| 663 |
+
"widgets_values": []
|
| 664 |
+
},
|
| 665 |
+
{
|
| 666 |
+
"id": 9,
|
| 667 |
+
"type": "VAEDecode",
|
| 668 |
+
"pos": [
|
| 669 |
+
820,
|
| 670 |
+
-40
|
| 671 |
+
],
|
| 672 |
+
"size": [
|
| 673 |
+
220,
|
| 674 |
+
50
|
| 675 |
+
],
|
| 676 |
+
"flags": {},
|
| 677 |
+
"order": 8,
|
| 678 |
+
"mode": 0,
|
| 679 |
+
"inputs": [
|
| 680 |
+
{
|
| 681 |
+
"name": "samples",
|
| 682 |
+
"type": "LATENT",
|
| 683 |
+
"link": 12
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"name": "vae",
|
| 687 |
+
"type": "VAE",
|
| 688 |
+
"link": 3
|
| 689 |
+
}
|
| 690 |
+
],
|
| 691 |
+
"outputs": [
|
| 692 |
+
{
|
| 693 |
+
"name": "IMAGE",
|
| 694 |
+
"type": "IMAGE",
|
| 695 |
+
"slot_index": 0,
|
| 696 |
+
"links": [
|
| 697 |
+
13
|
| 698 |
+
]
|
| 699 |
+
}
|
| 700 |
+
],
|
| 701 |
+
"properties": {
|
| 702 |
+
"Node name for S&R": "VAEDecode"
|
| 703 |
+
},
|
| 704 |
+
"widgets_values": []
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"id": 10,
|
| 708 |
+
"type": "SaveImage",
|
| 709 |
+
"pos": [
|
| 710 |
+
1080,
|
| 711 |
+
-40
|
| 712 |
+
],
|
| 713 |
+
"size": [
|
| 714 |
+
520,
|
| 715 |
+
760
|
| 716 |
+
],
|
| 717 |
+
"flags": {},
|
| 718 |
+
"order": 9,
|
| 719 |
+
"mode": 0,
|
| 720 |
+
"inputs": [
|
| 721 |
+
{
|
| 722 |
+
"name": "images",
|
| 723 |
+
"type": "IMAGE",
|
| 724 |
+
"link": 13
|
| 725 |
+
},
|
| 726 |
+
{
|
| 727 |
+
"name": "filename_prefix",
|
| 728 |
+
"type": "STRING",
|
| 729 |
+
"widget": {
|
| 730 |
+
"name": "filename_prefix"
|
| 731 |
+
},
|
| 732 |
+
"link": null
|
| 733 |
+
}
|
| 734 |
+
],
|
| 735 |
+
"outputs": [
|
| 736 |
+
{
|
| 737 |
+
"name": "images",
|
| 738 |
+
"type": "IMAGE",
|
| 739 |
+
"slot_index": 0,
|
| 740 |
+
"links": []
|
| 741 |
+
}
|
| 742 |
+
],
|
| 743 |
+
"properties": {
|
| 744 |
+
"Node name for S&R": "SaveImage"
|
| 745 |
+
},
|
| 746 |
+
"widgets_values": [
|
| 747 |
+
"dflow"
|
| 748 |
+
]
|
| 749 |
+
}
|
| 750 |
+
],
|
| 751 |
+
"links": [
|
| 752 |
+
[
|
| 753 |
+
1,
|
| 754 |
+
1,
|
| 755 |
+
0,
|
| 756 |
+
3,
|
| 757 |
+
0,
|
| 758 |
+
"DFLOW_MODEL"
|
| 759 |
+
],
|
| 760 |
+
[
|
| 761 |
+
2,
|
| 762 |
+
1,
|
| 763 |
+
1,
|
| 764 |
+
2,
|
| 765 |
+
0,
|
| 766 |
+
"DFLOW_TEXT_ENCODER"
|
| 767 |
+
],
|
| 768 |
+
[
|
| 769 |
+
3,
|
| 770 |
+
1,
|
| 771 |
+
2,
|
| 772 |
+
9,
|
| 773 |
+
1,
|
| 774 |
+
"VAE"
|
| 775 |
+
],
|
| 776 |
+
[
|
| 777 |
+
4,
|
| 778 |
+
2,
|
| 779 |
+
0,
|
| 780 |
+
3,
|
| 781 |
+
1,
|
| 782 |
+
"DFLOW_CONDITIONING"
|
| 783 |
+
],
|
| 784 |
+
[
|
| 785 |
+
5,
|
| 786 |
+
4,
|
| 787 |
+
0,
|
| 788 |
+
5,
|
| 789 |
+
0,
|
| 790 |
+
"SAMPLER"
|
| 791 |
+
],
|
| 792 |
+
[
|
| 793 |
+
6,
|
| 794 |
+
6,
|
| 795 |
+
0,
|
| 796 |
+
5,
|
| 797 |
+
1,
|
| 798 |
+
"LATENT"
|
| 799 |
+
],
|
| 800 |
+
[
|
| 801 |
+
7,
|
| 802 |
+
7,
|
| 803 |
+
0,
|
| 804 |
+
8,
|
| 805 |
+
0,
|
| 806 |
+
"NOISE"
|
| 807 |
+
],
|
| 808 |
+
[
|
| 809 |
+
8,
|
| 810 |
+
3,
|
| 811 |
+
0,
|
| 812 |
+
8,
|
| 813 |
+
1,
|
| 814 |
+
"GUIDER"
|
| 815 |
+
],
|
| 816 |
+
[
|
| 817 |
+
9,
|
| 818 |
+
5,
|
| 819 |
+
1,
|
| 820 |
+
8,
|
| 821 |
+
2,
|
| 822 |
+
"SAMPLER"
|
| 823 |
+
],
|
| 824 |
+
[
|
| 825 |
+
10,
|
| 826 |
+
5,
|
| 827 |
+
0,
|
| 828 |
+
8,
|
| 829 |
+
3,
|
| 830 |
+
"SIGMAS"
|
| 831 |
+
],
|
| 832 |
+
[
|
| 833 |
+
11,
|
| 834 |
+
6,
|
| 835 |
+
0,
|
| 836 |
+
8,
|
| 837 |
+
4,
|
| 838 |
+
"LATENT"
|
| 839 |
+
],
|
| 840 |
+
[
|
| 841 |
+
12,
|
| 842 |
+
8,
|
| 843 |
+
0,
|
| 844 |
+
9,
|
| 845 |
+
0,
|
| 846 |
+
"LATENT"
|
| 847 |
+
],
|
| 848 |
+
[
|
| 849 |
+
13,
|
| 850 |
+
9,
|
| 851 |
+
0,
|
| 852 |
+
10,
|
| 853 |
+
0,
|
| 854 |
+
"IMAGE"
|
| 855 |
+
]
|
| 856 |
+
],
|
| 857 |
+
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "9d55e4c0-e795-42f5-9362-28188f3af55c",
|
| 3 |
+
"revision": 0,
|
| 4 |
+
"last_node_id": 10,
|
| 5 |
+
"last_link_id": 13,
|
| 6 |
+
"nodes": [
|
| 7 |
+
{
|
| 8 |
+
"id": 1,
|
| 9 |
+
"type": "DFlowLoader",
|
| 10 |
+
"pos": [
|
| 11 |
+
-820,
|
| 12 |
+
-40
|
| 13 |
+
],
|
| 14 |
+
"size": [
|
| 15 |
+
360,
|
| 16 |
+
230
|
| 17 |
+
],
|
| 18 |
+
"flags": {},
|
| 19 |
+
"order": 0,
|
| 20 |
+
"mode": 0,
|
| 21 |
+
"inputs": [
|
| 22 |
+
{
|
| 23 |
+
"name": "source",
|
| 24 |
+
"type": "COMBO",
|
| 25 |
+
"widget": {
|
| 26 |
+
"name": "source"
|
| 27 |
+
},
|
| 28 |
+
"link": null
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"name": "local_dir",
|
| 32 |
+
"type": "STRING",
|
| 33 |
+
"widget": {
|
| 34 |
+
"name": "local_dir"
|
| 35 |
+
},
|
| 36 |
+
"link": null
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "repository",
|
| 40 |
+
"type": "STRING",
|
| 41 |
+
"widget": {
|
| 42 |
+
"name": "repository"
|
| 43 |
+
},
|
| 44 |
+
"link": null
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"name": "revision",
|
| 48 |
+
"type": "STRING",
|
| 49 |
+
"widget": {
|
| 50 |
+
"name": "revision"
|
| 51 |
+
},
|
| 52 |
+
"link": null
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"name": "compile_model",
|
| 56 |
+
"type": "BOOLEAN",
|
| 57 |
+
"widget": {
|
| 58 |
+
"name": "compile_model"
|
| 59 |
+
},
|
| 60 |
+
"link": null
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"name": "cache_dir",
|
| 64 |
+
"type": "STRING",
|
| 65 |
+
"widget": {
|
| 66 |
+
"name": "cache_dir"
|
| 67 |
+
},
|
| 68 |
+
"link": null
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"outputs": [
|
| 72 |
+
{
|
| 73 |
+
"name": "model",
|
| 74 |
+
"type": "DFLOW_MODEL",
|
| 75 |
+
"slot_index": 0,
|
| 76 |
+
"links": [
|
| 77 |
+
1
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"name": "text_encoder",
|
| 82 |
+
"type": "DFLOW_TEXT_ENCODER",
|
| 83 |
+
"slot_index": 1,
|
| 84 |
+
"links": [
|
| 85 |
+
2
|
| 86 |
+
]
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"name": "vae",
|
| 90 |
+
"type": "VAE",
|
| 91 |
+
"slot_index": 2,
|
| 92 |
+
"links": [
|
| 93 |
+
3
|
| 94 |
+
]
|
| 95 |
+
}
|
| 96 |
+
],
|
| 97 |
+
"properties": {
|
| 98 |
+
"Node name for S&R": "DFlowLoader"
|
| 99 |
+
},
|
| 100 |
+
"widgets_values": [
|
| 101 |
+
"bundled",
|
| 102 |
+
"",
|
| 103 |
+
"data-archetype/dflow_2b",
|
| 104 |
+
"",
|
| 105 |
+
true,
|
| 106 |
+
""
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"id": 2,
|
| 111 |
+
"type": "DFlowLayoutEncode",
|
| 112 |
+
"pos": [
|
| 113 |
+
-400,
|
| 114 |
+
-520
|
| 115 |
+
],
|
| 116 |
+
"size": [
|
| 117 |
+
440,
|
| 118 |
+
520
|
| 119 |
+
],
|
| 120 |
+
"flags": {},
|
| 121 |
+
"order": 1,
|
| 122 |
+
"mode": 0,
|
| 123 |
+
"inputs": [
|
| 124 |
+
{
|
| 125 |
+
"name": "text_encoder",
|
| 126 |
+
"type": "DFLOW_TEXT_ENCODER",
|
| 127 |
+
"link": 2
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"name": "layout_json",
|
| 131 |
+
"type": "STRING",
|
| 132 |
+
"widget": {
|
| 133 |
+
"name": "layout_json"
|
| 134 |
+
},
|
| 135 |
+
"link": null
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"name": "width",
|
| 139 |
+
"type": "INT",
|
| 140 |
+
"widget": {
|
| 141 |
+
"name": "width"
|
| 142 |
+
},
|
| 143 |
+
"link": null
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"name": "height",
|
| 147 |
+
"type": "INT",
|
| 148 |
+
"widget": {
|
| 149 |
+
"name": "height"
|
| 150 |
+
},
|
| 151 |
+
"link": null
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"name": "batch_size",
|
| 155 |
+
"type": "INT",
|
| 156 |
+
"widget": {
|
| 157 |
+
"name": "batch_size"
|
| 158 |
+
},
|
| 159 |
+
"link": null
|
| 160 |
+
}
|
| 161 |
+
],
|
| 162 |
+
"outputs": [
|
| 163 |
+
{
|
| 164 |
+
"name": "conditioning",
|
| 165 |
+
"type": "DFLOW_CONDITIONING",
|
| 166 |
+
"slot_index": 0,
|
| 167 |
+
"links": [
|
| 168 |
+
4
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
],
|
| 172 |
+
"properties": {
|
| 173 |
+
"Node name for S&R": "DFlowLayoutEncode"
|
| 174 |
+
},
|
| 175 |
+
"widgets_values": [
|
| 176 |
+
"{\n \"summary\": {\n \"meta\": [\n \"concert_poster\",\n \"flat_illustration\",\n \"mid_century_modern\"\n ],\n \"canvas\": \"single\",\n \"caption\": \"A mid-century style jazz festival poster shows a saxophonist in silhouette against a large orange sun on a deep teal background. The title \\\"BLUE HARBOR JAZZ\\\" runs across the top in cream capitals and the line \\\"JULY 12 – 14, 1996\\\" sits at the bottom.\"\n },\n \"frame\": {\n \"caption\": \"The saxophonist stands in the centre, cut off at the knees, with the sun behind his shoulders. The title fills the top fifth and the date line sits in a band along the bottom edge. Flat colour shapes with a light paper grain.\",\n \"tags\": [\n \"flat_color\",\n \"centered_composition\",\n \"paper_grain\"\n ],\n \"palette\": [\n \"#0F4C5C\",\n \"#F28C28\",\n \"#F5E9D0\",\n \"#1B1B1B\"\n ]\n },\n \"items\": [\n {\n \"label\": \"object\",\n \"caption\": \"A large flat orange circle, the sun, behind the musician.\",\n \"tags\": [\n \"sun\",\n \"circle\"\n ],\n \"palette\": [\n \"#F28C28\"\n ],\n \"box_2d\": [\n 230,\n 170,\n 720,\n 830\n ]\n },\n {\n \"label\": \"character\",\n \"caption\": \"A black silhouette of a man in a hat playing a tenor saxophone, facing right, leaning back slightly.\",\n \"tags\": [\n \"saxophonist\",\n \"silhouette\",\n \"hat\"\n ],\n \"palette\": [\n \"#1B1B1B\"\n ],\n \"box_2d\": [\n 260,\n 250,\n 880,\n 760\n ]\n },\n {\n \"label\": \"text\",\n \"caption\": \"The title \\\"BLUE HARBOR JAZZ\\\" in bold condensed cream capitals on one line.\",\n \"text\": \"BLUE HARBOR JAZZ\",\n \"tags\": [\n \"title\",\n \"condensed_sans\",\n \"uppercase\"\n ],\n \"palette\": [\n \"#F5E9D0\"\n ],\n \"box_2d\": [\n 60,\n 70,\n 180,\n 930\n ]\n },\n {\n \"label\": \"text\",\n \"caption\": \"The date line \\\"JULY 12 – 14, 1996\\\" in small spaced cream capitals.\",\n \"text\": \"JULY 12 – 14, 1996\",\n \"tags\": [\n \"date\",\n \"small_caps\"\n ],\n \"palette\": [\n \"#F5E9D0\"\n ],\n \"box_2d\": [\n 905,\n 300,\n 950,\n 700\n ]\n }\n ]\n}",
|
| 177 |
+
832,
|
| 178 |
+
1216,
|
| 179 |
+
1
|
| 180 |
+
]
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"id": 3,
|
| 184 |
+
"type": "DFlowGuider",
|
| 185 |
+
"pos": [
|
| 186 |
+
80,
|
| 187 |
+
-420
|
| 188 |
+
],
|
| 189 |
+
"size": [
|
| 190 |
+
340,
|
| 191 |
+
446
|
| 192 |
+
],
|
| 193 |
+
"flags": {},
|
| 194 |
+
"order": 2,
|
| 195 |
+
"mode": 0,
|
| 196 |
+
"inputs": [
|
| 197 |
+
{
|
| 198 |
+
"name": "model",
|
| 199 |
+
"type": "DFLOW_MODEL",
|
| 200 |
+
"link": 1
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"name": "positive",
|
| 204 |
+
"type": "DFLOW_CONDITIONING",
|
| 205 |
+
"link": 4
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"name": "pdg_enabled",
|
| 209 |
+
"type": "BOOLEAN",
|
| 210 |
+
"widget": {
|
| 211 |
+
"name": "pdg_enabled"
|
| 212 |
+
},
|
| 213 |
+
"link": null
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"name": "pdg_mode",
|
| 217 |
+
"type": "COMBO",
|
| 218 |
+
"widget": {
|
| 219 |
+
"name": "pdg_mode"
|
| 220 |
+
},
|
| 221 |
+
"link": null
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"name": "pdg_scale",
|
| 225 |
+
"type": "FLOAT",
|
| 226 |
+
"widget": {
|
| 227 |
+
"name": "pdg_scale"
|
| 228 |
+
},
|
| 229 |
+
"link": null
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"name": "pdg_start_step",
|
| 233 |
+
"type": "INT",
|
| 234 |
+
"widget": {
|
| 235 |
+
"name": "pdg_start_step"
|
| 236 |
+
},
|
| 237 |
+
"link": null
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"name": "pdg_stop_step",
|
| 241 |
+
"type": "INT",
|
| 242 |
+
"widget": {
|
| 243 |
+
"name": "pdg_stop_step"
|
| 244 |
+
},
|
| 245 |
+
"link": null
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"name": "pdg_suffix_caption_bias",
|
| 249 |
+
"type": "FLOAT",
|
| 250 |
+
"widget": {
|
| 251 |
+
"name": "pdg_suffix_caption_bias"
|
| 252 |
+
},
|
| 253 |
+
"link": null
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"name": "cfg_enabled",
|
| 257 |
+
"type": "BOOLEAN",
|
| 258 |
+
"widget": {
|
| 259 |
+
"name": "cfg_enabled"
|
| 260 |
+
},
|
| 261 |
+
"link": null
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"name": "cfg_scale",
|
| 265 |
+
"type": "FLOAT",
|
| 266 |
+
"widget": {
|
| 267 |
+
"name": "cfg_scale"
|
| 268 |
+
},
|
| 269 |
+
"link": null
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"name": "cfg_start_step",
|
| 273 |
+
"type": "INT",
|
| 274 |
+
"widget": {
|
| 275 |
+
"name": "cfg_start_step"
|
| 276 |
+
},
|
| 277 |
+
"link": null
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"name": "cfg_stop_step",
|
| 281 |
+
"type": "INT",
|
| 282 |
+
"widget": {
|
| 283 |
+
"name": "cfg_stop_step"
|
| 284 |
+
},
|
| 285 |
+
"link": null
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"name": "self_attention_gain",
|
| 289 |
+
"type": "FLOAT",
|
| 290 |
+
"widget": {
|
| 291 |
+
"name": "self_attention_gain"
|
| 292 |
+
},
|
| 293 |
+
"link": null
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"name": "negative",
|
| 297 |
+
"type": "DFLOW_CONDITIONING",
|
| 298 |
+
"link": null,
|
| 299 |
+
"shape": 7
|
| 300 |
+
}
|
| 301 |
+
],
|
| 302 |
+
"outputs": [
|
| 303 |
+
{
|
| 304 |
+
"name": "guider",
|
| 305 |
+
"type": "GUIDER",
|
| 306 |
+
"slot_index": 0,
|
| 307 |
+
"links": [
|
| 308 |
+
8
|
| 309 |
+
]
|
| 310 |
+
}
|
| 311 |
+
],
|
| 312 |
+
"properties": {
|
| 313 |
+
"Node name for S&R": "DFlowGuider"
|
| 314 |
+
},
|
| 315 |
+
"widgets_values": [
|
| 316 |
+
true,
|
| 317 |
+
"full",
|
| 318 |
+
2.5,
|
| 319 |
+
0,
|
| 320 |
+
-1,
|
| 321 |
+
-4.0,
|
| 322 |
+
false,
|
| 323 |
+
4.0,
|
| 324 |
+
0,
|
| 325 |
+
-1,
|
| 326 |
+
-0.03
|
| 327 |
+
]
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"id": 4,
|
| 331 |
+
"type": "DFlowSampler",
|
| 332 |
+
"pos": [
|
| 333 |
+
-400,
|
| 334 |
+
120
|
| 335 |
+
],
|
| 336 |
+
"size": [
|
| 337 |
+
320,
|
| 338 |
+
110
|
| 339 |
+
],
|
| 340 |
+
"flags": {},
|
| 341 |
+
"order": 3,
|
| 342 |
+
"mode": 0,
|
| 343 |
+
"inputs": [
|
| 344 |
+
{
|
| 345 |
+
"name": "solver",
|
| 346 |
+
"type": "COMBO",
|
| 347 |
+
"widget": {
|
| 348 |
+
"name": "solver"
|
| 349 |
+
},
|
| 350 |
+
"link": null
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"name": "noise_scale",
|
| 354 |
+
"type": "FLOAT",
|
| 355 |
+
"widget": {
|
| 356 |
+
"name": "noise_scale"
|
| 357 |
+
},
|
| 358 |
+
"link": null
|
| 359 |
+
}
|
| 360 |
+
],
|
| 361 |
+
"outputs": [
|
| 362 |
+
{
|
| 363 |
+
"name": "sampler",
|
| 364 |
+
"type": "SAMPLER",
|
| 365 |
+
"slot_index": 0,
|
| 366 |
+
"links": [
|
| 367 |
+
5
|
| 368 |
+
]
|
| 369 |
+
}
|
| 370 |
+
],
|
| 371 |
+
"properties": {
|
| 372 |
+
"Node name for S&R": "DFlowSampler"
|
| 373 |
+
},
|
| 374 |
+
"widgets_values": [
|
| 375 |
+
"er_sde",
|
| 376 |
+
1.0
|
| 377 |
+
]
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"id": 5,
|
| 381 |
+
"type": "DFlowTimeSchedule",
|
| 382 |
+
"pos": [
|
| 383 |
+
80,
|
| 384 |
+
120
|
| 385 |
+
],
|
| 386 |
+
"size": [
|
| 387 |
+
340,
|
| 388 |
+
270
|
| 389 |
+
],
|
| 390 |
+
"flags": {},
|
| 391 |
+
"order": 6,
|
| 392 |
+
"mode": 0,
|
| 393 |
+
"inputs": [
|
| 394 |
+
{
|
| 395 |
+
"name": "sampler",
|
| 396 |
+
"type": "SAMPLER",
|
| 397 |
+
"link": 5
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"name": "latent",
|
| 401 |
+
"type": "LATENT",
|
| 402 |
+
"link": 6
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"name": "schedule",
|
| 406 |
+
"type": "COMBO",
|
| 407 |
+
"widget": {
|
| 408 |
+
"name": "schedule"
|
| 409 |
+
},
|
| 410 |
+
"link": null
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"name": "steps",
|
| 414 |
+
"type": "INT",
|
| 415 |
+
"widget": {
|
| 416 |
+
"name": "steps"
|
| 417 |
+
},
|
| 418 |
+
"link": null
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"name": "base_log_snr_shift",
|
| 422 |
+
"type": "FLOAT",
|
| 423 |
+
"widget": {
|
| 424 |
+
"name": "base_log_snr_shift"
|
| 425 |
+
},
|
| 426 |
+
"link": null
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"name": "resolution_shift",
|
| 430 |
+
"type": "BOOLEAN",
|
| 431 |
+
"widget": {
|
| 432 |
+
"name": "resolution_shift"
|
| 433 |
+
},
|
| 434 |
+
"link": null
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"name": "beta_mean",
|
| 438 |
+
"type": "FLOAT",
|
| 439 |
+
"widget": {
|
| 440 |
+
"name": "beta_mean"
|
| 441 |
+
},
|
| 442 |
+
"link": null
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"name": "beta_concentration",
|
| 446 |
+
"type": "FLOAT",
|
| 447 |
+
"widget": {
|
| 448 |
+
"name": "beta_concentration"
|
| 449 |
+
},
|
| 450 |
+
"link": null
|
| 451 |
+
}
|
| 452 |
+
],
|
| 453 |
+
"outputs": [
|
| 454 |
+
{
|
| 455 |
+
"name": "sigmas",
|
| 456 |
+
"type": "SIGMAS",
|
| 457 |
+
"slot_index": 0,
|
| 458 |
+
"links": [
|
| 459 |
+
10
|
| 460 |
+
]
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
"name": "sampler",
|
| 464 |
+
"type": "SAMPLER",
|
| 465 |
+
"slot_index": 1,
|
| 466 |
+
"links": [
|
| 467 |
+
9
|
| 468 |
+
]
|
| 469 |
+
}
|
| 470 |
+
],
|
| 471 |
+
"properties": {
|
| 472 |
+
"Node name for S&R": "DFlowTimeSchedule"
|
| 473 |
+
},
|
| 474 |
+
"widgets_values": [
|
| 475 |
+
"beta_1_25",
|
| 476 |
+
50,
|
| 477 |
+
-0.25,
|
| 478 |
+
true,
|
| 479 |
+
0.5,
|
| 480 |
+
0.6
|
| 481 |
+
]
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
"id": 6,
|
| 485 |
+
"type": "DFlowEmptyLatent",
|
| 486 |
+
"pos": [
|
| 487 |
+
-400,
|
| 488 |
+
280
|
| 489 |
+
],
|
| 490 |
+
"size": [
|
| 491 |
+
320,
|
| 492 |
+
130
|
| 493 |
+
],
|
| 494 |
+
"flags": {},
|
| 495 |
+
"order": 4,
|
| 496 |
+
"mode": 0,
|
| 497 |
+
"inputs": [
|
| 498 |
+
{
|
| 499 |
+
"name": "width",
|
| 500 |
+
"type": "INT",
|
| 501 |
+
"widget": {
|
| 502 |
+
"name": "width"
|
| 503 |
+
},
|
| 504 |
+
"link": null
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"name": "height",
|
| 508 |
+
"type": "INT",
|
| 509 |
+
"widget": {
|
| 510 |
+
"name": "height"
|
| 511 |
+
},
|
| 512 |
+
"link": null
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"name": "batch_size",
|
| 516 |
+
"type": "INT",
|
| 517 |
+
"widget": {
|
| 518 |
+
"name": "batch_size"
|
| 519 |
+
},
|
| 520 |
+
"link": null
|
| 521 |
+
}
|
| 522 |
+
],
|
| 523 |
+
"outputs": [
|
| 524 |
+
{
|
| 525 |
+
"name": "latent",
|
| 526 |
+
"type": "LATENT",
|
| 527 |
+
"slot_index": 0,
|
| 528 |
+
"links": [
|
| 529 |
+
6,
|
| 530 |
+
11
|
| 531 |
+
]
|
| 532 |
+
}
|
| 533 |
+
],
|
| 534 |
+
"properties": {
|
| 535 |
+
"Node name for S&R": "DFlowEmptyLatent"
|
| 536 |
+
},
|
| 537 |
+
"widgets_values": [
|
| 538 |
+
832,
|
| 539 |
+
1216,
|
| 540 |
+
1
|
| 541 |
+
]
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"id": 7,
|
| 545 |
+
"type": "RandomNoise",
|
| 546 |
+
"pos": [
|
| 547 |
+
80,
|
| 548 |
+
430
|
| 549 |
+
],
|
| 550 |
+
"size": [
|
| 551 |
+
320,
|
| 552 |
+
110
|
| 553 |
+
],
|
| 554 |
+
"flags": {},
|
| 555 |
+
"order": 5,
|
| 556 |
+
"mode": 0,
|
| 557 |
+
"inputs": [
|
| 558 |
+
{
|
| 559 |
+
"name": "noise_seed",
|
| 560 |
+
"type": "INT",
|
| 561 |
+
"widget": {
|
| 562 |
+
"name": "noise_seed"
|
| 563 |
+
},
|
| 564 |
+
"link": null
|
| 565 |
+
}
|
| 566 |
+
],
|
| 567 |
+
"outputs": [
|
| 568 |
+
{
|
| 569 |
+
"name": "NOISE",
|
| 570 |
+
"type": "NOISE",
|
| 571 |
+
"slot_index": 0,
|
| 572 |
+
"links": [
|
| 573 |
+
7
|
| 574 |
+
]
|
| 575 |
+
}
|
| 576 |
+
],
|
| 577 |
+
"properties": {
|
| 578 |
+
"Node name for S&R": "RandomNoise"
|
| 579 |
+
},
|
| 580 |
+
"widgets_values": [
|
| 581 |
+
42,
|
| 582 |
+
"fixed"
|
| 583 |
+
]
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"id": 8,
|
| 587 |
+
"type": "SamplerCustomAdvanced",
|
| 588 |
+
"pos": [
|
| 589 |
+
480,
|
| 590 |
+
-40
|
| 591 |
+
],
|
| 592 |
+
"size": [
|
| 593 |
+
300,
|
| 594 |
+
330
|
| 595 |
+
],
|
| 596 |
+
"flags": {},
|
| 597 |
+
"order": 7,
|
| 598 |
+
"mode": 0,
|
| 599 |
+
"inputs": [
|
| 600 |
+
{
|
| 601 |
+
"name": "noise",
|
| 602 |
+
"type": "NOISE",
|
| 603 |
+
"link": 7
|
| 604 |
+
},
|
| 605 |
+
{
|
| 606 |
+
"name": "guider",
|
| 607 |
+
"type": "GUIDER",
|
| 608 |
+
"link": 8
|
| 609 |
+
},
|
| 610 |
+
{
|
| 611 |
+
"name": "sampler",
|
| 612 |
+
"type": "SAMPLER",
|
| 613 |
+
"link": 9
|
| 614 |
+
},
|
| 615 |
+
{
|
| 616 |
+
"name": "sigmas",
|
| 617 |
+
"type": "SIGMAS",
|
| 618 |
+
"link": 10
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
"name": "latent_image",
|
| 622 |
+
"type": "LATENT",
|
| 623 |
+
"link": 11
|
| 624 |
+
}
|
| 625 |
+
],
|
| 626 |
+
"outputs": [
|
| 627 |
+
{
|
| 628 |
+
"name": "output",
|
| 629 |
+
"type": "LATENT",
|
| 630 |
+
"slot_index": 0,
|
| 631 |
+
"links": [
|
| 632 |
+
12
|
| 633 |
+
]
|
| 634 |
+
},
|
| 635 |
+
{
|
| 636 |
+
"name": "denoised_output",
|
| 637 |
+
"type": "LATENT",
|
| 638 |
+
"slot_index": 1,
|
| 639 |
+
"links": []
|
| 640 |
+
}
|
| 641 |
+
],
|
| 642 |
+
"properties": {
|
| 643 |
+
"Node name for S&R": "SamplerCustomAdvanced"
|
| 644 |
+
},
|
| 645 |
+
"widgets_values": []
|
| 646 |
+
},
|
| 647 |
+
{
|
| 648 |
+
"id": 9,
|
| 649 |
+
"type": "VAEDecode",
|
| 650 |
+
"pos": [
|
| 651 |
+
820,
|
| 652 |
+
-40
|
| 653 |
+
],
|
| 654 |
+
"size": [
|
| 655 |
+
220,
|
| 656 |
+
50
|
| 657 |
+
],
|
| 658 |
+
"flags": {},
|
| 659 |
+
"order": 8,
|
| 660 |
+
"mode": 0,
|
| 661 |
+
"inputs": [
|
| 662 |
+
{
|
| 663 |
+
"name": "samples",
|
| 664 |
+
"type": "LATENT",
|
| 665 |
+
"link": 12
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"name": "vae",
|
| 669 |
+
"type": "VAE",
|
| 670 |
+
"link": 3
|
| 671 |
+
}
|
| 672 |
+
],
|
| 673 |
+
"outputs": [
|
| 674 |
+
{
|
| 675 |
+
"name": "IMAGE",
|
| 676 |
+
"type": "IMAGE",
|
| 677 |
+
"slot_index": 0,
|
| 678 |
+
"links": [
|
| 679 |
+
13
|
| 680 |
+
]
|
| 681 |
+
}
|
| 682 |
+
],
|
| 683 |
+
"properties": {
|
| 684 |
+
"Node name for S&R": "VAEDecode"
|
| 685 |
+
},
|
| 686 |
+
"widgets_values": []
|
| 687 |
+
},
|
| 688 |
+
{
|
| 689 |
+
"id": 10,
|
| 690 |
+
"type": "SaveImage",
|
| 691 |
+
"pos": [
|
| 692 |
+
1080,
|
| 693 |
+
-40
|
| 694 |
+
],
|
| 695 |
+
"size": [
|
| 696 |
+
520,
|
| 697 |
+
760
|
| 698 |
+
],
|
| 699 |
+
"flags": {},
|
| 700 |
+
"order": 9,
|
| 701 |
+
"mode": 0,
|
| 702 |
+
"inputs": [
|
| 703 |
+
{
|
| 704 |
+
"name": "images",
|
| 705 |
+
"type": "IMAGE",
|
| 706 |
+
"link": 13
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
"name": "filename_prefix",
|
| 710 |
+
"type": "STRING",
|
| 711 |
+
"widget": {
|
| 712 |
+
"name": "filename_prefix"
|
| 713 |
+
},
|
| 714 |
+
"link": null
|
| 715 |
+
}
|
| 716 |
+
],
|
| 717 |
+
"outputs": [
|
| 718 |
+
{
|
| 719 |
+
"name": "images",
|
| 720 |
+
"type": "IMAGE",
|
| 721 |
+
"slot_index": 0,
|
| 722 |
+
"links": []
|
| 723 |
+
}
|
| 724 |
+
],
|
| 725 |
+
"properties": {
|
| 726 |
+
"Node name for S&R": "SaveImage"
|
| 727 |
+
},
|
| 728 |
+
"widgets_values": [
|
| 729 |
+
"dflow"
|
| 730 |
+
]
|
| 731 |
+
}
|
| 732 |
+
],
|
| 733 |
+
"links": [
|
| 734 |
+
[
|
| 735 |
+
1,
|
| 736 |
+
1,
|
| 737 |
+
0,
|
| 738 |
+
3,
|
| 739 |
+
0,
|
| 740 |
+
"DFLOW_MODEL"
|
| 741 |
+
],
|
| 742 |
+
[
|
| 743 |
+
2,
|
| 744 |
+
1,
|
| 745 |
+
1,
|
| 746 |
+
2,
|
| 747 |
+
0,
|
| 748 |
+
"DFLOW_TEXT_ENCODER"
|
| 749 |
+
],
|
| 750 |
+
[
|
| 751 |
+
3,
|
| 752 |
+
1,
|
| 753 |
+
2,
|
| 754 |
+
9,
|
| 755 |
+
1,
|
| 756 |
+
"VAE"
|
| 757 |
+
],
|
| 758 |
+
[
|
| 759 |
+
4,
|
| 760 |
+
2,
|
| 761 |
+
0,
|
| 762 |
+
3,
|
| 763 |
+
1,
|
| 764 |
+
"DFLOW_CONDITIONING"
|
| 765 |
+
],
|
| 766 |
+
[
|
| 767 |
+
5,
|
| 768 |
+
4,
|
| 769 |
+
0,
|
| 770 |
+
5,
|
| 771 |
+
0,
|
| 772 |
+
"SAMPLER"
|
| 773 |
+
],
|
| 774 |
+
[
|
| 775 |
+
6,
|
| 776 |
+
6,
|
| 777 |
+
0,
|
| 778 |
+
5,
|
| 779 |
+
1,
|
| 780 |
+
"LATENT"
|
| 781 |
+
],
|
| 782 |
+
[
|
| 783 |
+
7,
|
| 784 |
+
7,
|
| 785 |
+
0,
|
| 786 |
+
8,
|
| 787 |
+
0,
|
| 788 |
+
"NOISE"
|
| 789 |
+
],
|
| 790 |
+
[
|
| 791 |
+
8,
|
| 792 |
+
3,
|
| 793 |
+
0,
|
| 794 |
+
8,
|
| 795 |
+
1,
|
| 796 |
+
"GUIDER"
|
| 797 |
+
],
|
| 798 |
+
[
|
| 799 |
+
9,
|
| 800 |
+
5,
|
| 801 |
+
1,
|
| 802 |
+
8,
|
| 803 |
+
2,
|
| 804 |
+
"SAMPLER"
|
| 805 |
+
],
|
| 806 |
+
[
|
| 807 |
+
10,
|
| 808 |
+
5,
|
| 809 |
+
0,
|
| 810 |
+
8,
|
| 811 |
+
3,
|
| 812 |
+
"SIGMAS"
|
| 813 |
+
],
|
| 814 |
+
[
|
| 815 |
+
11,
|
| 816 |
+
6,
|
| 817 |
+
0,
|
| 818 |
+
8,
|
| 819 |
+
4,
|
| 820 |
+
"LATENT"
|
| 821 |
+
],
|
| 822 |
+
[
|
| 823 |
+
12,
|
| 824 |
+
8,
|
| 825 |
+
0,
|
| 826 |
+
9,
|
| 827 |
+
0,
|
| 828 |
+
"LATENT"
|
| 829 |
+
],
|
| 830 |
+
[
|
| 831 |
+
13,
|
| 832 |
+
9,
|
| 833 |
+
0,
|
| 834 |
+
10,
|
| 835 |
+
0,
|
| 836 |
+
"IMAGE"
|
| 837 |
+
]
|
| 838 |
+
],
|
| 839 |
+
"groups": [],
|
| 840 |
+
"config": {},
|
| 841 |
+
"extra": {
|
| 842 |
+
"ds": {
|
| 843 |
+
"scale": 0.7,
|
| 844 |
+
"offset": [
|
| 845 |
+
900,
|
| 846 |
+
420
|
| 847 |
+
]
|
| 848 |
+
}
|
| 849 |
+
},
|
| 850 |
+
"version": 0.4
|
| 851 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"denoiser": {
|
| 3 |
+
"heads": 18,
|
| 4 |
+
"latent_channels": 96,
|
| 5 |
+
"middle_depth": 18,
|
| 6 |
+
"mlp_ratio": 4,
|
| 7 |
+
"norm_eps": 1e-06,
|
| 8 |
+
"patch_size": 1,
|
| 9 |
+
"prefix_depth": 6,
|
| 10 |
+
"rope_axes_dims": [
|
| 11 |
+
32,
|
| 12 |
+
48,
|
| 13 |
+
48
|
| 14 |
+
],
|
| 15 |
+
"rope_axes_lens": [
|
| 16 |
+
8192,
|
| 17 |
+
512,
|
| 18 |
+
512
|
| 19 |
+
],
|
| 20 |
+
"rope_theta": 10000.0,
|
| 21 |
+
"suffix_depth": 6,
|
| 22 |
+
"text_refiner_depth": 2,
|
| 23 |
+
"time_embed_width": 256,
|
| 24 |
+
"time_frequency_width": 256,
|
| 25 |
+
"time_hidden_width": 1024,
|
| 26 |
+
"time_max_period": 10000.0,
|
| 27 |
+
"time_scale": 1000.0,
|
| 28 |
+
"width": 2304
|
| 29 |
+
}
|
| 30 |
+
}
|