Commit 7e77a38c authored by AUTOMATIC1111's avatar AUTOMATIC1111
Browse files

get XYZ plot to work with recent changes to refined specified in fields of p...

get XYZ plot to work with recent changes to refined specified in fields of p rather than in settings
parent d6b79b99
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -746,7 +746,7 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
    if p.tiling is None:
        p.tiling = opts.tiling

    if p.refiner_checkpoint not in (None, "", "None"):
    if p.refiner_checkpoint not in (None, "", "None", "none"):
        p.refiner_checkpoint_info = sd_models.get_closet_checkpoint_match(p.refiner_checkpoint)
        if p.refiner_checkpoint_info is None:
            raise Exception(f'Could not find checkpoint with name {p.refiner_checkpoint}')
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ class ScriptRefiner(scripts.ScriptBuiltinUI):
        # the actual implementation is in sd_samplers_common.py, apply_refiner

        if not enable_refiner or refiner_checkpoint in (None, "", "None"):
            p.refiner_checkpoint_info = None
            p.refiner_checkpoint = None
            p.refiner_switch_at = None
        else:
            p.refiner_checkpoint = refiner_checkpoint
+5 −13
Original line number Diff line number Diff line
@@ -85,20 +85,12 @@ def confirm_checkpoints(p, xs):
        if modules.sd_models.get_closet_checkpoint_match(x) is None:
            raise RuntimeError(f"Unknown checkpoint: {x}")

def apply_refiner_checkpoint(p, x, xs):
    if x == 'None':
        p.override_settings['sd_refiner_checkpoint'] = 'None'
        return

    info = modules.sd_models.get_closet_checkpoint_match(x)
    if info is None:
        raise RuntimeError(f"Unknown checkpoint: {x}")
    p.override_settings['sd_refiner_checkpoint'] = info.name

def confirm_refiner_checkpoints(p, xs):
def confirm_checkpoints_or_none(p, xs):
    for x in xs:
        if x == 'None':
        if x in (None, "", "None", "none"):
            continue

        if modules.sd_models.get_closet_checkpoint_match(x) is None:
            raise RuntimeError(f"Unknown checkpoint: {x}")

@@ -267,8 +259,8 @@ axis_options = [
    AxisOption("Token merging ratio", float, apply_override('token_merging_ratio')),
    AxisOption("Token merging ratio high-res", float, apply_override('token_merging_ratio_hr')),
    AxisOption("Always discard next-to-last sigma", str, apply_override('always_discard_next_to_last_sigma', boolean=True), choices=boolean_choice(reverse=True)),
    AxisOption("Refiner checkpoint", str, apply_refiner_checkpoint, format_value=format_remove_path, confirm=confirm_refiner_checkpoints, cost=1.0, choices=lambda: ['None'] + sorted(sd_models.checkpoints_list, key=str.casefold)),
    AxisOption("Refiner switch at", float, apply_override('sd_refiner_switch_at'))
    AxisOption("Refiner checkpoint", str, apply_field('refiner_checkpoint'), format_value=format_remove_path, confirm=confirm_checkpoints_or_none, cost=1.0, choices=lambda: ['None'] + sorted(sd_models.checkpoints_list, key=str.casefold)),
    AxisOption("Refiner switch at", float, apply_field('refiner_switch_at')),
]