improve: SEGSUpscaler apply DifferentialDiffusion by noise_mask_feather

This commit is contained in:
Dr.Lt.Data
2024-03-17 12:56:29 +09:00
parent 92f0182fd6
commit 6b50c18336
2 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import configparser
import os
version_code = [4, 83, 5]
version_code = [4, 83, 6]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
dependency_version = 20
+11 -1
View File
@@ -1,9 +1,13 @@
from impact.utils import *
from impact import impact_sampling
from comfy_extras.chainner_models import model_loading
from comfy import model_management
import nodes
try:
from comfy_extras import nodes_differential_diffusion
except Exception:
print(f"[Impact Pack] ComfyUI is an outdated version. The DifferentialDiffusion feature will be disabled.")
# Implementation based on `https://github.com/lingondricka2/Upscaler-Detailer`
@@ -94,6 +98,12 @@ def img2img_segs(image, model, clip, vae, seed, steps, cfg, sampler_name, schedu
noise_mask = tensor_gaussian_blur_mask(noise_mask, noise_mask_feather)
noise_mask = noise_mask.squeeze(3)
if noise_mask_feather > 0:
try:
model = nodes_differential_diffusion.DifferentialDiffusion().apply(model)[0]
except Exception:
print(f"[Impact Pack] ComfyUI is an outdated version. The DifferentialDiffusion feature will be disabled.")
if control_net_wrapper is not None:
positive, negative, _ = control_net_wrapper.apply(positive, negative, image, noise_mask)