Merge remote-tracking branch 'origin/dev' into refactor/remove-face-restoration

# Conflicts:
#	.pylintrc
#	.ruff.toml
This commit is contained in:
CalamitousFelicitousness
2026-02-10 14:38:14 +00:00
42 changed files with 853 additions and 643 deletions
+13 -9
View File
@@ -25,7 +25,7 @@ class Script(scripts_manager.Script):
with gr.Row():
gr.HTML('<a href="https://blackforestlabs.ai/flux-1-tools/">&nbsp 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