asagi4 / comfyui-prompt-control

ComfyUI nodes for prompt editing and LoRA control
GNU General Public License v3.0
165 stars 14 forks source link

[FR]: Allow for separate G/L prompts in PromptToSchedule for SDXL #12

Closed DrJKL closed 6 months ago

asagi4 commented 8 months ago

This needs a bit of refactoring I think, but shouldn't be too difficult

sjuxax commented 8 months ago

I worked around this by encoding only a text_l and doing ConditioningConcat with the prompt schedule, which has the primary (g) prompt. It seems to work OK.

That said, I agree that a PromptToSchedule that was cognizant of both l and g encoders would be nice to have.

asagi4 commented 6 months ago

I added a way to separate the prompts. I tested it pretty lightly, but it seems to work.

DrJKL commented 6 months ago

I think it might break if weights are used inside the CLIP_L(), e.g. CLIP_L(cartoon, (colorful:0.5))

asagi4 commented 6 months ago

Hm, you're correct about that. It's because I use a simple regexp to find the "functions" from the prompt instead of properly parsing things.

DrJKL commented 6 months ago

It might be as simple as adding a lazy quantifier mod: https://www.pythontutorial.net/python-regex/python-regex-non-greedy/

Or if you ever end up switching to a parser, feel free to steal what I've got in https://github.com/DrJKL/prompt-crafter/blob/main/src/common/parsing/sdprompt.ne

DrJKL commented 6 months ago

I haven't had time to add the time-based stuff there (unwrapping prompt-control based on a given number of steps into discrete prompts, for example)

asagi4 commented 6 months ago

I already use a parser made with lark for most things, but I'm not that good at using lark so fiddling with the parser is always a bit painful and for the "function" syntax I just went with a simpler solution.

asagi4 commented 6 months ago

Anyway I made #22 about the parsing bug since this one is technically closed.