mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
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
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
+13
-9
@@ -25,7 +25,7 @@ class Script(scripts_manager.Script):
|
||||
with gr.Row():
|
||||
gr.HTML('<a href="https://blackforestlabs.ai/flux-1-tools/">  Flux.1 Redux</a><br>')
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user