fix:fooocus inpaint not working in latest comfy version #211

This commit is contained in:
yolain
2024-06-14 23:02:28 +08:00
parent 9811cd79d0
commit fe32eda539
4 changed files with 16 additions and 9 deletions
+2
View File
@@ -30,6 +30,7 @@
- Background removal nodes for the RMBG-1.4 model supporting BriaAI, [BriaAI Guide](https://huggingface.co/briaai/RMBG-1.4)
- Forcibly cleared the memory usage of the comfy UI model are supported
- Stable Diffusion 3 multi-account API nodes are supported
- Support Stable Diffusion 3 model
## Installation
Clone the repo into the **custom_nodes** directory and install the requirements:
@@ -44,6 +45,7 @@ Double-click install.bat to install the required dependencies
**v1.1.9**
- Support for Stable Diffusion 3 model
- Added `easy applyInpaint` - All inpainting mode in this node
**v1.1.8**
+2 -1
View File
@@ -37,6 +37,7 @@
- 支持Stable Diffusion 3 多账号API节点
- 支持IC-Light的应用 [示例参考](https://github.com/yolain/ComfyUI-Yolain-Workflows?tab=readme-ov-file#2-5-ic-light) | [代码整合来源](https://github.com/huchenlei/ComfyUI-IC-Light) | [技术参考](https://github.com/lllyasviel/IC-Light)
- 中文提示词自动识别,使用[opus-mt-zh-en模型](https://huggingface.co/Helsinki-NLP/opus-mt-zh-en)
- 支持 sd3 模型
## 安装
将存储库克隆到 **custom_nodes** 目录并安装依赖
@@ -51,7 +52,7 @@ git clone https://github.com/yolain/ComfyUI-Easy-Use
**v1.1.9**
- 支持 sd3_medium_incl_clips 模型
- 支持 sd3 模型
- 增加 `easy applyInpaint` - 局部重绘全模式节点 (相比与之前的kSamplerInpating节点逻辑会更合理些)
**v1.1.8**
+4 -4
View File
@@ -6,9 +6,9 @@ import itertools
from comfy import model_management
from comfy.sdxl_clip import SDXLClipModel, SDXLRefinerClipModel, SDXLClipG
try:
from comfy.sd3_clip import SD3ClipModel, SDT5XXLModel
from comfy.sd3_clip import SD3ClipModel, T5XXLModel
except:
SD3ClipModel, SDT5XXLModel = None, None
SD3ClipModel, T5XXLModel = None, None
pass
from nodes import NODE_CLASS_MAPPINGS, ConditioningConcat, ConditioningZeroOut, ConditioningSetTimestepRange, ConditioningCombine
@@ -353,7 +353,7 @@ def advanced_encode(clip, text, token_normalization, weight_interpretation, w_ma
out = lg_out
pooled = torch.cat((l_pooled, g_pooled), dim=-1)
# t5xxl not working, need to fix
# t5xxl
if 't5xxl' in tokenized and clip.cond_stage_model.t5xxl is not None:
t5_out, t5_pooled = advanced_encode_from_tokens(tokenized['t5xxl'],
token_normalization,
@@ -414,7 +414,7 @@ def advanced_encode(clip, text, token_normalization, weight_interpretation, w_ma
else:
conditioning = cond
# setTimeRange
# setTimeStepRange
if time_start > 0 or time_end < 1:
conditioning_2, = ConditioningSetTimestepRange().set_range(conditioning, 0, time_start)
conditioning_1, = ConditioningZeroOut().zero_out(conditioning)
+8 -4
View File
@@ -1,3 +1,5 @@
#credit to Acly for this module
#from https://github.com/Acly/comfyui-inpaint-nodes
import torch
import comfy
from comfy.model_patcher import ModelPatcher
@@ -32,16 +34,18 @@ class InpaintWorker:
loaded_keys.add(key)
not_loaded = sum(1 for x in lora if x not in loaded_keys)
log_node_info(self.node_name,
f"{len(loaded_keys)} Lora keys loaded, {not_loaded} remaining keys not found in model."
)
if not_loaded > 0:
log_node_info(self.node_name,
f"{len(loaded_keys)} Lora keys loaded, {not_loaded} remaining keys not found in model."
)
return patch_dict
def calculate_weight_patched(self: ModelPatcher, patches, weight, key):
remaining = []
for p in patches:
alpha, v, strength_model = p
alpha = p[0]
v = p[1]
is_fooocus_patch = isinstance(v, tuple) and len(v) == 2 and v[0] == "fooocus"
if not is_fooocus_patch: