From f82105144319fef7e973339062e972b6688fae11 Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Mon, 22 May 2023 23:09:03 +0800 Subject: [PATCH] Change karras to kdiffusion --- modules/processing.py | 8 ++++---- modules/shared.py | 2 +- modules/ui.py | 32 ++++++++++++++++---------------- scripts/xyz_grid.py | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/modules/processing.py b/modules/processing.py index ad5d59607..3fb05d79b 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -564,10 +564,10 @@ def create_infotext(p, all_prompts, all_seeds, all_subseeds, comments=None, iter "Steps": p.steps, "Sampler": p.sampler_name, "Enable Custom Karras Schedule": p.enable_karras, - "Karras Scheduler Type": p.k_sched_type, - "Karras Scheduler sigma_max": p.sigma_max, - "Karras Scheduler sigma_min": p.sigma_min, - "Karras Scheduler rho": p.rho, + "kdiffusion Scheduler Type": p.k_sched_type, + "kdiffusion Scheduler sigma_max": p.sigma_max, + "kdiffusion Scheduler sigma_min": p.sigma_min, + "kdiffusion Scheduler rho": p.rho, "CFG scale": p.cfg_scale, "Image CFG scale": getattr(p, 'image_cfg_scale', None), "Seed": all_seeds[index], diff --git a/modules/shared.py b/modules/shared.py index dbba0824d..069b37d83 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -47,7 +47,7 @@ ui_reorder_categories = [ "inpaint", "sampler", "checkboxes", - "karras_scheduler", + "kdiffusion_scheduler", "hires_fix", "dimensions", "cfg", diff --git a/modules/ui.py b/modules/ui.py index 28d4f1d1e..fd5c07995 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -484,7 +484,7 @@ def create_ui(): with FormRow(elem_classes="checkboxes-row", variant="compact"): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1, elem_id="txt2img_restore_faces") tiling = gr.Checkbox(label='Tiling', value=False, elem_id="txt2img_tiling") - t2i_enable_k_sched = gr.Checkbox(label='Custom Karras Scheduler', value=False, elem_id="txt2img_enable_k_sched") + t2i_enable_k_sched = gr.Checkbox(label='Custom KDiffusion Scheduler', value=False, elem_id="txt2img_enable_k_sched") enable_hr = gr.Checkbox(label='Hires. fix', value=False, elem_id="txt2img_enable_hr") hr_final_resolution = FormHTML(value="", elem_id="txtimg_hr_finalres", label="Upscaled resolution", interactive=False) @@ -511,9 +511,9 @@ def create_ui(): with gr.Row(): hr_negative_prompt = gr.Textbox(label="Negative prompt", elem_id="hires_neg_prompt", show_label=False, lines=3, placeholder="Negative prompt for hires fix pass.\nLeave empty to use the same negative prompt as in first pass.", elem_classes=["prompt"]) - elif category == "karras_scheduler": - with FormGroup(visible=False, elem_id="txt2img_karras_scheduler") as t2i_k_sched_options: - with FormRow(elem_id="txt2img_karras_scheduler_row1", variant="compact"): + elif category == "kdiffusion_scheduler": + with FormGroup(visible=False, elem_id="txt2img_kdiffusion_scheduler") as t2i_k_sched_options: + with FormRow(elem_id="txt2img_kdiffusion_scheduler_row1", variant="compact"): t2i_k_sched_type = gr.Dropdown(label="Type", elem_id="t2i_k_sched_type", choices=['karras', 'exponential', 'polyexponential'], value='karras') t2i_k_sched_sigma_min = gr.Slider(minimum=0.0, maximum=0.5, step=0.05, label='sigma min', value=0.1, elem_id="txt2img_sigma_min") t2i_k_sched_sigma_max = gr.Slider(minimum=5.0, maximum=50.0, step=0.1, label='sigma max', value=10.0, elem_id="txt2img_sigma_max") @@ -677,10 +677,10 @@ def create_ui(): (hr_negative_prompt, "Hires negative prompt"), (hr_prompts_container, lambda d: gr.update(visible=True) if d.get("Hires prompt", "") != "" or d.get("Hires negative prompt", "") != "" else gr.update()), (t2i_enable_k_sched, "Enable Custom Karras Schedule"), - (t2i_k_sched_type, "Karras Scheduler Type"), - (t2i_k_sched_sigma_max, "Karras Scheduler sigma_max"), - (t2i_k_sched_sigma_min, "Karras Scheduler sigma_min"), - (t2i_k_sched_rho, "Karras Scheduler rho"), + (t2i_k_sched_type, "KDiffusion Scheduler Type"), + (t2i_k_sched_sigma_max, "KDiffusion Scheduler sigma_max"), + (t2i_k_sched_sigma_min, "KDiffusion Scheduler sigma_min"), + (t2i_k_sched_rho, "KDiffusion Scheduler rho"), *modules.scripts.scripts_txt2img.infotext_fields ] parameters_copypaste.add_paste_fields("txt2img", None, txt2img_paste_fields, override_settings) @@ -872,11 +872,11 @@ def create_ui(): with FormRow(elem_classes="checkboxes-row", variant="compact"): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1, elem_id="img2img_restore_faces") tiling = gr.Checkbox(label='Tiling', value=False, elem_id="img2img_tiling") - i2i_enable_k_sched = gr.Checkbox(label='Custom Karras Scheduler', value=False, elem_id="txt2img_enable_k_sched") + i2i_enable_k_sched = gr.Checkbox(label='Custom KDiffusion Scheduler', value=False, elem_id="txt2img_enable_k_sched") - elif category == "karras_scheduler": - with FormGroup(visible=False, elem_id="img2img_karras_scheduler") as i2i_k_sched_options: - with FormRow(elem_id="img2img_karras_scheduler_row1", variant="compact"): + elif category == "kdiffusion_scheduler": + with FormGroup(visible=False, elem_id="img2img_kdiffusion_scheduler") as i2i_k_sched_options: + with FormRow(elem_id="img2img_kdiffusion_scheduler_row1", variant="compact"): i2i_k_sched_type = gr.Dropdown(label="Type", elem_id="t2i_k_sched_type", choices=['karras', 'exponential', 'polyexponential'], value='karras') i2i_k_sched_sigma_min = gr.Slider(minimum=0.0, maximum=0.5, step=0.05, label='sigma min', value=0.1, elem_id="txt2img_sigma_min") i2i_k_sched_sigma_max = gr.Slider(minimum=5.0, maximum=50.0, step=0.1, label='sigma max', value=10.0, elem_id="txt2img_sigma_max") @@ -1091,10 +1091,10 @@ def create_ui(): (sampler_index, "Sampler"), (restore_faces, "Face restoration"), (i2i_enable_k_sched, "Enable Custom Karras Schedule"), - (i2i_k_sched_type, "Karras Scheduler Type"), - (i2i_k_sched_sigma_max, "Karras Scheduler sigma_max"), - (i2i_k_sched_sigma_min, "Karras Scheduler sigma_min"), - (i2i_k_sched_rho, "Karras Scheduler rho"), + (i2i_k_sched_type, "KDiffusion Scheduler Type"), + (i2i_k_sched_sigma_max, "KDiffusion Scheduler sigma_max"), + (i2i_k_sched_sigma_min, "KDiffusion Scheduler sigma_min"), + (i2i_k_sched_rho, "KDiffusion Scheduler rho"), (cfg_scale, "CFG scale"), (image_cfg_scale, "Image CFG scale"), (seed, "Seed"), diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index cea43c188..74ece2527 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -220,10 +220,10 @@ axis_options = [ AxisOption("Sigma min", float, apply_field("s_tmin")), AxisOption("Sigma max", float, apply_field("s_tmax")), AxisOption("Sigma noise", float, apply_field("s_noise")), - AxisOption("Karras Scheduler Type", str, apply_field("k_sched_type"), choices=lambda: [x for x in sd_samplers_kdiffusion.k_diffusion_scheduler]), - AxisOption("Karras Scheduler Sigma Min", float, apply_field("sigma_min")), - AxisOption("Karras Scheduler Sigma Max", float, apply_field("sigma_max")), - AxisOption("Karras Scheduler rho", float, apply_field("rho")), + AxisOption("KDiffusion Scheduler Type", str, apply_field("k_sched_type"), choices=lambda: [x for x in sd_samplers_kdiffusion.k_diffusion_scheduler]), + AxisOption("KDiffusion Scheduler Sigma Min", float, apply_field("sigma_min")), + AxisOption("KDiffusion Scheduler Sigma Max", float, apply_field("sigma_max")), + AxisOption("KDiffusion Scheduler rho", float, apply_field("rho")), AxisOption("Eta", float, apply_field("eta")), AxisOption("Clip skip", int, apply_clip_skip), AxisOption("Denoising", float, apply_field("denoising_strength")),