damian0815 / compel

A prompting enhancement library for transformers-type text embedding systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong parsing result without space

moono opened this issue · comments

Hi, first of all thank you for the great repository.

I was looking into parsed result via compel.parse_prompt_string(), and found that result is different than I expected.

Using compel with differs library like,

...
pipe = ... ...
compel = Compel(
    tokenizer=pipe.tokenizer,
    text_encoder=pipe.text_encoder,
    truncate_long_prompts=False,
)
    
prompt = " (extremely detailed CG unity 8k wallpaper)+, (best quality)1.3, extremely intricate, ultra-detailed, village+, close view, middle age,fantasy++ style, detailed, high quality, best illustration"

print(compel.parse_prompt_string(prompt))

It prints (look for fantasy++)

Conjunction:[FlattenedPrompt:[Fragment:'extremely detailed CG unity 8k wallpaper'@1.1, Fragment:','@1.0, Fragment:'best quality'@1.3, Fragment:', extremely intricate, ultra-detailed,'@1.0, Fragment:'village'@1.1, Fragment:', close view, middle age,fantasy++ style, detailed, high quality, best illustration'@1.0]] | type AND | weights [1.0] | loras []

if I add space after comma , and before fantasy++ to the prompt than, I get the result I expected,

...
pipe = ... ...
compel = Compel(
    tokenizer=pipe.tokenizer,
    text_encoder=pipe.text_encoder,
    truncate_long_prompts=False,
)
    
prompt = " (extremely detailed CG unity 8k wallpaper)+, (best quality)1.3, extremely intricate, ultra-detailed, village+, close view, middle age, fantasy++ style, detailed, high quality, best illustration"

print(compel.parse_prompt_string(prompt))
Conjunction:[FlattenedPrompt:[Fragment:'extremely detailed CG unity 8k wallpaper'@1.1, Fragment:','@1.0, Fragment:'best quality'@1.3, Fragment:', extremely intricate, ultra-detailed,'@1.0, Fragment:'village'@1.1, Fragment:', close view, middle age,'@1.0, Fragment:'fantasy'@1.2100000000000002, Fragment:'style, detailed, high quality, best illustration'@1.0]] | type AND | weights [1.0] | loras []

So it seems like a bug, so I just want to let you know.

Above issue happens on v1.1.0 and v1.1.5

thanks for the bug report, i'll take a look into it