mcmonkeyprojects / SwarmUI

SwarmUI (formerly StableSwarmUI), A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
MIT License
1.04k stars 78 forks source link

Make it obvious that metadata has to be manually enabled when using custom Comfy Workflows #74

Open Taruvi opened 2 months ago

Taruvi commented 2 months ago

Feature Idea

I was under the impression that when using a Comfy Workflow, then sending it via 'Use This Workflow In Generate Tab', that clicking in the fields for various settings was only there for convenience. I was wrong...

I see that when you click into one of these fields, e.g. prompts, that the little slider enables at that point. I thought the enabled slider simply indicated that you'd done something to change what you sent there from the Comfy Workflow tab. Like, maybe there was one word you wanted to change in your prompt and rather than having to go back to the Workflow, change the word, then click 'Use This Workflow In Generate Tab' all over again just to change that one word. I thought it was there just to indicate that you'd changed something that would override the prompt in the Comfy Workflow and that's all it was there for.

I was wrong - it's maybe for that reason, but it also enables writing the metadata of whatever slider is enabled!

Epiphany!

It's also literally not obvious, like, at all! It's not even written in the docs here. I even brought this up here but no-one mentioned this simple fix.

Since I've been using Comfy Workflows a lot, I've been having to copy/paste my prompts into a separate notes app and then trying to remember which prompts match which generations and it's exactly as tedious as it sounds.

However, on my quest to find a workaround, I found this and the user directly below wasn't aware of it, either. It could do with being more obvious what those sliders are for. It should definitely be in the docs. I would never have found this information had I not gone hunting in the old repo. Also, I do like the totally nonchalant 'oh' at the beginning of that post... Like, of course that's how it works...! Like, duh!

Now, on to my requests. These would be for when you're sending Comfy Workflows to the Generate tab, not on the normal Generate tab without them:

  1. Have a totally obvious note at the very top of the options on the Generate tab saying something like:

    Enable individual sliders to include their parameters in the file metadata or else they won't be saved

  2. Maybe have a second slider directly below that that says and does the following:

    Enable all sliders to include all image generation parameters in the file metadata

I'd rather have everything than have to go through picking and choosing what I want in the metadata and potentially forgetting to enable something I later found out I wished I'd included. I'm using ReActor a lot at the moment and that needs to be in the Comfy tab. In the Generate tab, all the ReActor options are split up into several different sections so you'd have to go through and enable them all one-by-one.

It goes without saying that when I look back through older generations and I see something I want to reproduce or a theme I want to continue with, having that information as a starting point is valuable.

  1. This would be a 'nice-to-have'. When writing the metadata, every single one of them is preceeded by some variant of: 'comfyrawworkflowinput'.

An example:

parameters  {
  "sui_image_params": {
    "comfyrawworkflowinputtextmainprompt": "a cat",
    "comfyrawworkflowinputtextnegativeprompt": "a dog",
    "model": "sdxlpony/DucHaiten-Pony-Real - Pony-Real_v10",
    "seed": 281865053,
    "steps": 30,
    "cfgscale": 8.0,
    "sampler": "euler_ancestral",
    "scheduler": "karras",
    "nopreviews": true,
    "comfyrawworkflowinputdecimalreactorfaceboostnodecodeformerweighteg": 0.5,
    "comfyrawworkflowinputdecimalreactorfaceboostnodevisibilityeg": 0.75,
    "comfyrawworkflowinputdropdownreactorfaceboostnodeboostmodeleg": "GFPGANv1.4.pth",
    "comfyrawworkflowinputtextreactorfaceboostnodeinterpolationeg": "Bicubic",
    "comfyrawworkflowinputdecimalreactorfaceswapoptnodecodeformerweightef": 0.75,
    "comfyrawworkflowinputdecimalreactorfaceswapoptnodefacerestorevisibilityef": 1.0,
    "comfyrawworkflowinputdropdownreactorfaceswapoptnodefacedetectionef": "YOLOv5l",
    "comfyrawworkflowinputdropdownreactorfaceswapoptnodefacerestoremodelef": "GFPGANv1.4.pth",
    "comfyrawworkflowinputtextreactorfaceswapoptnodeswapmodelef": "inswapper_128.onnx",
    "comfyrawworkflowinputtextreactoroptionsnodedetectgenderinputee": "no",
    "comfyrawworkflowinputtextreactoroptionsnodedetectgendersourceee": "no",
    "comfyrawworkflowinputtextreactoroptionsnodeinputfacesindexee": "0",
    "comfyrawworkflowinputtextreactoroptionsnodeinputfacesorderee": "large-small",
    "comfyrawworkflowinputtextreactoroptionsnodesourcefacesindexee": "0",
    "comfyrawworkflowinputtextreactoroptionsnodesourcefacesorderee": "large-small",
    "comfyrawworkflowinputdropdownsdxlresolutionswlshnodedirectionep": "portrait",
    "comfyrawworkflowinputdropdownsdxlresolutionswlshnoderesolutionep": "1152x896|9:7",
    "automaticvae": true,
    "prompt": "",
    "negativeprompt": "",
    "swarm_version": "0.9.1.1",
    "date": "2024-07-15",
    "generation_time": "0.01 (prep) and 10.81 (gen) seconds"
  }
}   

For example 'comfyrawworkflowinputdropdownreactorfaceswapoptnodefacerestoremodelef'. Whereas in the Generate tab, that input is labeled as 'face_restore_model' and it's under the 'ReActorFaceSwapOpt' section. So if Swarm can display the nodes like that in the Generate tab, why not in the metadata?

SwarmUI - ReActorFaceSwapOpt

So in instead of seeing this:

`"comfyrawworkflowinputdropdownreactorfaceswapoptnodefacerestoremodelef": "GFPGANv1.4.pth",`

You'd see something like this:

`"ReActorFaceSwapOpt_face_restore_model": "GFPGANv1.4.pth",`

Which is so much more readable. Obviously, having the metadata at all, even if it's very raw and not formatted nicely is better than having none. So this is not the most important thing, but it would be 'nice-to-have'.

  1. To make it absolutely obvious that this metadata comes from a Comfy Workflow, maybe enable the Personal Notes section and some text like 'Generated from a SwarmUI custom Comfy Workflow' so if it's uploaded on Civit or somewhere, people can see why the metadata is a bit funky if they can't reproduce it cleanly.

Maybe this is part of the reason half of Civit images I'm seeing nowadays has no, or only the very basic metadata?

  1. This also would be a 'nice-to-have' but I'd like to see metadata written into JPG, which I know can be done. I've just tested it now that I know I have to actually enable metadata writing first and it does not appear in JPG EXIF in any form. Looks like there was a discussion about it here but there's nothing in the JPG as of now.

Would very much like to save disk space...

Anyway, unlike the screenshots I posted in the other Issue, here is a new one with the now enabled metadata:

SwarmUI - Image Generation

P.S. I see that even today people are still posting new Issues in the old repo. Why don't you archive it or set it read-only? Or are you not able to?

Other

No response

mcmonkey4eva commented 2 months ago

Maybe this is part of the reason half of Civit images I'm seeing nowadays has no, or only the very basic metadata? civitai doesn't support swarm metadata, and barely supports comfy metadata. They still mostly only support auto webui metadata. Anything else the user has to fill in manually.

This also would be a 'nice-to-have' but I'd like to see metadata written into JPG, which I know can be done. I've just tested it now that I know I have to actually enable metadata writing first and it does not appear in JPG EXIF in any form. Looks like there was a discussion about it https://github.com/Stability-AI/StableSwarmUI/issues/164 but there's nothing in the JPG as of now. jpegs have metadata, it just often gets stripped by platforms (discord, etc) vs png they usually let it stay. As long as your file is local or through a service that doesn't strip metadata, jpgs will have the metadata.

Taruvi commented 2 months ago

I'm thinking of my own images that I want to reproduce. It's impossible to remember prompts so I want to see what I did to get a certain effect. Uploading to somewhere else and keeping the metadata intact could be nice and all but that's not what I was getting at. I would just like to save as JPG and be able to see the parameters I used. At the moment that's not possible but you suggest otherwise.

How do I get Swarm metadata in JPGs? I think I've enabled everything in order for that to happen.

Also, I've never uploaded to Civit so I wouldn't have known that.

mcmonkey4eva commented 2 months ago

How do I get Swarm metadata in JPGs? I think I've enabled everything in order for that to happen. It... just is there. You'd have to go out of your way to prevent it. I'm confused why you're saying that it isn't?

Taruvi commented 2 months ago

Hmm... What are you using to view metadata in JPGs?

For reference, I'm on Linux using XNViewMP as my image viewer. As far as I'm aware it shows all metadata but maybe there's some field it's not able to view?

Taruvi commented 2 months ago

Actually... embarrassed face...

Yes, I see it now. It appears in Swarm Image History - just not in XNViewMP.

It's strange that I can see all metadata in PNGs but not in JPG.

That's where my confusion came from. Sorted but strange nonetheless.

Even more actually...

I see now that in XNViewMP, you have to click over to a separate EXIF tab to see the metadata if it's JPG.

If it's a PNG, the same metadata shows up in the properties tab.

Crisis averted!