ComfyUI / workflows /uso-style-transfer.json
aleph65's picture
Add USO style transfer: uso-style-transfer.json
78d3e2e verified
Raw
History Blame
13.9 kB
{
"last_node_id": 23,
"last_link_id": 30,
"nodes": [
{
"id": 1,
"type": "CheckpointLoaderSimple",
"pos": [40, 60],
"size": [340, 98],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{"name": "MODEL", "type": "MODEL", "links": [1, 27], "slot_index": 0},
{"name": "CLIP", "type": "CLIP", "links": [2], "slot_index": 1},
{"name": "VAE", "type": "VAE", "links": [3, 4], "slot_index": 2}
],
"properties": {"Node name for S&R": "CheckpointLoaderSimple"},
"widgets_values": ["flux1-dev-fp8.safetensors"],
"title": "Load FLUX.1 Dev fp8 (all-in-one checkpoint)"
},
{
"id": 2,
"type": "LoraLoaderModelOnly",
"pos": [40, 210],
"size": [340, 82],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [{"name": "model", "type": "MODEL", "link": 1}],
"outputs": [{"name": "MODEL", "type": "MODEL", "links": [5], "slot_index": 0}],
"properties": {"Node name for S&R": "LoraLoaderModelOnly"},
"widgets_values": ["uso-flux1-dit-lora-v1.safetensors", 1.0],
"title": "USO DiT LoRA"
},
{
"id": 3,
"type": "ModelPatchLoader",
"pos": [40, 340],
"size": [340, 58],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [{"name": "MODEL_PATCH", "type": "MODEL_PATCH", "links": [6, 7], "slot_index": 0}],
"properties": {"Node name for S&R": "ModelPatchLoader"},
"widgets_values": ["uso-flux1-projector-v1.safetensors"],
"title": "USO Projector (model patch)"
},
{
"id": 4,
"type": "CLIPVisionLoader",
"pos": [40, 450],
"size": [340, 58],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [],
"outputs": [{"name": "CLIP_VISION", "type": "CLIP_VISION", "links": [8, 9], "slot_index": 0}],
"properties": {"Node name for S&R": "CLIPVisionLoader"},
"widgets_values": ["sigclip_vision_patch14_384.safetensors"],
"title": "Load SigCLIP Vision"
},
{
"id": 12,
"type": "LoadImage",
"pos": [40, 560],
"size": [340, 314],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [],
"outputs": [
{"name": "IMAGE", "type": "IMAGE", "links": [10], "slot_index": 0},
{"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
],
"properties": {"Node name for S&R": "LoadImage"},
"widgets_values": ["example.png", "image"],
"title": "Style Reference Image"
},
{
"id": 5,
"type": "CLIPVisionEncode",
"pos": [440, 560],
"size": [300, 78],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{"name": "clip_vision", "type": "CLIP_VISION", "link": 8},
{"name": "image", "type": "IMAGE", "link": 10}
],
"outputs": [{"name": "CLIP_VISION_OUTPUT", "type": "CLIP_VISION_OUTPUT", "links": [11], "slot_index": 0}],
"properties": {"Node name for S&R": "CLIPVisionEncode"},
"widgets_values": ["center"],
"title": "Encode Style 1"
},
{
"id": 6,
"type": "USOStyleReference",
"pos": [440, 690],
"size": [300, 78],
"flags": {},
"order": 11,
"mode": 0,
"inputs": [
{"name": "model", "type": "MODEL", "link": 5},
{"name": "model_patch", "type": "MODEL_PATCH", "link": 6},
{"name": "clip_vision_output", "type": "CLIP_VISION_OUTPUT", "link": 11}
],
"outputs": [{"name": "MODEL", "type": "MODEL", "links": [12], "slot_index": 0}],
"properties": {"Node name for S&R": "USOStyleReference"},
"title": "Apply USO Style 1"
},
{
"id": 18,
"type": "LoadImage",
"pos": [40, 930],
"size": [340, 314],
"flags": {},
"order": 4,
"mode": 4,
"inputs": [],
"outputs": [
{"name": "IMAGE", "type": "IMAGE", "links": [21], "slot_index": 0},
{"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
],
"properties": {"Node name for S&R": "LoadImage"},
"widgets_values": ["example.png", "image"],
"title": "Style Reference 2 (bypassed — right-click ▸ Bypass to enable)"
},
{
"id": 19,
"type": "CLIPVisionEncode",
"pos": [440, 930],
"size": [300, 78],
"flags": {},
"order": 10,
"mode": 4,
"inputs": [
{"name": "clip_vision", "type": "CLIP_VISION", "link": 9},
{"name": "image", "type": "IMAGE", "link": 21}
],
"outputs": [{"name": "CLIP_VISION_OUTPUT", "type": "CLIP_VISION_OUTPUT", "links": [13], "slot_index": 0}],
"properties": {"Node name for S&R": "CLIPVisionEncode"},
"widgets_values": ["center"],
"title": "Encode Style 2 (bypassed)"
},
{
"id": 20,
"type": "USOStyleReference",
"pos": [440, 1060],
"size": [300, 78],
"flags": {},
"order": 14,
"mode": 4,
"inputs": [
{"name": "model", "type": "MODEL", "link": 12},
{"name": "model_patch", "type": "MODEL_PATCH", "link": 7},
{"name": "clip_vision_output", "type": "CLIP_VISION_OUTPUT", "link": 13}
],
"outputs": [{"name": "MODEL", "type": "MODEL", "links": [14], "slot_index": 0}],
"properties": {"Node name for S&R": "USOStyleReference"},
"title": "Apply USO Style 2 (bypassed)"
},
{
"id": 14,
"type": "LoadImage",
"pos": [800, 560],
"size": [340, 314],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [],
"outputs": [
{"name": "IMAGE", "type": "IMAGE", "links": [22], "slot_index": 0},
{"name": "MASK", "type": "MASK", "links": [], "slot_index": 1}
],
"properties": {"Node name for S&R": "LoadImage"},
"widgets_values": ["example.png", "image"],
"title": "Content Image (what to restyle)"
},
{
"id": 15,
"type": "ImageScaleToMaxDimension",
"pos": [800, 930],
"size": [300, 82],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [{"name": "image", "type": "IMAGE", "link": 22}],
"outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [23], "slot_index": 0}],
"properties": {"Node name for S&R": "ImageScaleToMaxDimension"},
"widgets_values": ["lanczos", 1280],
"title": "Scale content (working resolution)"
},
{
"id": 10,
"type": "VAEEncode",
"pos": [800, 1060],
"size": [300, 46],
"flags": {},
"order": 13,
"mode": 0,
"inputs": [
{"name": "pixels", "type": "IMAGE", "link": 23},
{"name": "vae", "type": "VAE", "link": 3}
],
"outputs": [{"name": "LATENT", "type": "LATENT", "links": [17], "slot_index": 0}],
"properties": {"Node name for S&R": "VAEEncode"},
"title": "VAE Encode content"
},
{
"id": 7,
"type": "CLIPTextEncode",
"pos": [440, 60],
"size": [420, 160],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [{"name": "clip", "type": "CLIP", "link": 2}],
"outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [15, 16], "slot_index": 0}],
"properties": {"Node name for S&R": "CLIPTextEncode"},
"widgets_values": ["A high quality photo of a young woman, natural skin texture, professional photography"],
"title": "Positive Prompt (describe the content image!)"
},
{
"id": 11,
"type": "FluxGuidance",
"pos": [900, 120],
"size": [260, 58],
"flags": {},
"order": 12,
"mode": 0,
"inputs": [{"name": "conditioning", "type": "CONDITIONING", "link": 15}],
"outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [19, 28], "slot_index": 0}],
"properties": {"Node name for S&R": "FluxGuidance"},
"widgets_values": [3.5],
"title": "Flux Guidance"
},
{
"id": 9,
"type": "ConditioningZeroOut",
"pos": [900, 240],
"size": [260, 26],
"flags": {},
"order": 15,
"mode": 0,
"inputs": [{"name": "conditioning", "type": "CONDITIONING", "link": 16}],
"outputs": [{"name": "CONDITIONING", "type": "CONDITIONING", "links": [20, 29], "slot_index": 0}],
"properties": {"Node name for S&R": "ConditioningZeroOut"},
"title": "Negative (zeroed — flux uses CFG 1)"
},
{
"id": 13,
"type": "KSampler",
"pos": [1220, 60],
"size": [315, 262],
"flags": {},
"order": 16,
"mode": 0,
"inputs": [
{"name": "model", "type": "MODEL", "link": 14},
{"name": "positive", "type": "CONDITIONING", "link": 19},
{"name": "negative", "type": "CONDITIONING", "link": 20},
{"name": "latent_image", "type": "LATENT", "link": 17}
],
"outputs": [{"name": "LATENT", "type": "LATENT", "links": [25], "slot_index": 0}],
"properties": {"Node name for S&R": "KSampler"},
"widgets_values": [42, "randomize", 20, 1.0, "euler", "simple", 0.6],
"title": "Pass 1 — USO style (denoise = style strength)"
},
{
"id": 23,
"type": "KSampler",
"pos": [1220, 380],
"size": [315, 262],
"flags": {},
"order": 17,
"mode": 0,
"inputs": [
{"name": "model", "type": "MODEL", "link": 27},
{"name": "positive", "type": "CONDITIONING", "link": 28},
{"name": "negative", "type": "CONDITIONING", "link": 29},
{"name": "latent_image", "type": "LATENT", "link": 25}
],
"outputs": [{"name": "LATENT", "type": "LATENT", "links": [30], "slot_index": 0}],
"properties": {"Node name for S&R": "KSampler"},
"widgets_values": [42, "randomize", 20, 1.0, "euler", "simple", 0.3],
"title": "Pass 2 — plain flux refine (cleans USO texture)"
},
{
"id": 16,
"type": "VAEDecode",
"pos": [1580, 380],
"size": [210, 46],
"flags": {},
"order": 18,
"mode": 0,
"inputs": [
{"name": "samples", "type": "LATENT", "link": 30},
{"name": "vae", "type": "VAE", "link": 4}
],
"outputs": [{"name": "IMAGE", "type": "IMAGE", "links": [26], "slot_index": 0}],
"properties": {"Node name for S&R": "VAEDecode"}
},
{
"id": 21,
"type": "SaveImage",
"pos": [1580, 480],
"size": [360, 270],
"flags": {},
"order": 19,
"mode": 0,
"inputs": [{"name": "images", "type": "IMAGE", "link": 26}],
"outputs": [],
"properties": {"Node name for S&R": "SaveImage"},
"widgets_values": ["uso_style_transfer"]
},
{
"id": 22,
"type": "MarkdownNote",
"pos": [1940, 60],
"size": [480, 460],
"flags": {},
"order": 20,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {"Node name for S&R": "MarkdownNote"},
"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)"],
"title": "About this workflow"
}
],
"links": [
[1, 1, 0, 2, 0, "MODEL"],
[2, 1, 1, 7, 0, "CLIP"],
[3, 1, 2, 10, 1, "VAE"],
[4, 1, 2, 16, 1, "VAE"],
[5, 2, 0, 6, 0, "MODEL"],
[6, 3, 0, 6, 1, "MODEL_PATCH"],
[7, 3, 0, 20, 1, "MODEL_PATCH"],
[8, 4, 0, 5, 0, "CLIP_VISION"],
[9, 4, 0, 19, 0, "CLIP_VISION"],
[10, 12, 0, 5, 1, "IMAGE"],
[11, 5, 0, 6, 2, "CLIP_VISION_OUTPUT"],
[12, 6, 0, 20, 0, "MODEL"],
[13, 19, 0, 20, 2, "CLIP_VISION_OUTPUT"],
[14, 20, 0, 13, 0, "MODEL"],
[15, 7, 0, 11, 0, "CONDITIONING"],
[16, 7, 0, 9, 0, "CONDITIONING"],
[17, 10, 0, 13, 3, "LATENT"],
[19, 11, 0, 13, 1, "CONDITIONING"],
[20, 9, 0, 13, 2, "CONDITIONING"],
[21, 18, 0, 19, 1, "IMAGE"],
[22, 14, 0, 15, 0, "IMAGE"],
[23, 15, 0, 10, 0, "IMAGE"],
[25, 13, 0, 23, 3, "LATENT"],
[26, 16, 0, 21, 0, "IMAGE"],
[27, 1, 0, 23, 0, "MODEL"],
[28, 11, 0, 23, 1, "CONDITIONING"],
[29, 9, 0, 23, 2, "CONDITIONING"],
[30, 23, 0, 16, 0, "LATENT"]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}