From 8ff7074da555b820b58ed42afd98690fcbd737eb Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Thu, 5 Feb 2026 21:31:49 +0000 Subject: [PATCH] feat: add Nunchaku variants for Fill and Depth in Flux Tools - Add 'Fill (Nunchaku)' and 'Depth (Nunchaku)' options to Flux Tools dropdown, loading models with +nunchaku suffix for SVDQuant quantization - Mark Fill and Depth nunchaku reference entries as hidden so they remain available for check_nunchaku() lookup but don't appear in Extra Networks - Filter hidden reference models in ui_extra_networks_checkpoints --- data/reference-nunchaku.json | 2 ++ modules/ui_extra_networks_checkpoints.py | 3 +++ scripts/flux_tools.py | 22 +++++++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/data/reference-nunchaku.json b/data/reference-nunchaku.json index c58db7385..75d0d4a92 100644 --- a/data/reference-nunchaku.json +++ b/data/reference-nunchaku.json @@ -50,6 +50,7 @@ "preview": "black-forest-labs--FLUX.1-Fill-dev.jpg", "desc": "Nunchaku SVDQuant quantization of FLUX.1-Fill-dev transformer for inpainting", "skip": true, + "hidden": true, "nunchaku": ["Model", "TE"], "tags": "nunchaku", "size": 0, @@ -61,6 +62,7 @@ "preview": "black-forest-labs--FLUX.1-Depth-dev.jpg", "desc": "Nunchaku SVDQuant quantization of FLUX.1-Depth-dev transformer for depth-conditioned generation", "skip": true, + "hidden": true, "nunchaku": ["Model", "TE"], "tags": "nunchaku", "size": 0, diff --git a/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py index 402037a23..160fa3327 100644 --- a/modules/ui_extra_networks_checkpoints.py +++ b/modules/ui_extra_networks_checkpoints.py @@ -60,6 +60,9 @@ class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage): for k, v in shared.reference_models.items(): count['total'] += 1 url = v['path'] + if v.get('hidden', False): + count['hidden'] += 1 + continue experimental = v.get('experimental', False) if experimental: if shared.cmd_opts.experimental: diff --git a/scripts/flux_tools.py b/scripts/flux_tools.py index aa0358ce1..b2e87c36c 100644 --- a/scripts/flux_tools.py +++ b/scripts/flux_tools.py @@ -25,7 +25,7 @@ class Script(scripts_manager.Script): with gr.Row(): gr.HTML('  Flux.1 Redux
') with gr.Row(): - tool = gr.Dropdown(label='Tool', choices=['None', 'Redux', 'Fill', 'Canny', 'Depth'], value='None') + tool = gr.Dropdown(label='Tool', choices=['None', 'Redux', 'Fill', 'Fill (Nunchaku)', 'Canny', 'Depth', 'Depth (Nunchaku)'], value='None') with gr.Row(): prompt = gr.Slider(label='Redux prompt strength', minimum=0, maximum=2, step=0.01, value=0, visible=False) process = gr.Checkbox(label='Control preprocess input images', value=True, visible=False) @@ -34,8 +34,8 @@ class Script(scripts_manager.Script): def display(tool): return [ gr.update(visible=tool in ['Redux']), - gr.update(visible=tool in ['Canny', 'Depth']), - gr.update(visible=tool in ['Canny', 'Depth']), + gr.update(visible=tool in ['Canny', 'Depth', 'Depth (Nunchaku)']), + gr.update(visible=tool in ['Canny', 'Depth', 'Depth (Nunchaku)']), ] tool.change(fn=display, inputs=[tool], outputs=[prompt, process, strength]) @@ -91,13 +91,15 @@ class Script(scripts_manager.Script): shared.log.debug(f'{title}: tool=Redux unload') redux_pipe = None - if tool == 'Fill': + if tool in ['Fill', 'Fill (Nunchaku)']: # pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16, revision="refs/pr/4").to("cuda") if p.image_mask is None: shared.log.error(f'{title}: tool={tool} no image_mask') return None - if shared.sd_model.__class__.__name__ != 'FluxFillPipeline': - shared.opts.data["sd_model_checkpoint"] = "black-forest-labs/FLUX.1-Fill-dev" + nunchaku_suffix = '+nunchaku' if tool == 'Fill (Nunchaku)' else '' + checkpoint = f"black-forest-labs/FLUX.1-Fill-dev{nunchaku_suffix}" + if shared.sd_model.__class__.__name__ != 'FluxFillPipeline' or shared.opts.sd_model_checkpoint != checkpoint: + shared.opts.data["sd_model_checkpoint"] = checkpoint sd_models.reload_model_weights(op='model', revision="refs/pr/4") p.task_args['image'] = image p.task_args['mask_image'] = p.image_mask @@ -124,11 +126,13 @@ class Script(scripts_manager.Script): shared.log.debug(f'{title}: tool=Canny unload processor') processor_canny = None - if tool == 'Depth': + if tool in ['Depth', 'Depth (Nunchaku)']: # pipe = diffusers.FluxControlPipeline.from_pretrained("black-forest-labs/FLUX.1-Depth-dev", torch_dtype=torch.bfloat16, revision="refs/pr/1").to("cuda") install('git+https://github.com/huggingface/image_gen_aux.git', 'image_gen_aux') - if shared.sd_model.__class__.__name__ != 'FluxControlPipeline' or 'Depth' not in shared.opts.sd_model_checkpoint: - shared.opts.data["sd_model_checkpoint"] = "black-forest-labs/FLUX.1-Depth-dev" + nunchaku_suffix = '+nunchaku' if tool == 'Depth (Nunchaku)' else '' + checkpoint = f"black-forest-labs/FLUX.1-Depth-dev{nunchaku_suffix}" + if shared.sd_model.__class__.__name__ != 'FluxControlPipeline' or shared.opts.sd_model_checkpoint != checkpoint: + shared.opts.data["sd_model_checkpoint"] = checkpoint sd_models.reload_model_weights(op='model', revision="refs/pr/1") if processor_depth is None: from image_gen_aux import DepthPreprocessor