adieyal / comfyui-dynamicprompts

ComfyUI custom nodes for Dynamic Prompts
MIT License
187 stars 20 forks source link

Combinatorial StopIteration #16

Closed 691175002 closed 7 months ago

691175002 commented 10 months ago

I'm not sure if I'm using this correctly, but I'm finding that the combinatorial node will raise a StopIteration and output a blank prompt at the end of every cycle. This seems worse than just starting over at the beginning because if you are trying to batch many runs every nth cycle will execute on a blank prompt and be wasted.

adieyal commented 10 months ago

strange - i'll take a look

ali1234 commented 10 months ago

https://github.com/adieyal/comfyui-dynamicprompts/blob/584b204cc3c0aee793227479dd9bf1eabfc6b23c/nodes/sampler.py#L59-L71

This happens because you reload self._prompts on line 66 but then on line 68 prompts still points at the old one. I can't see any reason for this function to even take arguments given that they are all part of the class, and it is marked private.

michaelLochlann commented 9 months ago

Yeah in ComfyUI, I have { first option | second option } and it draws the first 2 images fine but then it adds an extra 3rd image which has nothing to do with my prompt. So it kinda makes it not usable unfortunately.

L-o-z commented 8 months ago

I have found a solution that seems to work for me (I've never written python code before so it might qualify as a quick and dirty hack, or...)

At line 68 in nodes/sampler.py, insert the following line

            prompts = self._prompts

This is just after the second try: statement that @ali1234 posted, and in fact without that comment I would not have worked this out

adieyal commented 7 months ago

This is now fixed in 0.2.0