FizzleDorf / ComfyUI_FizzNodes

Custom Nodes for Comfyui
MIT License
396 stars 60 forks source link

Issues with BatchPromptScheduleSDXL-Latent #101

Closed theqmann closed 5 months ago

theqmann commented 5 months ago

Haven't checked the non SDXL ones, but there's a few issues I found in the BatchPromptScheduleSDXL (Latent Input) node.

Around line 446 of BatchFuncs.py

    # in case there is only one keyed promt, set all prompts to that prompt
    cur_prompt_series_G, nxt_prompt_series_G = constructPrompt(sorted_prompts_G, cur_prompt_series_G, nxt_prompt_series_G, settings.pre_text_G, settings.app_text_G)
    cur_prompt_series_L, nxt_prompt_series_L = constructPrompt(sorted_prompts_G, cur_prompt_series_G,
                                                               nxt_prompt_series_G, settings.pre_text_G, settings.app_text_G)
    if len(sorted_prompts_L) - 1 == 0:
        for i in range(0, len(cur_prompt_series_L) - 1):
            current_prompt_L = sorted_prompts_L[0][1]
            cur_prompt_series_L[i] = str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L)
            nxt_prompt_series_L[i] = str(pre_text_L) + " " + str(current_prompt_L) + " " + str(app_text_L)

Should probably be:

    # in case there is only one keyed promt, set all prompts to that prompt
    cur_prompt_series_G, nxt_prompt_series_G = constructPrompt(sorted_prompts_G, cur_prompt_series_G, nxt_prompt_series_G, settings.pre_text_G, settings.app_text_G)
    cur_prompt_series_L, nxt_prompt_series_L = constructPrompt(sorted_prompts_L, cur_prompt_series_L,
                                                               nxt_prompt_series_L, settings.pre_text_L, settings.app_text_L)

The print around line 581 has a broken parenthesis.

        for i in range(0, settings.max_frames):
            print("\n", "Max Frames: ", settings.max_frames, "\n", "Current Prompt G: ", cur_prompt_series_G[i],
                  "\n", "Current Prompt L: ", cur_prompt_series_L[i], "\n", "Next Prompt G: ", nxt_prompt_series_G[i],
                  "\n", "Next Prompt L : ", nxt_prompt_series_L[i],  "\n"), "\n", "Current weight: ", weight_series[i]

Should probably be:

        for i in range(0, settings.max_frames):
            print("\n", "Max Frames: ", settings.max_frames, "Curr Frame: ", i, "\n", "Current Prompt G: ", cur_prompt_series_G[i],
                  "\n", "Current Prompt L: ", cur_prompt_series_L[i], "\n", "Next Prompt G: ", nxt_prompt_series_G[i],
                  "\n", "Next Prompt L : ", nxt_prompt_series_L[i],  "\n", "Current weight: ", weight_series[i])

After changing these, it looks like the prompt weighting is broken for the last prompt (would assume weight 1.0 for frames 4 & 5), and the pre and append are duplicated. I used preG/preL as prepend; appendG, appendL as append; and a 6 frame schedule with this syntax:

"0": "p0",
"2": "p2",
"4": "p4"
Max Frames:  6 Curr Frame:  0
 Current Prompt G:  preG,  preG,  p0 ,appendG ,appendG
 Current Prompt L:  preL, preL, p0 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Next Prompt L :  preL, preL, p2 ,appendL ,appendL
 Current weight:  1.0

 Max Frames:  6 Curr Frame:  1
 Current Prompt G:  preG,  preG,  p0 ,appendG ,appendG
 Current Prompt L:  preL, preL, p0 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Next Prompt L :  preL, preL, p2 ,appendL ,appendL
 Current weight:  0.5

 Max Frames:  6 Curr Frame:  2
 Current Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Current Prompt L:  preL, preL, p2 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p4 ,appendG ,appendG
 Next Prompt L :  preL, preL, p4 ,appendL ,appendL
 Current weight:  1.0

 Max Frames:  6 Curr Frame:  3
 Current Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Current Prompt L:  preL, preL, p2 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p4 ,appendG ,appendG
 Next Prompt L :  preL, preL, p4 ,appendL ,appendL
 Current weight:  0.5

 Max Frames:  6 Curr Frame:  4
 Current Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Current Prompt L:  preL, preL, p2 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p4 ,appendG ,appendG
 Next Prompt L :  preL, preL, p4 ,appendL ,appendL
 Current weight:  0.0

 Max Frames:  6 Curr Frame:  5
 Current Prompt G:  preG,  preG,  p2 ,appendG ,appendG
 Current Prompt L:  preL, preL, p2 ,appendL ,appendL
 Next Prompt G:  preG,  preG,  p4 ,appendG ,appendG
 Next Prompt L :  preL, preL, p4 ,appendL ,appendL
 Current weight:  0.0
theqmann commented 5 months ago

Was able to find the duplication issue in the foursections like this:

                cur_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(current_prompt_G) + " " + str(settings.app_text_G))
                nxt_prompt_series_G[f] += (str(settings.pre_text_G) + " " + str(next_prompt_G) + " " + str(settings.app_text_G))

They should just be

                cur_prompt_series_G[f] += (str(current_prompt_G))
                nxt_prompt_series_G[f] += (str(next_prompt_G))
FizzleDorf commented 5 months ago

I made the changes in #102