mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
allow longer substitutions without quotes for cross attention swap
This commit is contained in:
parent
92c6a3812d
commit
2619a0b286
@ -495,7 +495,7 @@ def build_parser_syntax(attention_plus_base: float, attention_minus_base: float)
|
||||
edited_fragment = pp.MatchFirst([
|
||||
lparen +
|
||||
(quoted_fragment |
|
||||
pp.Group(pp.Word(pp.printables, exclude_chars=string.whitespace + ',').set_parse_action(make_text_fragment))
|
||||
pp.Group(pp.OneOrMore(pp.Word(pp.printables, exclude_chars=string.whitespace + ',').set_parse_action(make_text_fragment)))
|
||||
) +
|
||||
pp.Dict(pp.OneOrMore(comma + cross_attention_option)) +
|
||||
rparen,
|
||||
|
@ -269,6 +269,14 @@ class PromptParserTestCase(unittest.TestCase):
|
||||
Fragment('eating a hotdog', 1)])]),
|
||||
parse_prompt("a \"cat\".swap(dog, t_start=0.1, s_start=20) eating a hotdog"))
|
||||
|
||||
self.assertEqual(
|
||||
Conjunction([
|
||||
FlattenedPrompt([Fragment('a fantasy forest landscape', 1),
|
||||
CrossAttentionControlSubstitute([Fragment('', 1)], [Fragment('with a river', 1)],
|
||||
options={'s_start': 0.8, 't_start': 0.8})])]),
|
||||
parse_prompt("a fantasy forest landscape \"\".swap(with a river, s_start=0.8, t_start=0.8)"))
|
||||
|
||||
|
||||
def test_escaping(self):
|
||||
|
||||
# make sure ", ( and ) can be escaped
|
||||
|
Loading…
Reference in New Issue
Block a user