Is it possible to add variables to the X/Y script? #3288
-
As per subject. Is it possible to add variables that are not in the script already? Ithink this is where they'd go:
etc. But, I don't know the names of the variables. Is there a list of variables to look at? I'd like to add HEIGHT and WIDTH as well as embeddings. Thanks, TB |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
The first string in each You can see a few functions like this at the top of the script, which each apply to a different kind of property. Some of them like So for some of these variables (height/width in particular), all it should take is adding the option to the list, and making sure to provide the correct type in the second argument: AxisOption("Height", int, apply_field("height"), format_value_add_label, None),
AxisOption("Width", int, apply_field("width"), format_value_add_label, None), |
Beta Was this translation helpful? Give feedback.
-
I've done a PR to add the aesthetic gradient parameters #4000 |
Beta Was this translation helpful? Give feedback.
-
Nice, the PR should make things easier. I couldn't find a simple way to do this from just modifying the X/Y script, but I did make it work with a small change to the extension itself. def process(self, p, aesthetic_weight, aesthetic_steps, aesthetic_lr, aesthetic_slerp, aesthetic_imgs, aesthetic_imgs_text, aesthetic_slerp_angle, aesthetic_text_negative):
lr, weight, steps = float(aesthetic_lr), float(aesthetic_weight), int(aesthetic_steps)
if hasattr(p, 'aesthetic_lr'):
lr = float(p.aesthetic_lr)
if hasattr(p, 'aesthetic_weight'):
weight = float(p.aesthetic_weight)
if hasattr(p, 'aesthetic_steps'):
steps = int(p.aesthetic_steps)
aesthetic.set_aesthetic_params(p, lr, weight, steps, aesthetic_imgs, aesthetic_slerp, aesthetic_imgs_text, aesthetic_slerp_angle, aesthetic_text_negative) |
Beta Was this translation helpful? Give feedback.
The first string in each
AxisOption
(thelabel
) is just for display in the dropdown and doesn't correspond to anything. What matters most is the third argument, which indicates a function to handle making changes to the generation variables before processing. For instance, in the "Seed" option,apply_field("seed")
will become a function that changes theseed
property of the next image to be processed.You can see a few functions like this at the top of the script, which each apply to a different kind of property. Some of them like
apply_hypernetwork
orapply_sampler
are specific to one parameter. But for the ones that useapply_field
, the place to look for the variable names is in theSta…