ComfyUI
ComfyUI copied to clipboard
[Feature Request] Number / Math Nodes
I've found that ComfyUI is capable of workflows that aren't possible in Auto1111 or InvokeAI, and I think it can be even further improved by number and math nodes.
A simple "Number" node could allow you to input a number and then plug it into multiple KSampler nodes to uniformly control their denoising strengths, for example.
Math nodes, like "Add", "Subtract", "Multiply", and "Divide" could then allow you to influence those values. Such as applying half of that number previous to a specific KSampler, or doubling it to manipulate a ControlNetApply node's strength.
Other examples can include multiplying a length / width value to fill in a LatentUpscale node's target resolution (similar to Hires Fix in Auto1111). Or using Add and Subtract nodes to influence the step counts for KSampler nodes.
If we could then plug these values into their respective nodes, it open a lot of possibilities. I imagine there are other creative uses as well, and I believe that number / math nodes could help expand the different ways users are able to create more-controlled or more creative workflows in ComfyUI.
I think this might have what you're wanting already. There's other node packs on that site as well that you would likely find helpful too. Namely, this which has an externalized seed to go with the sampler it adds. This would pair well with your math needs possibly.
Alternately, the file I posted the other day here has an externalized seed, cfg, and steps for the sampler. This could offer even more control over those if you needed.
Thank you, these look incredibly useful. A lot of these nodes definitely offer the customization I was looking for.
One thing I've realized is that ComfyUI sockets seem to be name-based, rather than type-based - I can't plug a Denoise node into a math socket or a float node into a step socket.
Do you know if there's anyway around this? So I could, for example, have a denoise node plugged into two samplers, but multiple the value by 0.4 before it passes into the second sampler?
Between those math nodes I linked and the updates recently you should be able to.
That's his float node. The extracted denoise node didn't work on his multiply. Those may need to be made more universal. After you extract, double click the connector that made to spawn a node for it, or a bunch if you want.
I updated the UI, but now I get an error with the Derfuu math nodes:
Traceback (most recent call last):
File "C:\Users\silve\Documents\AI Art\__Tools\_ComfyUI\ComfyUI\nodes.py", line 1033, in load_custom_node
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\silve\Documents\AI Art\__Tools\_ComfyUI\ComfyUI\custom_nodes\Derfuu Nodes V4\__init__.py", line 1, in <module>
import custom_nodes.Derfuu_ComfyUI_ModdedNodes.Nodes.Custom.Types as TypeNodes
ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'
Cannot import C:\Users\silve\Documents\AI Art\__Tools\_ComfyUI\ComfyUI\custom_nodes\Derfuu Nodes V4 module for custom nodes: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'
I can't actually test the math nodes yet, but I have seen the the updated UI has a lot more options now.
Alright, I finally got the modded nodes to load. And I think this workflow actually works. Thanks!