aleph65 commited on
Commit
78d3e2e
·
verified ·
1 Parent(s): 4c0f0e7

Add USO style transfer: uso-style-transfer.json

Browse files
Files changed (1) hide show
  1. workflows/uso-style-transfer.json +370 -0
workflows/uso-style-transfer.json ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "last_node_id": 23,
3
+ "last_link_id": 30,
4
+ "nodes": [
5
+ {
6
+ "id": 1,
7
+ "type": "CheckpointLoaderSimple",
8
+ "pos": [40, 60],
9
+ "size": [340, 98],
10
+ "flags": {},
11
+ "order": 0,
12
+ "mode": 0,
13
+ "inputs": [],
14
+ "outputs": [
15
+ {"name": "MODEL", "type": "MODEL", "links": [1, 27], "slot_index": 0},
16
+ {"name": "CLIP", "type": "CLIP", "links": [2], "slot_index": 1},
17
+ {"name": "VAE", "type": "VAE", "links": [3, 4], "slot_index": 2}
18
+ ],
19
+ "properties": {"Node name for S&R": "CheckpointLoaderSimple"},
20
+ "widgets_values": ["flux1-dev-fp8.safetensors"],
21
+ "title": "Load FLUX.1 Dev fp8 (all-in-one checkpoint)"
22
+ },
23
+ {
24
+ "id": 2,
25
+ "type": "LoraLoaderModelOnly",
26
+ "pos": [40, 210],
27
+ "size": [340, 82],
28
+ "flags": {},
29
+ "order": 6,
30
+ "mode": 0,
31
+ "inputs": [{"name": "model", "type": "MODEL", "link": 1}],
32
+ "outputs": [{"name": "MODEL", "type": "MODEL", "links": [5], "slot_index": 0}],
33
+ "properties": {"Node name for S&R": "LoraLoaderModelOnly"},
34
+ "widgets_values": ["uso-flux1-dit-lora-v1.safetensors", 1.0],
35
+ "title": "USO DiT LoRA"
36
+ },
37
+ {
38
+ "id": 3,
39
+ "type": "ModelPatchLoader",
40
+ "pos": [40, 340],
41
+ "size": [340, 58],
42
+ "flags": {},
43
+ "order": 1,
44
+ "mode": 0,
45
+ "inputs": [],
46
+ "outputs": [{"name": "MODEL_PATCH", "type": "MODEL_PATCH", "links": [6, 7], "slot_index": 0}],
47
+ "properties": {"Node name for S&R": "ModelPatchLoader"},
48
+ "widgets_values": ["uso-flux1-projector-v1.safetensors"],
49
+ "title": "USO Projector (model patch)"
50
+ },
51
+ {
52
+ "id": 4,
53
+ "type": "CLIPVisionLoader",
54
+ "pos": [40, 450],
55
+ "size": [340, 58],
56
+ "flags": {},
57
+ "order": 2,
58
+ "mode": 0,
59
+ "inputs": [],
60
+ "outputs": [{"name": "CLIP_VISION", "type": "CLIP_VISION", "links": [8, 9], "slot_index": 0}],
61
+ "properties": {"Node name for S&R": "CLIPVisionLoader"},
62
+ "widgets_values": ["sigclip_vision_patch14_384.safetensors"],
63
+ "title": "Load SigCLIP Vision"
64
+ },
65
+ {
66
+ "id": 12,
67
+ "type": "LoadImage",
68
+ "pos": [40, 560],
69
+ "size": [340, 314],
70
+ "flags": {},
71
+ "order": 3,
72
+ "mode": 0,
73
+ "inputs": [],
74
+ "outputs": [
75
+ {"name": "IMAGE", "type": "IMAGE", "links": [10], "slot_index": 0},
76
+ {"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
77
+ ],
78
+ "properties": {"Node name for S&R": "LoadImage"},
79
+ "widgets_values": ["example.png", "image"],
80
+ "title": "Style Reference Image"
81
+ },
82
+ {
83
+ "id": 5,
84
+ "type": "CLIPVisionEncode",
85
+ "pos": [440, 560],
86
+ "size": [300, 78],
87
+ "flags": {},
88
+ "order": 7,
89
+ "mode": 0,
90
+ "inputs": [
91
+ {"name": "clip_vision", "type": "CLIP_VISION", "link": 8},
92
+ {"name": "image", "type": "IMAGE", "link": 10}
93
+ ],
94
+ "outputs": [{"name": "CLIP_VISION_OUTPUT", "type": "CLIP_VISION_OUTPUT", "links": [11], "slot_index": 0}],
95
+ "properties": {"Node name for S&R": "CLIPVisionEncode"},
96
+ "widgets_values": ["center"],
97
+ "title": "Encode Style 1"
98
+ },
99
+ {
100
+ "id": 6,
101
+ "type": "USOStyleReference",
102
+ "pos": [440, 690],
103
+ "size": [300, 78],
104
+ "flags": {},
105
+ "order": 11,
106
+ "mode": 0,
107
+ "inputs": [
108
+ {"name": "model", "type": "MODEL", "link": 5},
109
+ {"name": "model_patch", "type": "MODEL_PATCH", "link": 6},
110
+ {"name": "clip_vision_output", "type": "CLIP_VISION_OUTPUT", "link": 11}
111
+ ],
112
+ "outputs": [{"name": "MODEL", "type": "MODEL", "links": [12], "slot_index": 0}],
113
+ "properties": {"Node name for S&R": "USOStyleReference"},
114
+ "title": "Apply USO Style 1"
115
+ },
116
+ {
117
+ "id": 18,
118
+ "type": "LoadImage",
119
+ "pos": [40, 930],
120
+ "size": [340, 314],
121
+ "flags": {},
122
+ "order": 4,
123
+ "mode": 4,
124
+ "inputs": [],
125
+ "outputs": [
126
+ {"name": "IMAGE", "type": "IMAGE", "links": [21], "slot_index": 0},
127
+ {"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
128
+ ],
129
+ "properties": {"Node name for S&R": "LoadImage"},
130
+ "widgets_values": ["example.png", "image"],
131
+ "title": "Style Reference 2 (bypassed — right-click ▸ Bypass to enable)"
132
+ },
133
+ {
134
+ "id": 19,
135
+ "type": "CLIPVisionEncode",
136
+ "pos": [440, 930],
137
+ "size": [300, 78],
138
+ "flags": {},
139
+ "order": 10,
140
+ "mode": 4,
141
+ "inputs": [
142
+ {"name": "clip_vision", "type": "CLIP_VISION", "link": 9},
143
+ {"name": "image", "type": "IMAGE", "link": 21}
144
+ ],
145
+ "outputs": [{"name": "CLIP_VISION_OUTPUT", "type": "CLIP_VISION_OUTPUT", "links": [13], "slot_index": 0}],
146
+ "properties": {"Node name for S&R": "CLIPVisionEncode"},
147
+ "widgets_values": ["center"],
148
+ "title": "Encode Style 2 (bypassed)"
149
+ },
150
+ {
151
+ "id": 20,
152
+ "type": "USOStyleReference",
153
+ "pos": [440, 1060],
154
+ "size": [300, 78],
155
+ "flags": {},
156
+ "order": 14,
157
+ "mode": 4,
158
+ "inputs": [
159
+ {"name": "model", "type": "MODEL", "link": 12},
160
+ {"name": "model_patch", "type": "MODEL_PATCH", "link": 7},
161
+ {"name": "clip_vision_output", "type": "CLIP_VISION_OUTPUT", "link": 13}
162
+ ],
163
+ "outputs": [{"name": "MODEL", "type": "MODEL", "links": [14], "slot_index": 0}],
164
+ "properties": {"Node name for S&R": "USOStyleReference"},
165
+ "title": "Apply USO Style 2 (bypassed)"
166
+ },
167
+ {
168
+ "id": 14,
169
+ "type": "LoadImage",
170
+ "pos": [800, 560],
171
+ "size": [340, 314],
172
+ "flags": {},
173
+ "order": 5,
174
+ "mode": 0,
175
+ "inputs": [],
176
+ "outputs": [
177
+ {"name": "IMAGE", "type": "IMAGE", "links": [22], "slot_index": 0},
178
+ {"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
179
+ ],
180
+ "properties": {"Node name for S&R": "LoadImage"},
181
+ "widgets_values": ["example.png", "image"],
182
+ "title": "Content Image (what to restyle)"
183
+ },
184
+ {
185
+ "id": 15,
186
+ "type": "ImageScaleToMaxDimension",
187
+ "pos": [800, 930],
188
+ "size": [300, 82],
189
+ "flags": {},
190
+ "order": 9,
191
+ "mode": 0,
192
+ "inputs": [{"name": "image", "type": "IMAGE", "link": 22}],
193
+ "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [23], "slot_index": 0}],
194
+ "properties": {"Node name for S&R": "ImageScaleToMaxDimension"},
195
+ "widgets_values": ["lanczos", 1280],
196
+ "title": "Scale content (working resolution)"
197
+ },
198
+ {
199
+ "id": 10,
200
+ "type": "VAEEncode",
201
+ "pos": [800, 1060],
202
+ "size": [300, 46],
203
+ "flags": {},
204
+ "order": 13,
205
+ "mode": 0,
206
+ "inputs": [
207
+ {"name": "pixels", "type": "IMAGE", "link": 23},
208
+ {"name": "vae", "type": "VAE", "link": 3}
209
+ ],
210
+ "outputs": [{"name": "LATENT", "type": "LATENT", "links": [17], "slot_index": 0}],
211
+ "properties": {"Node name for S&R": "VAEEncode"},
212
+ "title": "VAE Encode content"
213
+ },
214
+ {
215
+ "id": 7,
216
+ "type": "CLIPTextEncode",
217
+ "pos": [440, 60],
218
+ "size": [420, 160],
219
+ "flags": {},
220
+ "order": 8,
221
+ "mode": 0,
222
+ "inputs": [{"name": "clip", "type": "CLIP", "link": 2}],
223
+ "outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [15, 16], "slot_index": 0}],
224
+ "properties": {"Node name for S&R": "CLIPTextEncode"},
225
+ "widgets_values": ["A high quality photo of a young woman, natural skin texture, professional photography"],
226
+ "title": "Positive Prompt (describe the content image!)"
227
+ },
228
+ {
229
+ "id": 11,
230
+ "type": "FluxGuidance",
231
+ "pos": [900, 120],
232
+ "size": [260, 58],
233
+ "flags": {},
234
+ "order": 12,
235
+ "mode": 0,
236
+ "inputs": [{"name": "conditioning", "type": "CONDITIONING", "link": 15}],
237
+ "outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [19, 28], "slot_index": 0}],
238
+ "properties": {"Node name for S&R": "FluxGuidance"},
239
+ "widgets_values": [3.5],
240
+ "title": "Flux Guidance"
241
+ },
242
+ {
243
+ "id": 9,
244
+ "type": "ConditioningZeroOut",
245
+ "pos": [900, 240],
246
+ "size": [260, 26],
247
+ "flags": {},
248
+ "order": 15,
249
+ "mode": 0,
250
+ "inputs": [{"name": "conditioning", "type": "CONDITIONING", "link": 16}],
251
+ "outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [20, 29], "slot_index": 0}],
252
+ "properties": {"Node name for S&R": "ConditioningZeroOut"},
253
+ "title": "Negative (zeroed — flux uses CFG 1)"
254
+ },
255
+ {
256
+ "id": 13,
257
+ "type": "KSampler",
258
+ "pos": [1220, 60],
259
+ "size": [315, 262],
260
+ "flags": {},
261
+ "order": 16,
262
+ "mode": 0,
263
+ "inputs": [
264
+ {"name": "model", "type": "MODEL", "link": 14},
265
+ {"name": "positive", "type": "CONDITIONING", "link": 19},
266
+ {"name": "negative", "type": "CONDITIONING", "link": 20},
267
+ {"name": "latent_image", "type": "LATENT", "link": 17}
268
+ ],
269
+ "outputs": [{"name": "LATENT", "type": "LATENT", "links": [25], "slot_index": 0}],
270
+ "properties": {"Node name for S&R": "KSampler"},
271
+ "widgets_values": [42, "randomize", 20, 1.0, "euler", "simple", 0.6],
272
+ "title": "Pass 1 — USO style (denoise = style strength)"
273
+ },
274
+ {
275
+ "id": 23,
276
+ "type": "KSampler",
277
+ "pos": [1220, 380],
278
+ "size": [315, 262],
279
+ "flags": {},
280
+ "order": 17,
281
+ "mode": 0,
282
+ "inputs": [
283
+ {"name": "model", "type": "MODEL", "link": 27},
284
+ {"name": "positive", "type": "CONDITIONING", "link": 28},
285
+ {"name": "negative", "type": "CONDITIONING", "link": 29},
286
+ {"name": "latent_image", "type": "LATENT", "link": 25}
287
+ ],
288
+ "outputs": [{"name": "LATENT", "type": "LATENT", "links": [30], "slot_index": 0}],
289
+ "properties": {"Node name for S&R": "KSampler"},
290
+ "widgets_values": [42, "randomize", 20, 1.0, "euler", "simple", 0.3],
291
+ "title": "Pass 2 — plain flux refine (cleans USO texture)"
292
+ },
293
+ {
294
+ "id": 16,
295
+ "type": "VAEDecode",
296
+ "pos": [1580, 380],
297
+ "size": [210, 46],
298
+ "flags": {},
299
+ "order": 18,
300
+ "mode": 0,
301
+ "inputs": [
302
+ {"name": "samples", "type": "LATENT", "link": 30},
303
+ {"name": "vae", "type": "VAE", "link": 4}
304
+ ],
305
+ "outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [26], "slot_index": 0}],
306
+ "properties": {"Node name for S&R": "VAEDecode"}
307
+ },
308
+ {
309
+ "id": 21,
310
+ "type": "SaveImage",
311
+ "pos": [1580, 480],
312
+ "size": [360, 270],
313
+ "flags": {},
314
+ "order": 19,
315
+ "mode": 0,
316
+ "inputs": [{"name": "images", "type": "IMAGE", "link": 26}],
317
+ "outputs": [],
318
+ "properties": {"Node name for S&R": "SaveImage"},
319
+ "widgets_values": ["uso_style_transfer"]
320
+ },
321
+ {
322
+ "id": 22,
323
+ "type": "MarkdownNote",
324
+ "pos": [1940, 60],
325
+ "size": [480, 460],
326
+ "flags": {},
327
+ "order": 20,
328
+ "mode": 0,
329
+ "inputs": [],
330
+ "outputs": [],
331
+ "properties": {"Node name for S&R": "MarkdownNote"},
332
+ "widgets_values": ["## FLUX.1 USO — photo style transfer (two-pass)\n\nByteDance **USO** (Unified Style & subject-driven generation) on FLUX.1-dev, ComfyUI native nodes. Re-renders a content image in the look of a style reference (color grade, lighting, overall aesthetic) while keeping composition and scene.\n\n**Two-pass design:** USO at full strength leaves a papery canvas texture on photos, so Pass 1 (USO model, i2i on the content latent) applies the style, then Pass 2 (plain flux, low denoise) re-refines to clean photographic texture. Bypass Pass 2 if you *want* the painterly look.\n\n**Models** (all on HF `aleph65/ComfyUI`, originals from Comfy-Org):\n- `checkpoints/flux1-dev-fp8.safetensors` (unet+clip+t5+vae in one)\n- `loras/uso-flux1-dit-lora-v1.safetensors` (strength 1.0)\n- `model_patches/uso-flux1-projector-v1.safetensors`\n- `clip_vision/sigclip_vision_patch14_384.safetensors`\n\n**How to drive it:**\n- **Prompt matters**: describe the content image (subject, setting, lighting). Generic prompts or \"like the reference\" phrasing cause collage/painting failures.\n- *Pass 1 denoise* = style strength: 0.5 subtle grade / 0.6 default / 0.75 strong restyle. *Pass 2 denoise* 0.25–0.35; higher drifts identity.\n- *Style Reference 2* group is a bypassed placeholder — enable all three nodes to blend two styles.\n- Do **not** feed full scenes through `ReferenceLatent` (USO subject-ref) — it pastes the reference as an inset panel. This workflow deliberately skips it; subject mode only works with tight subject crops on clean backgrounds.\n\n**Sampler (both passes):** 20 steps / CFG 1.0 / euler / simple, FluxGuidance 3.5.\n\n**Credits:** [ComfyUI USO docs](https://docs.comfy.org/tutorials/flux/flux-1-uso) · video: [Codebreakers — The Ultimate Style Transfer and Character Consistency Workflow](https://www.youtube.com/watch?v=0m99y4B9Cs4)"],
333
+ "title": "About this workflow"
334
+ }
335
+ ],
336
+ "links": [
337
+ [1, 1, 0, 2, 0, "MODEL"],
338
+ [2, 1, 1, 7, 0, "CLIP"],
339
+ [3, 1, 2, 10, 1, "VAE"],
340
+ [4, 1, 2, 16, 1, "VAE"],
341
+ [5, 2, 0, 6, 0, "MODEL"],
342
+ [6, 3, 0, 6, 1, "MODEL_PATCH"],
343
+ [7, 3, 0, 20, 1, "MODEL_PATCH"],
344
+ [8, 4, 0, 5, 0, "CLIP_VISION"],
345
+ [9, 4, 0, 19, 0, "CLIP_VISION"],
346
+ [10, 12, 0, 5, 1, "IMAGE"],
347
+ [11, 5, 0, 6, 2, "CLIP_VISION_OUTPUT"],
348
+ [12, 6, 0, 20, 0, "MODEL"],
349
+ [13, 19, 0, 20, 2, "CLIP_VISION_OUTPUT"],
350
+ [14, 20, 0, 13, 0, "MODEL"],
351
+ [15, 7, 0, 11, 0, "CONDITIONING"],
352
+ [16, 7, 0, 9, 0, "CONDITIONING"],
353
+ [17, 10, 0, 13, 3, "LATENT"],
354
+ [19, 11, 0, 13, 1, "CONDITIONING"],
355
+ [20, 9, 0, 13, 2, "CONDITIONING"],
356
+ [21, 18, 0, 19, 1, "IMAGE"],
357
+ [22, 14, 0, 15, 0, "IMAGE"],
358
+ [23, 15, 0, 10, 0, "IMAGE"],
359
+ [25, 13, 0, 23, 3, "LATENT"],
360
+ [26, 16, 0, 21, 0, "IMAGE"],
361
+ [27, 1, 0, 23, 0, "MODEL"],
362
+ [28, 11, 0, 23, 1, "CONDITIONING"],
363
+ [29, 9, 0, 23, 2, "CONDITIONING"],
364
+ [30, 23, 0, 16, 0, "LATENT"]
365
+ ],
366
+ "groups": [],
367
+ "config": {},
368
+ "extra": {},
369
+ "version": 0.4
370
+ }