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

Another hr button fix #14728

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Another hr button fix #14728

merged 1 commit into from
Jan 27, 2024

Conversation

w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented Jan 22, 2024

Description

use force_enable_hr to set p.enable_hr = True in txt2img_create_processing
allow Script.setup() have access to the correct value

add a comment for p.txt2img_upscale

old

Description

  1. rework set_named_arg
  • the identifying a script using class name is problematic as currently as there's no convention to keep unique names with there script class name
    in base webui alone we have multiple scripts that are all called Scripts
    not to mention lots of extensions may use the same Script name for the Script
    change to using the scrip internal name

2024-01-22 18_51_30_697

the first tree is scripts from web UI that are just named Scripts,

  • and as opposed to returning none when there is an issue like script or element id is not found, raise runtime error

  • even though comparing the element ID using > is convenient as it allows you to ignore stuff like the prefix txt2img_ in txt2img_seed but this would cause a potential issue in that depending on the order of your arg
    for example if you have two elements args with IDs of seed and subseed
    if the order of the args is ['seed', 'subseed'] theneverything function as normal
    but if the order is ['subseed', 'seed'] when matching for seed it be match with subseed
    hence changed to using ==

  1. adding two new helper functions for extracting script args and setting script args
  1. rework txt2img_upscale (Hr button) p create argument
    • update all the arguments before p is actually created so that Script.setup() works with correct args
    • as it is possible for a certain extensions to utilize enable_hr batch_size ... in there Script.setup()
      • I was using enable_hr in Script.setup() of my extension, and noticed that the value is not set properly
  • update the entire seed script arg, previously only seed and subseed were read from infotext, now everything is form about seed infotext

    • this means when using Hr button, the seed UI is completely ignored

Checklist:

@w-e-w w-e-w requested a review from AUTOMATIC1111 as a code owner January 22, 2024 13:50
@AUTOMATIC1111
Copy link
Owner

I kind of don't like the more complicated implementation for txt2img_upscale and I don't understand why it's needed.

The change from script classname to script name is fine but I'd rather it was a single PR.

And as for addition of two other functions for settings script args, I'm not sure if they are needed too.

@w-e-w
Copy link
Collaborator Author

w-e-w commented Jan 23, 2024

I kind of don't like the more complicated implementation for txt2img_upscale and I don't understand why it's needed.

this I believe is implemented what you initially tried to implement then accidentally broke
irrc you initially try to set the seat using the set_named_arg you added for that specific purpose
but then you implemented something else which means the setup is already executed
so I implemented stuff to do every argument setting before it even creates p

the main point of this is that this makes setup() behave exactly the same as normal txt2img otherwise
there will be slight differences that might be important for certain extensions, yes those extension most likely can adapt but
it can also cause some potential bugs that is not going to be caught after a long time

I see this as slightly complicated it's here but reduce complications elsewhere

And as for addition of two other functions for settings script args, I'm not sure if they are needed too.

update_script_args it's just more convenient if you wash update the entire script arg
where as set_named_arg can do only do one-by-one

if you only need to update a small portion then short one by one is fine but it's totally possible that someone would want to update the entire arg for whatever reason
I think it's generally useful function for extensions / scripting

and get_script_args is is just the counterpart to set args, they might be some cases that we should just get the arcs but not set them, if I said a script needs to know what other script args are then this will come in handy


if by overcomplicating you mean that updating the entire seeds arg

I could agree with that the other orgs such as resize and variable seed strength doesn't need to be updated from the infotext
the only real two important values are the seed and sub-seed
but since I was doing that I decided to just implement it all for the sake of OCD
this can be changed to only update the seed and sub-seed easily

tbh I also have a bit of doubt that I don't know if I should update the entire seed script


The change from script classname to script name is fine but I'd rather it was a single PR.

I'll make it into a different po if this one is completely rejected

@w-e-w
Copy link
Collaborator Author

w-e-w commented Jan 24, 2024

And as for addition of two other functions for settings script args, I'm not sure if they are needed too.

theres also an issue with set_named_arg
the script arg you want to set has to have a pre-defined arg_elem_id

update_script_args is more universal in that it will work on all scripts

@AUTOMATIC1111
Copy link
Owner

this I believe is implemented what you initially tried to implement then accidentally broke irrc you initially try to set the seat using the set_named_arg you added for that specific purpose but then you implemented something else which means the setup is already executed so I implemented stuff to do every argument setting before it even creates p

the main point of this is that this makes setup() behave exactly the same as normal txt2img otherwise there will be slight differences that might be important for certain extensions, yes those extension most likely can adapt but it can also cause some potential bugs that is not going to be caught after a long time

I see this as slightly complicated it's here but reduce complications elsewhere

Well. We create p. It works just as usual. Setup runs just as usual. It sets the seed. Later in the program we change this seed. This is not abnormal. Custom scripts that create their own p will also do this (like XYZ plot). Why the need to touch the arguments set to p?

@w-e-w
Copy link
Collaborator Author

w-e-w commented Jan 24, 2024

Well. We create p. It works just as usual. Setup runs just as usual. It sets the seed. Later in the program we change this seed. This is not abnormal. Custom scripts that create their own p will also do this (like XYZ plot). Why the need to touch the arguments set to p?

it could be just me thinking too much
even though I don't know if they're even is a use case maybe there's this weird extension but somehow absolutely relies on seed the properties being set by the UI and not change afterwards

this use case seems more ridiculously what I think about it

do you want me to revert setting to the way it was previously
if reverted I still think update_script_args get_script_args are still useful functions to keep around

@AUTOMATIC1111
Copy link
Owner

AUTOMATIC1111 commented Jan 25, 2024

For txt2img_upscale, yes, unless there's a reason to do this your way, I'd like to keep it simpler.

update_script_args get_script_args: I kind of don't want to do positional script args. If those functions works with a dictionary of name/value pairs, that would be nice.

@w-e-w w-e-w marked this pull request as draft January 26, 2024 15:50
use force_enable_hr to set p.enable_hr = True
allow Script.setup() have access to the correct value

add a comment for p.txt2img_upscale
@w-e-w w-e-w force-pushed the another-Hr-button-fix- branch from 60c8877 to 2996e43 Compare January 27, 2024 06:14
@w-e-w w-e-w mentioned this pull request Jan 27, 2024
4 tasks
@w-e-w w-e-w marked this pull request as ready for review January 27, 2024 06:27
@w-e-w
Copy link
Collaborator Author

w-e-w commented Jan 27, 2024

The change from script classname to script name is fine but I'd rather it was a single PR.

moved to

For txt2img_upscale, yes, unless there's a reason to do this your way, I'd like to keep it simpler.
update_script_args get_script_args: I kind of don't want to do positional script args. If those functions works with a dictionary of name/value pairs, that would be nice.

removed for now

@AUTOMATIC1111 AUTOMATIC1111 merged commit 7ea0859 into dev Jan 27, 2024
6 checks passed
@AUTOMATIC1111 AUTOMATIC1111 deleted the another-Hr-button-fix- branch January 27, 2024 07:06
@w-e-w w-e-w mentioned this pull request Feb 17, 2024
@pawel665j pawel665j mentioned this pull request Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants