theUpsider / ComfyUI-Logic

Logic nodes to perform conditional renders based on an input or comparision
125 stars 17 forks source link

Logic eror when checking for Image #1

Open tusharbhutt opened 11 months ago

tusharbhutt commented 11 months ago

Hi, I am probably using the "IF" node wrong, but what I am trying to do is this:

If an Image is passed through the VAE decoder, THEN write a text file which has the prompt within it, and the filename is the time and date of creation. However, I get the error below:


Error occurred when executing If ANY execute A else B:

Boolean value of Tensor with more than one value is ambiguous

  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Logic\nodes.py", line 125, in return_based_on_bool
    return (IF_TRUE if ANY else IF_FALSE,)

I have the IF node set up this way:

  1. The VAE DECODER goes to "ANY"
  2. The "IF_TRUE" pulls the PROMPT
  3. The "?" Output goes to a save text file NODE
  4. The "IF_FALSE" pulls a string with the value "NULL"

Essentially, if there is no VAE DECODE, I don't want to write a text file. What I am trying to do overall is to write a text file that has some meta info in it. The text file should have the same time/date as the corresponding image file. However, right now the text file is created immediately so its time stamp is X seconds ahead of the image so it isn't useful. I thought by using this node, I could delay the creation of the text file until the VAE decoder is done.

Ideally, If there was a save node that allowed a text file to be saved with a date/time stamp that is identical to the image, AND can be saved to a different folder location,n I'd be happy but so far such a beast does not exist, hence the convoluted way of trying to use your node :)

theUpsider commented 11 months ago

Thank you very much for your engagement. I'm on holidays currently and will tackle this when I'm back:) got it marked in my calendar 🗓

tusharbhutt commented 11 months ago

Thank you very much for your engagement. I'm on holidays currently and will tackle this when I'm back:) got it marked in my calendar 🗓

Enjoy your vacation and looking forward to an answer when you get back :)

theUpsider commented 11 months ago

@tusharbhutt Can you send me an image of your generation? They have your workflow embedded so I can try locally. Im back form holidays btw haha

tusharbhutt commented 11 months ago

@tusharbhutt Can you send me an image of your generation? They have your workflow embedded so I can try locally. Im back form holidays btw haha

OK, please see attached with a more simple set up. Not sure if I did am understanding the workflow idea, but I am assuming the test is "ANY", so in my case, the output from the VAE. If the VAE output is true, then it should do action "TRUE", if "FALSE", do action FALSE, with the "?" being the output selected, correct?

I am expecting the output to be "This is true", but I still get an error:

image

In readable form:

!!! Exception during processing !!!
Traceback (most recent call last):
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "C:\Applications\StableDiffusion\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Logic\nodes.py", line 125, in return_based_on_bool
    return (IF_TRUE if ANY else IF_FALSE,)
RuntimeError: Boolean value of Tensor with more than one value is ambiguous

File is attached below:

ComfyUI_00001_

theUpsider commented 1 week ago

image Yes This connection of feeding an image into the If node is not possible. It has to be a value which truthiness can be checked (Bool or integer).

image

EDIT: Sorry for the extremely late reply. I dont know why I slipped this issue.