Git Product home page Git Product logo

comfyui-dynamicprompts's People

Contributors

adieyal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

comfyui-dynamicprompts's Issues

Output the parsed prompt?

I'm wanting to take the final parsed prompt that's been generated (basically what the console prints out after "Prompt:" with all the wildcards/variants subbed for concrete words) and pass that to the file name.

I'm doing this by trying to grab the string the way the comfyui manual describes. Here are some examples of this syntax where the first term is the name of the node, and the second is the named input.:
%XL Mix Sampler.base_positive%, or %Seed.seed%.

Is there any way to grab the parsed string from your node?

Feature Request: Reload wildcard files on queue start

Current State:
Wildcard files appear to be loaded once at ComfyUI start and never refreshed again.
This means any wildcard file changes/edits require a ComfyUI restart to use.

Proposed State:
Whenever you hit "Queue Prompt" or "Refresh" on ComfyUI it should reload the wildcard files.
This is how A1111 does it currently.

I wouldn't imagine this would be a resource problem as it's just text files and those normally handle pretty fast.
So it seems to me a programming/ComfyUI problem to solve.

Hopefully we can get this as troubleshooting/adding to wildcard files will be a big pain if you have to restart every time.

I'm Feeling Lucky / 524 Server Error

I'm using sd-dynamic-prompts latest commit 1567e78 and comfyui latest commit 27d5808.

When using the "I'm feeling lucky" node, I get the following error message:

Requesting https://lexica.art/api/v1/search?q=A mech warrior
Error while generating prompt: 524 Server Error:  for url: https://lexica.art/api/v1/search?q=A%20mech%20warrior
Traceback (most recent call last):
  File "D:\ai\ComfyUI_windows_portable\python_embeded\lib\site-packages\dynamicprompts\generators\feelinglucky.py", line 49, in generate
    data = query_lexica(query)
  File "D:\ai\ComfyUI_windows_portable\python_embeded\lib\site-packages\dynamicprompts\generators\feelinglucky.py", line 27, in query_lexica
    response.raise_for_status()
  File "D:\ai\ComfyUI_windows_portable\python_embeded\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 524 Server Error:  for url: https://lexica.art/api/v1/search?q=A%20mech%20warrior

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\ai\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\feeling_lucky.py", line 32, in get_prompt
    prompt = self._prompt_generator.generate(text, 1)[0]
  File "D:\ai\ComfyUI_windows_portable\python_embeded\lib\site-packages\dynamicprompts\generators\feelinglucky.py", line 54, in generate
    raise GeneratorException(f"Error while generating prompt: {e}") from e
dynamicprompts.generators.promptgenerator.GeneratorException: Error while generating prompt: 524 Server Error:  for url: https://lexica.art/api/v1/search?q=A%20mech%20warrior

Dynamic Prompt fails on Random node

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?

Unable to install application comfyui-dynamicprompts, please help!

Hello,anyone willing to help me please review the information provided. I can confirm that the system environment is normal because other applications can start normally, but dynamicprompts cannot be executed.The installation process should be correct.
6dd22df84708f7eef0ed05a116c0441

b3dd324e6f512fa41ff7e7b6dfdf03c
6cf63a918e3a898d90c8aa9175c37cf

【Traceback (most recent call last):
File "G:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1735, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts_init
.py", line 1, in
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes_init_.py", line 1, in
from .combinatorial import DPCombinatorialGenerator
File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\combinatorial.py", line 3, in
from dynamicprompts.enums import SamplingMethod
ModuleNotFoundError: No module named 'dynamicprompts'

Cannot import G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts module for custom nodes: No module named 'dynamicprompts'】
@adieyal

[BUG](?) Wildcards from .txt files randomly not parsed.

Random Prompts seems to select random wildcards that it refuses to parse, as shown in the image below. I can't find any correlation as to why it does this or what's triggering it. I have tried:

  • Uninstalling and reinstalling the extension
  • A new ComfyUI install (portable)
  • Copy-pasting titles to ensure proper spelling and re-typing the __
  • Checking for Non-Ascii characters
  • Removing any spaces in .txt titles
  • Deleting everything inside the offending file and replacing it with the single word "test"
  • Copy-Pasting the file contents to a new .txt file and saving it with a different name

In the prompt shown below and others, none of this worked.

image

"Immediate" Variables are constant across generations

If I use an immediately-evaluated variable in a Random Prompt, in order to be able to reuse the same wildcard/variation choice in multiple places within a prompt, then I find that the node saves the choice for all future generations.
So if I use auto-queue in Comfy, or just click Generate multiple times, I just get the same value each time.

eg
image
If red is selected, then hair will always be red hair as many times as I generate with this prompt even though the seed is incrementing.

Can't connect dynamic prompt nodes to CLIP text encode node

I'm on the latest ComfyUI master version.
Dragging the workflow image don't work, workflow doesn't load up. Can't connect the string output to CLIP text encode node as shown on the image either.
Not sure if it's me not knowing how to use it, or it just doesn't work

Autocomplete wildcards

Would be great if I could type "__" and then invoke completion based on folder and filenames of my wildcard collection!

combinatorial prompt not working

Running the combinatorial prompt example json workflow.

Combinatorial prompt: A {red|green|blue} ball by me

When batch size is set to 1, only 1 image is returned.

image

When batch size is set to 3, 3 images of the same prompt is returned.

image

YAML File Weights Documentation

Hi,

This isn't really a bug for you but the guide you link to for random weights in YAML files is missing some key syntax and probably causing a lot of headaches, the listed syntax for random weights is

color:
- {2::red
  | 3::blue
  | 1::green
  }

Which does not work and actually breaks the wildcard key. To properly use weights it needs to be wrapped in quotes like

color:
    - "{8::red
        | 3:blue
        | 1::green
       }"

For anyone trying to do this note you don't use the normal list format because then you'd have to add a list entry for everytime you want an item weighted.

No module named 'dynamicprompts'

Hi

Any idea why I am getting this please?

Traceback (most recent call last):
File "C:\SDAI\ComfyUI\ComfyUI\nodes.py", line 1698, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\SDAI\ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts_init
.py", line 1, in
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "C:\SDAI\ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes_init_.py", line 1, in
from .combinatorial import DPCombinatorialGenerator
File "C:\SDAI\ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\combinatorial.py", line 3, in
from dynamicprompts.enums import SamplingMethod
ModuleNotFoundError: No module named 'dynamicprompts'

Cannot import C:\SDAI\ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts module for custom nodes: No module named 'dynamicprompts'

Wildcard directory does not work when using custom_nodes folder

Reproduce:

  1. Create extra_model_paths.yaml file in comfyui base directory (EG: /home/foo/ComfyUI)
  2. Configure custom custom_nodes directory in other_ui config in /home/foo/ComfyUI/extra_model_paths.yaml
    •  other_ui:
         base_path: /path/to/custom/directory
         custom_nodes: custom_nodes
  3. Clone this repo into the new custom_nodes directory
    • git clone https://github.com/adieyal/comfyui-dynamicprompts /path/to/custom/directory/custom_nodes/comfyui-dynamicprompts
  4. (Optional) Create some wildcards in /path/to/custom/directory/custom_nodes/comfyui-dynamicprompts/wildcards
  5. Run ComfyUI
  6. Try and use Dynamic Prompts
    • Directory created: /home/foo/ComfyUIc/ustom_nodes/comfyui-dynamicprompts/wildcards
      • Obviously no wildcards in this freshly created directory

The plugin should be reading the wildcards from /path/to/custom/directory/custom_nodes/comfyui-dynamicprompts/wildcards

This then introduces errors during loading because comfyui tries to load the plugin from base_dir/custom_nodes

Traceback (most recent call last):
  File "/home/ryan/git/comfyui/nodes.py", line 1906, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1016, in get_code
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/ryan/git/comfyui/custom_nodes/comfyui-dynamicprompts/__init__.py'

Import Failed every time, need to "Try Fix" to run it

Hi, I'm having an issue that every time I start up ComfyUI, comfy-dynamicprompts fails to import.

I run "Try Fix" in the manager and then after restarting it works.

Would be great to have this looked at. Thanks a lot.

Showstopping bug in Jinja2 Templates

Privided that I have colors.txt correctly filled with colors and saved in the right directory (wildcards under ComfyUI), if I add a Random Prompts node with the text "a colors cat" everything works well!

But if I add a Jinja2 Templates node with this text:

{% set color1=wildcard("colors")|random %}
a {{color1}} cat

I get the warning (which in reality is an error):
WARNING:dynamicprompts.samplers.utils:No values found for wildcard colors
And the prompt remains: a colors cat

Not even a workaround passing this string to a Random Prompts is possibile because "Convert text to input" is missing in Random Prompts node.
Someone has an idea about how to solve these problems?

YAML not working?

I'm trying to get YAML files working, and it seems to kind of work, but in a lot of cases I am not getting any randomisation at all, it will consistently pick exactly the same prompt from some of the nesting.
Has anyone else got YAML working properly?

As an example, I'm trying to use the Billions of Scifi Characters presets from CivitAi, with this prompt

BoCharsScifi/female/classic

Which changes (within the YAML) to:

BoCharsScifi/female/classic, scifi/lighting, scenes-scifi/*

Running it three times, I got these three prompts:

female AI rights advocate, Aliens- Extraterrestrial creatures with unique physiologies, varying from humanoid to bizarre forms., Adolescence, Agile, African, Amber eyes, Asymmetrical Ears, Angular Nose, Cleft Chin, Angular Jaw, Angular Cheeks, Angular Forehead, Diamond face shape, Articulate Fingers, Birthmarks, Ash Blonde Asymmetrical haircut hair, Admiration, Asserting control over a fascinating and unfamiliar alien life form., Bio-Mechanical Wings- Graceful wings with metallic feathers, fusing technology and biology in perfect harmony. wearing Aqua AR Capris, Aqua AR Blazer, AR Ankle Boots, AR Baseball Cap, AR Watch , Asserting control over a fascinating and unfamiliar alien life form., AI-controlled cities- Dynamic lights responding to AI algorithms and needs., AI-generated art and literature indistinguishable from human works

female AI rights advocate, Aliens- Extraterrestrial creatures with unique physiologies, varying from humanoid to bizarre forms., Adolescence, Agile, African, Amber eyes, Asymmetrical Ears, Angular Nose, Cleft Chin, Angular Jaw, Angular Cheeks, Angular Forehead, Diamond face shape, Articulate Fingers, Birthmarks, Ash Blonde Asymmetrical haircut hair, Admiration, Asserting control over a fascinating and unfamiliar alien life form., Bio-Mechanical Wings- Graceful wings with metallic feathers, fusing technology and biology in perfect harmony. wearing Aqua AR Capris, Aqua AR Blazer, AR Ankle Boots, AR Baseball Cap, AR Watch , Asserting control over a fascinating and unfamiliar alien life form., AI-controlled cities- Dynamic lights responding to AI algorithms and needs., AI-guided mechs and autonomous defense systems

female AI rights advocate, Aliens- Extraterrestrial creatures with unique physiologies, varying from humanoid to bizarre forms., Adolescence, Agile, African, Amber eyes, Asymmetrical Ears, Angular Nose, Cleft Chin, Angular Jaw, Angular Cheeks, Angular Forehead, Diamond face shape, Articulate Fingers, Birthmarks, Ash Blonde Asymmetrical haircut hair, Admiration, Asserting control over a fascinating and unfamiliar alien life form., Bio-Mechanical Wings- Graceful wings with metallic feathers, fusing technology and biology in perfect harmony. wearing Aqua AR Capris, Aqua AR Blazer, AR Ankle Boots, AR Baseball Cap, AR Watch , Asserting control over a fascinating and unfamiliar alien life form.

The ONLY difference between these, is the first two prompts had the following appended to them, otherwise they are identical and no randomization has happened:

, AI-controlled cities- Dynamic lights responding to AI algorithms and needs., AI-generated art and literature indistinguishable from human works

, AI-controlled cities- Dynamic lights responding to AI algorithms and needs., AI-guided mechs and autonomous defense systems

Seed was set to increment, if it even matters as there is no seed input?

Only one dynamic parameter is parsed

I have a simple graph (attached)

When I run it only the last dynamic section is being changed e.g this prompt:

portrait by artists/Photography/by_country/united_kingdom ,{blue|green|brown} eyes, jumbo/aesthetics/general_aesthetics

Results in these outputs outputs:

New prompt: portrait by Abbie Trayler-Smith ,blue eyes, American Pioneers
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, American Revolution
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, American Thanksgiving
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, American Tourist Traps
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, Americana
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, Analog Horror
New prompt: portrait by Abbie Trayler-Smith ,blue eyes, Ancient Egypt

Do you have any idea what I'm doing wrong?

test.json

Combinatorial StopIteration

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.

Wildcards not working at all (Windows Portable Edition)

Sample Random right out of the chute
get 16 green balls when batch size set to 16
get 16 red the next time it's run
then 16 blue
error on console "WARNING:dynamicprompts.samplers.utils:No values found for wildcard artists/Photography/by_country/georgia" though I have the wildcards files in both the ComfyUI/wildcards and ComfyUI/custom_nodes/comfyui-dynamicprompts/wildcards
number of batches doesn't change behavior

Sample Combinatorial right out of the chute
always get 64 red balls no matter how many times I run it when batch size set to 64
get same warning in console as above
batch number doesn't affect behavior

random {red|green|blue} not working

I'm using the provided workflow example .json file, the prompt is;

A {red|green|blue} ball by __artists/illustrations/manga__

The wildcard directory (manga) seems to work, but the ball is not changing color from red despite changing seed and other parts of the prompt.

Can't connect dynamic prompts to anything

The readme shows various prompts being connected to CLIP Text Encode blocks:

image

On my install, they won't connect to anything.

Screenshot from 2023-12-25 09-22-41

I just made sure ComfyUI was up-to-date and I'm running the latest version of dynamicprompts, no errors in the console when loading.

Feature Request: Set a seed for the randomness involved in Random Prompts

Hi,
I really like your Dynamic Prompts extension - there is one feature missing that is crucial to me, though: Being able to set a seed as input for the Random Prompts node. Setting a seed for the random prompt and for the random sampling independently would allow me to create more customizable workflows.
Cheers, Lukas

Nodes failing to load in ComfyUI

Hi, seems like there's an issue with the node loading in ComfyUI. ("IMPORT FAILED: When loading the graph, the following node types were not found: DPRandomGenerator")

I tried a fresh install and "Try Fix" in the manager, but same issue.

Thanks a lot of your help.

After Update Comfy Prompt Nodes Don't Work

After updating Comfy today now the promp nodes dont work.. you can see from the picture the text is an input and you can't convert to widget and you can't connect anything to the text input?

prompt error 1

Extremely slow import

Is it just me or does this plugin take a very long time to import at startup? Averaging 11-12s here ...

[Bug] wildcards folder init failure (Windows portable version)

It seems for Windows portable ComfyUI verion, launched via .\python_embeded\python.exe -s .\ComfyUI\main.py --auto-launch --gpu-only --use-pytorch-cross-attention, the wildcards folder path init fails, resulting No values found for wildcard errors.

Probably caused by python relative path evaluation.
图片

Random doesn't seem to be random...

I'm using 2 different "Random Prompt" nodes and each one merely references a single wildcard file. The wildcard file used by the first Random Prompt node has 4 lines and the second one has 6 lines.

I've logged the line index chosen from each of the 2 wildcard files for each seed from 1 to 20 and here are the results:

seed - index1/index2
1 - 1/1
2 - 0/6
3 - 1/1
4 - 1/1
5 - 4/4
6 - 4/6
7 - 2/2
8 - 1/1
9 - 3/3
10 - 4/4
11 - 3/3
12 - 3/3
13 - 2/2
14 - 0/0
15 - 1/1
16 - 2/2
17 - 4/4
18 - 1/1
19 - 0/5
20 - 1/5

So it is clear that if the second number is 4 or less then the first number will match. This makes sense because the first wildcard file only has 4 lines, so if it chooses a number larger than 4 something else happens (I'm a software engineer, I would expect a simple modulus/wrap operation here but that's clearly not it either).

You're not re-seeding your RNG between successive generations which means multiple uses will result in the same line index every time and that's not ideal. What I don't understand is why don't you just generate a large random number (say from 2^31 to 2^32) and then use modulus to pick the line number in the wildcard file? That way as long as the wildcard files have a different number of lines you'll always get different results.

BUT WAIT... when I generate seed 0 I get 1/4... which doesn't follow the above pattern because 4/4 would be valid and expected.

More troubling still is the fact that successive generations of seed 0 give DIFFERENT RESULTS! This behavior appears to be UNIQUE to seed 0... every other seed value I've tried gives identical repeat results.

Finally... if I use much larger seeds, like 6 or 7 digit seeds, I get entirely different results... here is a collection of results using "random" seeds, all of which were very large numbers, sorted (not in chronological order):
0/0
0/2
0/3
0/6
1/0
2/2
2/4
2/4
2/4
2/4
2/4
2/6
3/3
3/5
3/5
3/5
3/5
3/5
3/5
4/1
4/1
4/1
4/3
4/4
4/6
4/6

Now... what in the ever-loving f*** is going on here? In 25 results I only got a SINGLE line 1 result for the first wildcard file... a file that only has 4 lines. On top of that there are CLEARLY combinations that are strongly favored, such as 2/4 and 3/5...

I've never written software in python but I have 17 years of experience writing C++ and this behavior is downright confusing. You might say I don't have enough data to support any kind of conclusion (I understand that "randomness" can look not random and I know of the anecdote of old CD/MP3 players making their "shuffle" mode less random to make it appear more random) but I have THOUSANDS of actual image generations and I noticed this pattern in all of them, where certain wildcard file 1 selections were strongly correlated with wildcard file 2 selections.

I'm not being picky here... this behavior completely ruins what I'm trying to do. Is it possible to either re-seed the RNG each time you use it or to simply pick a very large random value and then index the wildcard file with that value modulus the number of lines in the file?

Hit a Python exception while executing DPRandomGenerator due to '\u014d' Unicode character (ō) in wildcard file.

First the exception and then I'll tell you about my work flow (and attach a PNG).

Exception:

Error occurred when executing DPRandomGenerator: 
'charmap' codec can't encode character '\u014d' in position 59: character maps to

File "C:\Users\Eric\repos\Stable-Diffusion\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) 
File "C:\Users\Eric\repos\Stable-Diffusion\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:\Users\Eric\repos\Stable-Diffusion\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) 
File "C:\Users\Eric\repos\Stable-Diffusion\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\sampler.py", line 100, in get_prompt print(f"New prompt: {new_prompt}") 
File "C:\Users\Eric\repos\Stable-Diffusion\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py", line 24, in write self.file.write(message) 
File "C:\Program Files\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0]

My workflow (PNG) attached uses several wildcard files. The one I suspect is an artists.txt file (from https://github.com/rikkar69/SDXL-artist-study) that might contain Unicode characters for the artists' names. I extracted out those names, based on the problematic character, into a given file and reproduced the issue.

Repro:

Environment:

  • Win10 machine with ComfyUI setup that has generated hundreds of images. git pull fresh as of 8/13/2023 5pm PST.
  • ComfyUI-Manager, dynamicprompts, and WAS nodes installed.

Steps

  • Create a flow with the Random node and create a prompt that refers to a file with the suspect character ō - example file testArtists.txt attached.
  • Execute the flow

Expect:

  • Generation of image

Result:

  • Python exception while custom node attempts to write out the generated prompt.

Current comfyui-dynamicprompts repo that I'm sync'd to:

git log --name-status HEAD^..HEAD
commit 584b204cc3c0aee793227479dd9bf1eabfc6b23c (HEAD -> main, origin/main, origin/HEAD)

(I will say, looking at the stack I'm not familiar w/ the presence of ComfyUI-Manager, which I do have installed, like lots of folks, for managing my custom node extensions.)

Let me know if you need anymore info. Thanks.

Attached: (1) original flow that eventually caused the issue (2) a wildcard file, testArtists.txt, that will directly repro the issue if referred to in a random prompt.

Epic Professional quality (art by Jacques Villon and Ingrid Baars-1 6) of dynamic action cinemat_0002
testArtists.txt

[feature request] output combinatorial results

if I have the prompt {A | B} with {C | D}, I know I need to iterate 2 x 2 = 4 times to get the combinatorial complete result.

But if I have wildcards, I have no idea how many iterations are needed without going into each txt file (and there can be many!) and counting the entries, then doing the math.

It would be nice to either a) have a loop node that totals the combinatorial requirements for a prompt and queues that many to be processed or b) at least a string output/dynamic field somewhere that tells me what the combinatorial result would be.

In the A1111 implimentation, option A is done automatically when "combinatorial mode" is checked, so every iteration is done with a click of a button.

update dynamicprompts to at least 0.30.4 to avoid regressions in 0.30.2

Found this because of the "disappearing commas" bug, adieyal/dynamicprompts#106

Timeline:
dynamicprompts version 0.30.2 was released Nov 9 2023

quickly updated with 0.30.3 and 0.30.4 on Nov 11 and Nov 12 due to regressions.

comfyui-dynamicprompts requirements.txt was updated on Nov 11 to 0.30.2, missing the .3 and .4 fixes.

dynamicprompts is now on 0.31.0, but that might be more involved; just updating to 0.30.4 should be an easy fix.

Can't load Dynamic Prompts

This is what it throws at me, I tried removing and re-installing and updating the ui

Traceback (most recent call last):
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\utils\import_utils.py", line 1282, in get_module
return importlib.import_module("." + module_name, self.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "importlib_init
.py", line 126, in import_module
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in load_unlocked
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\pipelines_init
.py", line 28, in
from ..image_processing_utils import BaseImageProcessor
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\image_processing_utils.py", line 28, in
from .image_transforms import center_crop, normalize, rescale
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\image_transforms.py", line 47, in
import tensorflow as tf
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\tensorflow_init
.py", line 45, in
from tensorflow.python import tf2 as _tf2
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\tensorflow\python\tf2.py", line 21, in
from tensorflow.python.platform import _pywrap_tf2
ImportError: DLL load failed while importing _pywrap_tf2: A dynamic link library (DLL) initialization routine failed.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1872, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 940, in exec_module
File "", line 241, in call_with_frames_removed
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts_init
.py", line 1, in
from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes_init_.py", line 4, in
from .magicprompt import DPMagicPrompt
File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\magicprompt.py", line 4, in
from dynamicprompts.generators.magicprompt import MagicPromptGenerator
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\dynamicprompts\generators\magicprompt.py", line 13, in
from transformers import (
File "", line 1229, in _handle_fromlist
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\utils\import_utils.py", line 1272, in getattr
module = self._get_module(self._class_to_module[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ComfyUI_windows_portable\python_embeded\Lib\site-packages\transformers\utils\import_utils.py", line 1284, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
DLL load failed while importing _pywrap_tf2: A dynamic link library (DLL) initialization routine failed.

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts module for custom nodes: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
DLL load failed while importing _pywrap_tf2: A dynamic link library (DLL) initialization routine failed.

No module named 'comfyui_dynamicprompts'

Not working.

ComfyUI\ComfyUI\custom_nodes\comfyui-dynamicprompts_init_.py", line 1, in
from comfy_dynamicprompts.nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
ModuleNotFoundError: No module named 'comfy_dynamicprompts'

Error after update

Hi,
I was using the nodes normally until I updated everything a day ago. Now it won't load:

Cannot import ...ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui-dynamicprompts module for custom nodes: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
jaxlib version 0.4.30 is newer than and incompatible with jax version 0.4.25. Please update your jax and/or jaxlib packages.

Thanks for any help, I use the Random Prompts everywhere and now can't use my workflows.

weird generic prompts being inserted

I constantly get things like "trending artstation, concept art, fantasy painting" and "top view, bokeh, beautiful lighting, 8 k, stunning scene, raytracing, octane" appended into even without using any wildcards in my prompt (or having any wildcards that contain these things for that matter). If I actually use a wildcard then a random one is added on each seed, if I didn't then the same one is appended until I change my prompt.
When I used this on June 25 it still works normally, but on July 10 it starts showing this problem (i don't use comfy every day). Was there an update I missed?

ERROR:comfyui-dynamicprompts.nodes.sampler:No more prompts to generate!

...\Comfy\ComfyUI_windows_portable_rog\ComfyUI\custom_nodes\comfyui-dynamicprompts\nodes\sampler.py", line 64, in _get_next_prompt
    return next(prompts)
StopIteration

During handling of the above exception, another exception occurred:

This error is thrown if you don't have any wildcards, this should be handled to not throw if no wildcards are present.

Feature request: Allow "Convert Text to input" Please please please

As with the "Clip Text Encode (Prompt)" default node you can convert text to an input and allow such things as a magic prompt into a random prompt to allow a combination of both, magic prompt doesn't seem to allow wildcards at the moment. Unless I'm doing something wrong in my nodes in which case, help would be greatly appreciated. Thank you for this node BTW.

Thanks :)

List errors with CLIPTextEncodeSDXL when using Portable ComfyUI

Currently trying out using SDXL and have been using a workflow provided by another user at:
https://civitai.com/models/133420/make-good-pic-xl

However, have been running into issues due using strings for lists indexing instead of indices or slices

When running the prompt (as shown in the civitai link)
I am met with:

Error occurred when executing CLIPTextEncodeSDXL:

list indices must be integers or slices, not str

File "\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "\ComfyUI_windows_portable\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 "\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_clip_sdxl.py", line 43, in encode
tokens["l"] = clip.tokenize(text_l)["l"]

I'm a little new to Python, so while I understand the issue is to do with list categorisation, I haven't quite worked out my steps to fix just yet.

Any help would be appreciated

Cannot import ComfyUI_node_Lilly module for custom nodes: 'gbk' codec can't encode character '\u2771'

this is the log when i start up comfyui. could you help fix this? i'm really need a wildcard node for many workflow.many thx.

E:\ComfyUI_windows_portable>.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
** ComfyUI start up time: 2023-08-08 13:44:04.500512

Prestartup times for custom nodes:
0.0 seconds: E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager

Total VRAM 24564 MB, total RAM 32525 MB
xformers version: 0.0.20
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
Using xformers cross attention
Adding extra search path checkpoints E:/sd-webui-aki-v4.2/models/Stable-diffusion
Adding extra search path configs E:/sd-webui-aki-v4.2/models/Stable-diffusion
Adding extra search path vae E:/sd-webui-aki-v4.2/models/VAE
Adding extra search path loras E:/sd-webui-aki-v4.2/models/Lora
Adding extra search path loras E:/sd-webui-aki-v4.2/models/LyCORIS
Adding extra search path upscale_models E:/sd-webui-aki-v4.2/models/ESRGAN
Adding extra search path upscale_models E:/sd-webui-aki-v4.2/models/RealESRGAN
Adding extra search path upscale_models E:/sd-webui-aki-v4.2/models/SwinIR
Adding extra search path embeddings E:/sd-webui-aki-v4.2/embeddings
Adding extra search path hypernetworks E:/sd-webui-aki-v4.2/models/hypernetworks
Adding extra search path controlnet E:/sd-webui-aki-v4.2/models/ControlNet

Loading: ComfyUI-Impact-Pack (V3.12.1)

Loading: ComfyUI-Impact-Pack (Subpack: V0.2)

Loading: ComfyUI-Manager (V0.21)

ComfyUI Revision: 1265 [1f0f4cc0]

Comfyroll Custom Nodes: Loaded
name : ComfyUI_node_Lilly
file : E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly_init_.py
os.path.basename(file) : init.py
os.path.splitext(os.path.basename(file))[0] : init
working directory : E:\ComfyUI_windows_portable
───────────────────────────────────────────────────── init start ─────────────────────────────────────────────────────__name__ : custom_nodes.ComfyUI_node_Lilly
file : E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly_init_.py
os.path.basename(file) : init.py
os.path.splitext(os.path.basename(file))[0] : init
working directory : E:\ComfyUI_windows_portable
[13:44:13] Load ok : CheckpointLoaderRandom init.py:83[13:44:13] os.path.basename(file) : mypath.py mypath.py:29 os.path.abspath(file) : mypath.py:32 E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\mypath.py
os.path.abspath(file) : mypath.py:35 E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\mypath.py
os.path.normpath(file) : mypath.py:38 E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\mypath.py
os.path.dirname(normpath) : E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly mypath.py:41 os.path.basename(normpath) : mypath.py mypath.py:44 os.path.abspath(sys.modules['main'].file) : E:\ComfyUI_windows_portable\ComfyUI\main.py mypath.py:47 os.path.dirname(mainFile) : E:\ComfyUI_windows_portable\ComfyUI mypath.py:49 Load ok : CheckpointLoaderSimpleText init.py:83 wildcards card_path : wildcards.py:36 E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly....\wildcards***.txt
Traceback (most recent call last):
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly_init_.py", line 74, in add
exec(f"import {md}{name}")
File "", line 1, in
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\CLIPTextEncodeWildcards.py", line 10, in
from .wildcards import wildcards
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\wildcards.py", line 218, in
print("wildcards test : "+wildcards.run("aest"))
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\wildcards.py", line 197, in run
wildcards.card_load()
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly\wildcards.py", line 177, in card_load
lines = f.readlines()
File "encodings\cp1254.py", line 23, in decode
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 55: character maps to

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1647, in load_custom_node
module_spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in call_with_frames_removed
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly_init
.py", line 91, in
add("CLIPTextEncodeWildcards",["CLIPTextEncodeWildcards","CLIPTextEncodeWildcards2","CLIPTextEncodeWildcards3"])
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly_init_.py", line 85, in add
console.print_exception()
File "E:\ComfyUI_windows_portable\python_embeded\lib\site-packages\rich\console.py", line 1870, in print_exception
self.print(traceback)
File "E:\ComfyUI_windows_portable\python_embeded\lib\site-packages\rich\console.py", line 1672, in print
with self:
File "E:\ComfyUI_windows_portable\python_embeded\lib\site-packages\rich\console.py", line 864, in exit
self._exit_buffer()
File "E:\ComfyUI_windows_portable\python_embeded\lib\site-packages\rich\console.py", line 822, in _exit_buffer
self._check_buffer()
File "E:\ComfyUI_windows_portable\python_embeded\lib\site-packages\rich\console.py", line 2039, in _check_buffer
write(text)
File "E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py", line 22, in write
self.file.write(message)
UnicodeEncodeError: 'gbk' codec can't encode character '\u2771' in position 614: illegal multibyte sequence
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***

Cannot import E:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_node_Lilly module for custom nodes: 'gbk' codec can't encode character '\u2771' in position 614: illegal multibyte sequence
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***
Total VRAM 24564 MB, total RAM 32525 MB
xformers version: 0.0.20
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync

What is the Syntax to call Json/Yaml files?

I can use txt files just fine, but I do not know the syntax for JSON/YAML and its not listed in the tutorial from what I can see.
Edit: Oh and maybe also an explanation on how to call files that are in folders I tried collections/FILENAME but that didn´t work for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.