stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: function parse_generation_parameter removes lastline if multiple loras are embedded in final text

Open thundaga opened this issue 9 months ago • 6 comments

Checklist

  • [x] The issue exists after disabling all extensions
  • [x] The issue exists on a clean installation of webui
  • [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
  • [x] The issue exists in the current version of the webui
  • [x] The issue has not been reported before recently
  • [ ] The issue has been reported before but has not been fixed yet

What happened?

File: modules/infotext_utils.py Line(s): 255 -> if len(re_param.findall(lastline)) < 3:

The function parse_generation_parameters from modules/infotext_utils.py has a built in functionality to ignore the last line of a text passed in if len(re_param.findall(lastline)) < 3, when this criteria is met the last line will not be added to the lines variable list.

Steps to reproduce the problem

Under the scenario a standalone prompt text such as this below is passed in, the last line will be ignored:

promptDescription1, promptDescription2, <lora: loraname1 v1:1>, <lora: loraname2 v1:1>, <lora: loraname3 v1:1>, extraDescription, etc

What should have happened?

I believe the loras format <lora: loraname> should be included in the regex so it does not ignore it when multiple ones are called in the last line.

What browsers do you use to access the UI ?

Mozilla Firefox

Sysinfo

Could not generate file

Console logs

no console log errors for this bug

Additional information

More curious as to if this is intended to not detect multiple lora formats for a last line in text since most geninfo are not composed of only the prompt.

thundaga avatar Mar 02 '25 09:03 thundaga

The specific line you are talking about is meant to detect if the infotext contains parameters, such as Steps:, Sampler:, Seed:, etc.

A normal infotext will contain an arbitary number of lines of positive prompts and negative prompts, but the parameters will always be in the last line, hence this script. Also, immediately under that line, it gets added back into the lines if the check passes anyway...

TL;DR: This does not do what you think it does

Haoming02 avatar Mar 06 '25 09:03 Haoming02

@Haoming02 yeah, real question was if this method ever had a use-case for parsing a text composed of only the prompt info and without the additional geninfo (steps: seed: etc..). this could be transitioned to a feature request if its beyond intended functionality.

thundaga avatar Mar 06 '25 09:03 thundaga

Again, if the last_line does not contain parameters, then it is added back into regular lines

Haoming02 avatar Mar 06 '25 10:03 Haoming02

@Haoming02 that is not the case in this scenario, the example I showed the 3 loras on the last line will lead it to be ignored and not added back based on the regex match. let me know if you get a different result from the text example provided. 👍

thundaga avatar Mar 06 '25 10:03 thundaga

Ah, I finally get what you meant


TL;DR: The current "re_param_code" also matches the LoRA syntax. So if your last line contains 3 or more LoRAs, then the line will be considered parameters instead.

Haoming02 avatar Mar 06 '25 13:03 Haoming02

But... when would this become a problem though?

Haoming02 avatar Mar 06 '25 13:03 Haoming02