dynamicprompts
dynamicprompts copied to clipboard
[Bug] a pair of underscores not associated with a wildcard will cause the parsing to fail
This is using the A1111 extension. I happened to use a lora that had two underscores in its filename and when the wildcard that contained it chose that option the entire dynamic prompts failed, leaving the prompt unprocessed (but not failing the A1111 generation) and not showing any useful info in the stack trace.
I traced the problem to this part of the code of this library: dynamicprompts\parser\parse.py line 454 when the execution of the parse_string function gave an exception.
My temporary fix is replacing with this, so at least it gives an indication in the console of where the problem is:
try:
tokens = get_cached_parser(parser_config).parse_string(
prompt,
parse_all=True,
)
except Exception as exc:
raise ValueError(f"Could not parse prompt {prompt!r}") from exc
But it should probably be better to fix the parser to not fail when it finds double underscores.
As a workaround, you could change the wildcard wrap in the settings to another string - https://github.com/adieyal/sd-dynamic-prompts/#changing-syntax
I think it could be useful to add a "strict mode" to the SD extension, so that if prompt parsing fails, it'd fail the generation and not use the verbatim command. I've had that happen too many times...
I think it could be useful to add a "strict mode" to the SD extension, so that if prompt parsing fails, it'd fail the generation and not use the verbatim command. I've had that happen too many times...
That hasn't bothered me, but isn't onerous to implement so no reason not to.
Failing the generation when the parsing fails would be nice. But it also needs proper logging to see where it fails.