Skip to content

Commit

Permalink
fix k-diffusion
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Mandic <[email protected]>
  • Loading branch information
vladmandic committed Oct 23, 2024
1 parent 8a4cb94 commit f1cd2df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions modules/sd_samplers_kdiffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
from collections import deque
import torch
from modules import prompt_parser
from modules import devices
from modules import devices, errors
from modules import sd_samplers_common
import modules.shared as shared
from modules.script_callbacks import CFGDenoiserParams, cfg_denoiser_callback
from modules.script_callbacks import CFGDenoisedParams, cfg_denoised_callback
from modules.script_callbacks import AfterCFGCallbackParams, cfg_after_cfg_callback
from modules.script_callbacks import ExtraNoiseParams, extra_noise_callback

from installer import install

# deal with k-diffusion imports
k_sampling = None
install('clean-fid')
try:
import k_diffusion # pylint: disable=wrong-import-order
k_sampling = k_diffusion.sampling
Expand All @@ -25,8 +26,8 @@
import importlib
k_diffusion = importlib.import_module('modules.k-diffusion.k_diffusion')
k_sampling = k_diffusion.sampling
except Exception:
pass
except Exception as e:
errors.display(e, 'k-diffusion')
if k_sampling is None:
shared.log.info(f'Path search: {sys.path}')
shared.log.error("Module not found: k-diffusion")
Expand Down
2 changes: 1 addition & 1 deletion modules/ui_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def set_sampler_preset(preset):
sampler_options = gr.CheckboxGroup(label='Sampler options', elem_id=f"{tabname}_sampler_options", choices=options, value=values, type='value')
with gr.Row(elem_classes=['flex-break']):
shared.opts.data['schedulers_sigma'] = shared.opts.data.get('schedulers_sigma', 'default')
sampler_algo = gr.Radio(label='Sigma algorithm', elem_id=f"{tabname}_sigma_algo", choices=['default', 'karras', 'exponential', 'polyexponential'], value=shared.opts.data.schedulers_sigma, type='value')
sampler_algo = gr.Dropdown(label='Sigma algorithm', elem_id=f"{tabname}_sigma_algo", choices=['default', 'karras', 'exponential', 'polyexponential'], value=shared.opts.schedulers_sigma, type='value')
sampler_options.change(fn=set_sampler_original_options, inputs=[sampler_options, sampler_algo], outputs=[])
sampler_algo.change(fn=set_sampler_original_options, inputs=[sampler_options, sampler_algo], outputs=[])

Expand Down
2 changes: 1 addition & 1 deletion wiki
Submodule wiki updated from 862a9e to 53def8

0 comments on commit f1cd2df

Please sign in to comment.