setting to enable/disable clip skip editing

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-04-28 09:44:46 -04:00
parent 59bdec09dc
commit 1b341dd809
5 changed files with 19 additions and 5 deletions
+5
View File
@@ -56,6 +56,11 @@
- new History tab where you can see all jobs since the server startup
and optionally download any of the previously generated images/videos
access via *system -> history*
- server restart from ui now replaces currently running process
instead of trying to reload python modules in-place
- add option to enable/disable clip skip
disabled by default to avoid issues with frequent incorrect recommendations
in *settings -> pipeline modifiers*
- configurable restore metadata from image to settings and to params
in *settings -> image metadata*
- **API**
+2 -1
View File
@@ -4,7 +4,8 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma
## Current
- ModernUI for custom model loader
- ModernUI for custom model loader
- ModernUI for history tab
### Issues/Limitations
+8 -3
View File
@@ -129,6 +129,8 @@ def create_buttons(tabs_list):
def should_skip(param):
skip_params = [p.strip().lower() for p in shared.opts.disable_apply_params.split(",")]
if not shared.opts.clip_skip_enabled:
skip_params += ['clip skip']
all_params = [p.lower() for p in get_all_fields()]
valid = any(p in all_params for p in skip_params)
skip = param.lower() in skip_params
@@ -225,15 +227,16 @@ def connect_paste(button, local_paste_fields, input_comp, override_settings_comp
if os.path.exists(filename):
with open(filename, "r", encoding="utf8") as file:
prompt = file.read()
shared.log.debug(f'Paste prompt: type="params" prompt="{prompt}"')
shared.log.debug(f'Prompt parse: type="params" prompt="{prompt}"')
else:
prompt = ''
else:
shared.log.debug(f'Paste prompt: type="current" prompt="{prompt}"')
shared.log.debug(f'Prompt parse: type="current" prompt="{prompt}"')
params = parse(prompt)
script_callbacks.infotext_pasted_callback(prompt, params)
res = []
applied = {}
skipped = {}
for output, key in local_paste_fields:
if callable(key):
v = key(params)
@@ -248,6 +251,7 @@ def connect_paste(button, local_paste_fields, input_comp, override_settings_comp
if should_skip(key):
debug(f'Paste skip: "{key}"="{v}"')
res.append(gr.update())
skipped[key] = v
continue
try:
valtype = type(output.value)
@@ -262,7 +266,8 @@ def connect_paste(button, local_paste_fields, input_comp, override_settings_comp
applied[key] = val
except Exception:
res.append(gr.update())
debug(f"Parse apply: {applied}")
list_applied = [{k: v} for k, v in applied.items() if not callable(v) and not callable(k)]
shared.log.debug(f"Prompt restore: apply={list_applied} skip={skipped}")
return res
if override_settings_component is not None:
+3
View File
@@ -558,6 +558,9 @@ options_templates.update(options_section(('quantization', "Quantization Settings
}))
options_templates.update(options_section(('advanced', "Pipeline Modifiers"), {
"clip_skip_sep": OptionInfo("<h2>CLiP Skip</h2>", "", gr.HTML),
"clip_skip_enabled": OptionInfo(False, "CLiP skip enabled"),
"token_merging_sep": OptionInfo("<h2>Token Merging</h2>", "", gr.HTML),
"token_merging_method": OptionInfo("None", "Token merging enabled", gr.Radio, {"choices": ['None', 'ToMe', 'ToDo']}),
"tome_ratio": OptionInfo(0.0, "ToMe token merging ratio", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.05}),
+1 -1
View File
@@ -186,7 +186,7 @@ def create_advanced_inputs(tab, base=True):
diffusers_pag_scale = gr.Slider(minimum=0.0, maximum=30.0, step=0.05, label='Attention guidance', value=0.0, elem_id=f"{tab}_pag_scale", visible=shared.native)
diffusers_pag_adaptive = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Adaptive scaling', value=0.5, elem_id=f"{tab}_pag_adaptive", visible=shared.native)
with gr.Row():
clip_skip = gr.Slider(label='CLIP skip', value=1, minimum=0, maximum=12, step=0.1, elem_id=f"{tab}_clip_skip", interactive=True)
clip_skip = gr.Slider(label='CLiP skip', value=1, minimum=0, maximum=12, step=0.1, elem_id=f"{tab}_clip_skip", interactive=shared.opts.clip_skip_enabled)
return vae_type, tiling, hidiffusion, cfg_scale, clip_skip, image_cfg_scale, diffusers_guidance_rescale, diffusers_pag_scale, diffusers_pag_adaptive, cfg_end