Use type to determine if it is enable
This commit is contained in:
parent
78aed1fa4a
commit
72377b0251
@ -318,7 +318,6 @@ infotext_to_setting_name_mapping = [
|
||||
('Conditional mask weight', 'inpainting_mask_weight'),
|
||||
('Model hash', 'sd_model_checkpoint'),
|
||||
('ENSD', 'eta_noise_seed_delta'),
|
||||
('Enable Custom KDiffusion Schedule', 'custom_k_sched'),
|
||||
('KDiffusion Scheduler Type', 'k_sched_type'),
|
||||
('KDiffusion Scheduler sigma_max', 'sigma_max'),
|
||||
('KDiffusion Scheduler sigma_min', 'sigma_min'),
|
||||
|
@ -46,6 +46,7 @@ sampler_extra_params = {
|
||||
|
||||
k_diffusion_samplers_map = {x.name: x for x in samplers_data_k_diffusion}
|
||||
k_diffusion_scheduler = {
|
||||
'None': None,
|
||||
'karras': k_diffusion.sampling.get_sigmas_karras,
|
||||
'exponential': k_diffusion.sampling.get_sigmas_exponential,
|
||||
'polyexponential': k_diffusion.sampling.get_sigmas_polyexponential
|
||||
@ -295,8 +296,7 @@ class KDiffusionSampler:
|
||||
|
||||
k_diffusion.sampling.torch = TorchHijack(self.sampler_noises if self.sampler_noises is not None else [])
|
||||
|
||||
if opts.custom_k_sched:
|
||||
p.extra_generation_params["Enable Custom KDiffusion Schedule"] = True
|
||||
if opts.k_sched_type != "None":
|
||||
p.extra_generation_params["KDiffusion Scheduler Type"] = opts.k_sched_type
|
||||
p.extra_generation_params["KDiffusion Scheduler sigma_max"] = opts.sigma_max
|
||||
p.extra_generation_params["KDiffusion Scheduler sigma_min"] = opts.sigma_min
|
||||
@ -325,7 +325,7 @@ class KDiffusionSampler:
|
||||
|
||||
if p.sampler_noise_scheduler_override:
|
||||
sigmas = p.sampler_noise_scheduler_override(steps)
|
||||
elif opts.custom_k_sched:
|
||||
elif opts.k_sched_type != "None":
|
||||
sigma_min, sigma_max = (0.1, 10) if opts.use_old_karras_scheduler_sigmas else (self.model_wrap.sigmas[0].item(), self.model_wrap.sigmas[-1].item())
|
||||
sigmas_func = k_diffusion_scheduler[opts.k_sched_type]
|
||||
sigmas_kwargs = {
|
||||
|
@ -517,8 +517,7 @@ options_templates.update(options_section(('sampler-params', "Sampler parameters"
|
||||
's_churn': OptionInfo(0.0, "sigma churn", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
's_tmin': OptionInfo(0.0, "sigma tmin", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
's_noise': OptionInfo(1.0, "sigma noise", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
|
||||
'custom_k_sched': OptionInfo(False, "Enable Custom KDiffusion Scheduler"),
|
||||
'k_sched_type': OptionInfo("karras", "scheduler type", gr.Dropdown, {"choices": ["karras", "exponential", "polyexponential"]}),
|
||||
'k_sched_type': OptionInfo("default", "scheduler type", gr.Dropdown, {"choices": ["None", "karras", "exponential", "polyexponential"]}),
|
||||
'sigma_max': OptionInfo(0.0, "sigma max", gr.Number).info("the maximum noise strength for the scheduler. Set to 0 to use the same value which 'xxx karras' samplers use."),
|
||||
'sigma_min': OptionInfo(0.0, "sigma min", gr.Number).info("the minimum noise strength for the scheduler. Set to 0 to use the same value which 'xxx karras' samplers use."),
|
||||
'rho': OptionInfo(7.0, "rho", gr.Number).info("higher will make a more steep noise scheduler (decrease faster). default for karras is 7.0, for polyexponential is 1.0"),
|
||||
|
Loading…
Reference in New Issue
Block a user