Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] a pair of underscores not associated with a wildcard will cause the parsing to fail #101

Open
acorderob opened this issue Nov 5, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@acorderob
Copy link

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.

@akx akx added the bug Something isn't working label Nov 7, 2023
@adieyal
Copy link
Owner

adieyal commented Nov 10, 2023

As a workaround, you could change the wildcard wrap in the settings to another string - https://github.com/adieyal/sd-dynamic-prompts/#changing-syntax

@akx
Copy link
Collaborator

akx commented Nov 11, 2023

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...

@adieyal
Copy link
Owner

adieyal commented Nov 11, 2023

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.

@acorderob
Copy link
Author

Failing the generation when the parsing fails would be nice. But it also needs proper logging to see where it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants