receyuki / comfyui-prompt-reader-node

The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader
MIT License
290 stars 22 forks source link

[FEATURE REQUEST] - Extractor for most additional options and new nodes #24

Open Azornes opened 12 months ago

Azornes commented 12 months ago

Summary

Extractor for most additional options and new nodes: Name String: Sampler Name String: VAE Int: Clip skip Boolean: Pad conds

Basic Example

I would like to thank you for your work, and I have a few suggestions for additions. Extractor for Additional Options:

Of course, the names of VAEs and models can sometimes be unhelpful if they are, for example, in folders. Therefore, I would suggest creating a new node that searches the folders with the given name and, if found, automatically returns the entire path to that model, for example, "Anime/anime_v10.safetensor" and pass to Checkpoint Selector. Similarly, for the names of samplers, there should be an additional node that extracts the sampler_name from the string and pass to Sampler Selector as well as the scheduler and pass to Scheduler Selector.

If you think that dealing with names and their additional node converters would be too much work, I would mainly request the output for Clip skip and Pad conds.

Reference Issues.

No response

receyuki commented 11 months ago

Firstly, thank you for your suggestions. I will explain them one by one.

  1. You might have noticed that in ComfyUI, a sampler name is composed of two parts: sampler_name and scheduler. This naming convention differs from other tools. For instance, "DPM++ 2M SDE Heun Karras" is named dpmpp_2m_sde_heun (with a Karras scheduler) in ComfyUI. However, there is no dpmpp_2m_sde_heun sampler in ComfyUI yet (only dpmpp_2m_sde). What I want to point out here is that if users work exclusively with ComfyUI, converting the format will suffice. But when integrating images created with other tools, users may encounter images generated by samplers that are not supported by ComfyUI.
  2. One detail you might not be aware of is that most tools don't write the VAE in metadata, especially when users use models with baked VAE. I have no way to determine the specific VAE used.
  3. Although the v1.1.0 reader can output the model, I still think this is a bad decision. Firstly, the model name is not unique; it can be changed at anytime. Secondly, not all tools include the model's suffix (e.g. safetensor) and the path (as in your example, Anime). I think anyone who needs this output will likely be using it to read images generated with ComfyUI, thus a node to search for the model might not be necessary.
  4. To the best of my knowledge, no tools by default store Clip skip and Pad conds in the metadata, so I have no way to retrieve that data.

Based on the above discussion, within these parameters, the only feasible one is the sampler (for unsupported samplers, I can prompt an error).

Azornes commented 11 months ago

Thank you for the detailed response in points, and I understand your thought process. At the moment, I haven't created my own nodes, and I'm not aware of their limitations. However, I'll take the opportunity to explain in this discussion why both the outputs and the new nodes I've written make sense and what potential solutions there might be for the text's missing options.

Overall, I would like to transfer most of the metadata from a1111 to comfyui to automate the loading of images created using various models and load these options into the appropriate nodes in comfyui.

  1. You've already described a solution for this point towards the end, and I agree with it.

  2. Here, I would resolve it by stating that if there is no VAE in the metadata, it should either produce an error or send the "baked VAE". For a usage example the node below supports "baked vae" from efficiency-nodes-comfyui 2023-12-06_22h15_10

  3. It's true that model names may not be unique, but for those who use the same models on their computers and those who don't change model names specifically for such occasions, they can easily load these names, provided there is a node to search through folders. From my experience, many photos from civitai have original model names. Another matter – it's good that you pointed out that not all tools return a suffix. However, all these issues can be addressed in the code, for example, by checking whether a particular model has a suffix or not. In cases where it doesn't, it can simply be added. Perhaps people are already using it this way, but jokingly, I'd say that I'm also a human, and I would like to use it for automatically extracting models for importing into the node. :P

  4. Using a1111, my photos often save with Clip skip and Pad conds metadata, and when I load them using your reader, these options are visible. An example photo with these metadata is below. 2023-12-06_21h51_39

If you're concerned that there might potentially be too much error handling resulting in frequent errors, this could be addressed using a node. For instance, if there's an error on the first line, send a preset sampler/model/vae using this node. Bez tytułu

receyuki commented 11 months ago

Instead of discussing whether or not to add these outputs, I have a new idea. I can write a separate node specifically for reading all the parameters in the image. The advantage is you can read any options, and I can keep the Reader clean.

+-------------------------+
| SD Parameters Extractor |
|                         |
| settings                |
| parameter               |
| type                    |
|                   VALUE |
+-------------------------+

Connect the settings to the Reader, then in the parameter, choose the option you need (it will be a combo box and will update after the first run), and finally choose the format you wish for the output.

It's true that model names may not be unique, but for those who use the same models on their computers and those who don't change model names specifically for such occasions, they can easily load these names, provided there is a node to search through folders. From my experience, many photos from civitai have original model names. Another matter – it's good that you pointed out that not all tools return a suffix. However, all these issues can be addressed in the code, for example, by checking whether a particular model has a suffix or not. In cases where it doesn't, it can simply be added. Perhaps people are already using it this way, but jokingly, I'd say that I'm also a human, and I would like to use it for automatically extracting models for importing into the node. :P

It’s technically very simple, perhaps I’m just too lazy to write a manual lol. I’ll consider it, though.

If you're concerned that there might potentially be too much error handling resulting in frequent errors, this could be addressed using a node. For instance, if there's an error on the first line, send a preset sampler/model/vae using this node.

I guess I would prefer to keep the error messages rather than having the user load the pre-set content without being aware of it.

receyuki commented 11 months ago

Please try the Parameter Extractor and model matching feature in the new version.