adieyal / comfyui-dynamicprompts

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

Dynamic Prompt fails on Random node #36

Closed tusharbhutt closed 7 months ago

tusharbhutt commented 7 months ago

I'm using the latest edition from six hours ago (fe16603) , and your example random workflow JSON file. Unfortunately id does not work, this is the error:

'SamplingResult' object has no attribute 'replace'

  File "C:\Applications\StableDiffusion\ComfyUI\execution.py", line 153, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "C:\Applications\StableDiffusion\ComfyUI\execution.py", line 83, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "C:\Applications\StableDiffusion\ComfyUI\execution.py", line 76, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "C:\Applications\StableDiffusion\ComfyUI\nodes.py", line 55, in encode
    tokens = clip.tokenize(text)
  File "C:\Applications\StableDiffusion\ComfyUI\comfy\sd.py", line 124, in tokenize
    return self.tokenizer.tokenize_with_weights(text, return_word_ids)
  File "C:\Applications\StableDiffusion\ComfyUI\comfy\sdxl_clip.py", line 30, in tokenize_with_weights
    out["g"] = self.clip_g.tokenize_with_weights(text, return_word_ids)
  File "C:\Applications\StableDiffusion\ComfyUI\comfy\sd1_clip.py", line 430, in tokenize_with_weights
    text = escape_important(text)
  File "C:\Applications\StableDiffusion\ComfyUI\comfy\sd1_clip.py", line 269, in escape_important
    text = text.replace("\\)", "\0\1")

This is on the latest version of ComfyUI as noted below:

### ComfyUI Revision: 1669 [ca2812ba] | Released on '2023-11-10'

and the DPRandom Node with prompt as seen below:

image

Has anyone else experienced this?

adieyal commented 7 months ago

Looks likes an incompatibility with the latest version of dynamicprompts - try the fix that I just pushed

tusharbhutt commented 7 months ago

That worked! Thanks so much :)