Skip to content

Commit

Permalink
Add Size as an XYZ Grid option
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Mar 22, 2024
1 parent 57727e5 commit 0a2b986
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/xyz_grid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from collections import namedtuple
from copy import copy
from itertools import permutations, chain
Expand Down Expand Up @@ -106,6 +107,17 @@ def apply_upscale_latent_space(p, x, xs):
opts.data["use_scale_latent_for_hires_fix"] = False


def apply_size(p, x: str, xs) -> None:
try:
width, _, height = x.partition('x')
width = int(width.strip())
height = int(height.strip())
p.width = width
p.height = height
except ValueError:
warnings.warn(f"Invalid size in XYZ plot: {x}")


def find_vae(name: str):
if name.lower() in ['auto', 'automatic']:
return modules.sd_vae.unspecified
Expand Down Expand Up @@ -271,6 +283,7 @@ def __init__(self, *args, **kwargs):
AxisOption("Refiner switch at", float, apply_field('refiner_switch_at')),
AxisOption("RNG source", str, apply_override("randn_source"), choices=lambda: ["GPU", "CPU", "NV"]),
AxisOption("FP8 mode", str, apply_override("fp8_storage"), cost=0.9, choices=lambda: ["Disable", "Enable for SDXL", "Enable"]),
AxisOption("Size", str, apply_size),
]


Expand Down

0 comments on commit 0a2b986

Please sign in to comment.