Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Azornes opened this issue Nov 29, 2023 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@Azornes
Copy link

Azornes commented Nov 29, 2023

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:

  • Name String: Sampler
    • Example from the prompt reader: "Sampler: DPM++ 2M SDE Heun Karras"
    • In this case: "DPM++ 2M SDE Heun Karras"
  • Name String: VAE
    • Example from the prompt reader: "VAE: kl-f8-anime2.ckpt"
    • In this case: "kl-f8-anime2.ckpt"
  • Int: Clip skip
    • Example from the prompt reader: "Clip skip: 2"
    • In this case: "2" (If this option isn't in the prompt reader, return "1")
  • Boolean: Pad conds
    • Example from the prompt reader: "Pad conds: True"
    • In this case: "True" (If this option isn't in the prompt reader, return "False")

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

@Azornes Azornes added the question Further information is requested label Nov 29, 2023
@receyuki
Copy link
Owner

receyuki commented Dec 6, 2023

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
Copy link
Author

Azornes commented Dec 6, 2023

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
Copy link
Owner

receyuki commented Dec 9, 2023

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 receyuki added enhancement New feature or request and removed question Further information is requested labels Dec 10, 2023
receyuki added a commit that referenced this issue Dec 11, 2023
@receyuki
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants