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

Scheduler selection in main UI #15333

Merged
merged 6 commits into from Mar 24, 2024
Merged

Scheduler selection in main UI #15333

merged 6 commits into from Mar 24, 2024

Conversation

AUTOMATIC1111
Copy link
Owner

@AUTOMATIC1111 AUTOMATIC1111 commented Mar 20, 2024

Description

  • adds scheduler selection to main UI
  • reworks sampler selection UI section to be in a separate file (modules/processing_scripts/sampler.py)
  • reworks the list of samplers to no longer include schedulers
  • writes schedule type as Schedule type infotext field (this was previously a setting)
  • schedule type of Automatic chooses the default appropriate scheduler for the sampler

I tested selecting different samplers and schedulers, changing rho and other params in settings, infotext pasting from old and current versions, all seems to work. Comments welcome.

Screenshots/videos:

firefox_pbkbXkLpap

@MoonRide303
Copy link

OMG, finally, hahah! Much better this way - thank you @AUTOMATIC1111! 😊

@MoonRide303
Copy link

Test results - prompt:

photography of a nice girl
Steps: 8, Sampler: Euler, Schedule type: SGM Uniform, CFG scale: 1, Seed: 0, Size: 896x1152, Model hash: 43f0501ac4, Model: sdxl_lightning_8step, Clip skip: 2, RNG: CPU, SGM noise multiplier: True, Version: v1.8.0-238-g31306ce6

and the output:
girl-a1111-v2

@gel-crabs
Copy link
Contributor

On the topic of scheduler selection, the Restart sampler in sd_samplers_extra.py currently forces Karras via the get_sigmas_karras function; I have tested with exponential/polyexponential and can confirm it has no issue with either.

@w-e-w
Copy link
Collaborator

w-e-w commented Mar 21, 2024

you forgot hires samples

@kaalibro
Copy link
Contributor

kaalibro commented Mar 22, 2024

UPD: Fixed, see PR below

Trying to use the "X/Y/Z plot" results in failure. On the dev branch works fine.

dev 57727e5
Screenshot 2024-03-22 160513

scheduler_selection 31306ce
Screenshot 2024-03-22 160916

Console logs
venv "D:\AI\SD\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Version: v1.8.0-238-g31306ce6
Commit hash: 31306ce6721e6f1ae323da64767da91897b3a1c2
Launching Web UI with arguments: --xformers --opt-sdp-attention --opt-channelslast --medvram --port 7860 --listen --ckpt-dir D:\AI\Data\SD\models\Stable-diffusion --vae-dir D:\AI\Data\SD\models\VAE --embeddings-dir D:\AI\Data\SD\embeddings --textual-inversion-templates-dir D:\AI\Data\SD\textual_inversion_templates --clip-models-path D:\AI\Data\SD\models\CLIP --gfpgan-models-path D:\AI\Data\SD\models\GFPGAN --codeformer-models-path D:\AI\Data\SD\models\Codeformer --esrgan-models-path D:\AI\Data\SD\models\ESRGAN --bsrgan-models-path D:\AI\Data\SD\models\BSRGAN --realesrgan-models-path D:\AI\Data\SD\models\RealESRGAN --ldsr-models-path D:\AI\Data\SD\models\LDSR --lora-dir D:\AI\Data\SD\models\Lora --hypernetwork-dir D:\AI\Data\SD\models\hypernetworks --scunet-models-path D:\AI\Data\SD\models\ScuNET --swinir-models-path D:\AI\Data\SD\models\SwinIR --localizations-dir D:\AI\Data\SD\localizations --styles-file D:\AI\Data\SD\styles.csv --disable-extra-extensions
*** "--disable-extra-extensions" arg was used, will only load built-in extensions ***
Loading weights [14953e03f0] from D:\AI\Data\SD\models\Stable-diffusion\SDXL⚡\lightningbloomxl_v10.safetensors
Running on local URL:  http://0.0.0.0:7860
Creating model from config: D:\AI\SD\stable-diffusion-webui\repositories\generative-models\configs\inference\sd_xl_base.yaml

To create a public link, set `share=True` in `launch()`.
Startup time: 18.0s (prepare environment: 3.4s, import torch: 4.4s, import gradio: 1.0s, setup paths: 2.2s, initialize shared: 0.8s, other imports: 0.5s, load scripts: 0.9s, reload hypernetworks: 0.2s, create ui: 0.4s, gradio launch: 4.2s).
Loading VAE weights from user metadata: D:\AI\Data\SD\models\VAE\sdxl_vae.safetensors
Applying attention optimization: xformers... done.
Model loaded in 13.6s (calculate hash: 0.2s, load weights from disk: 0.5s, create model: 0.6s, apply weights to model: 2.1s, apply channels_last: 0.2s, apply fp8: 7.3s, load VAE: 0.6s, load textual inversion embeddings: 0.3s, calculate empty prompt: 1.8s).
X/Y/Z plot will create 2 images on 1 2x1 grid. (Total steps to process: 8)
                                  generating image for xyz plot: AttributeError
Traceback (most recent call last):
  File "D:\AI\SD\stable-diffusion-webui\modules\processing.py", line 784, in process_images
    opts.set(k, v, is_api=True, run_callbacks=False)
  File "D:\AI\SD\stable-diffusion-webui\modules\options.py", line 151, in set
    option = self.data_labels[key]
KeyError: 'k_sched_type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\AI\SD\stable-diffusion-webui\scripts\xyz_grid.py", line 723, in cell
    res = process_images(pc)
  File "D:\AI\SD\stable-diffusion-webui\modules\processing.py", line 802, in process_images
    setattr(opts, k, v)
  File "D:\AI\SD\stable-diffusion-webui\modules\options.py", line 102, in __setattr__
    if info.do_not_save:
AttributeError: 'NoneType' object has no attribute 'do_not_save'

*** Error completing request
*** Arguments: ('task(8p6hou7rvuah98z)', <gradio.routes.Request object at 0x000001B9B668D630>, 'a girl sitting on a throne, head tilt, white hair, black tight dress, white fur trim, red fire behind, realistic, colorful', '', [], 1, 1, 1, 832, 1216, False, 0.2, 2, '4x-UltraSharp', 0, 0, 0, 'Use same checkpoint', 'Use same sampler', '', '', [], 3, 4, 'DPM++ SDE', 'SGM Uniform', 3168277607, False, -1, 0, 0, 0, False, 'CodeFormer', 0, False, 'second pass', False, '', 0.8, False, False, 'positive', 'comma', 20, False, False, 'start', '', 17, '', ['exponential', 'sgm_uniform'], 0, '', [], 0, '', [], True, False, False, False, False, False, False, 20, False) {}
    Traceback (most recent call last):
      File "D:\AI\SD\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\AI\SD\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\AI\SD\stable-diffusion-webui\modules\txt2img.py", line 105, in txt2img
        processed = modules.scripts.scripts_txt2img.run(p, *p.script_args)
      File "D:\AI\SD\stable-diffusion-webui\modules\scripts.py", line 768, in run
        processed = script.run(p, *script_args)
      File "D:\AI\SD\stable-diffusion-webui\scripts\xyz_grid.py", line 764, in run
        processed = draw_xyz_grid(
      File "D:\AI\SD\stable-diffusion-webui\scripts\xyz_grid.py", line 352, in draw_xyz_grid
        process_cell(x, y, z, ix, iy, iz)
      File "D:\AI\SD\stable-diffusion-webui\scripts\xyz_grid.py", line 296, in process_cell
        processed: Processed = cell(x, y, z, ix, iy, iz)
      File "D:\AI\SD\stable-diffusion-webui\scripts\xyz_grid.py", line 747, in cell
        grid_infotext[subgrid_index] = processing.create_infotext(pc, pc.all_prompts, pc.all_seeds, pc.all_subseeds)
      File "D:\AI\SD\stable-diffusion-webui\modules\processing.py", line 728, in create_infotext
        "Seed": p.all_seeds[0] if use_main_prompt else all_seeds[index],
    TypeError: 'NoneType' object is not subscriptable

---

- Fix "X/Y/Z plot" not working with "Schedule type"
- Fix "Schedule type" not being saved to "params.txt"
@AUTOMATIC1111 AUTOMATIC1111 merged commit bf2f7b3 into dev Mar 24, 2024
6 checks passed
@AUTOMATIC1111 AUTOMATIC1111 deleted the scheduler_selection branch March 24, 2024 02:22
@w-e-w w-e-w mentioned this pull request Apr 20, 2024
4 tasks
@37OMKAR
Copy link

37OMKAR commented Apr 27, 2024

its too dev++ completed, can any one help us how can we get the old sampler back, in a work way easy way

@37OMKAR
Copy link

37OMKAR commented Apr 27, 2024

Description

  • adds scheduler selection to main UI
  • reworks sampler selection UI section to be in a separate file (modules/processing_scripts/sampler.py)
  • reworks the list of samplers to no longer include schedulers
  • writes schedule type as Schedule type infotext field (this was previously a setting)
  • schedule type of Automatic chooses the default appropriate scheduler for the sampler

I tested selecting different samplers and schedulers, changing rho and other params in settings, infotext pasting from old and current versions, all seems to work. Comments welcome.

Screenshots/videos:

firefox_pbkbXkLpap

can we get the old sampler back ???

@twinkler83
Copy link

I never use schedulers like karras, exponential, etc because of their airbrush effect, especially on human skin.
Can we please have a "normal" option in "schedule type" selection?

@undeadx1
Copy link

I've been using the traditional approach of integrating the scheduler and sampler by implementing it myself. Can you please provide a unified UI like the old one?

@MoonRide303
Copy link

@undeadx1 Samplers and schedulers are two different things. The "traditional approach" presenting them as single entity was a design mistake. New samplers and new schedulers are being developed each year. If you have let's say 10 samplers and 5 schedulers then instead of having 2 short lists you'd have to maintain list of all 50 combinations. I understand some people were used to that, and that some software was built around how it previously worked, but this "traditional approach" should be just left in the history.

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.

None yet

8 participants