From 86606248f5deaf19073fbc2a69a6ccf7693b6657 Mon Sep 17 00:00:00 2001 From: yolain Date: Wed, 7 Feb 2024 00:15:06 +0800 Subject: [PATCH] Upgrade to v1.0.5 --- README.en.md | 135 ++++++++----------------- README.md | 157 ++++++++++-------------------- __init__.py | 2 +- py/api.py | 1 + py/config.py | 4 + py/easyNodes.py | 50 +++++++--- py/logic.py | 53 ++++++++++ web/js/easy/easyDynamicWidgets.js | 6 +- 8 files changed, 191 insertions(+), 217 deletions(-) diff --git a/README.en.md b/README.en.md index 12d44b4..07917bb 100644 --- a/README.en.md +++ b/README.en.md @@ -29,151 +29,97 @@ After installing the node package, the UI interface will be automatically switch ## Changelog -**2024-02-02** +**v1.0.5 (2024-02-07)** + +- Added `easy isSDXL` +- `easy svdLoader` add prompt word control, which can be used with open_clip model + +**v1.0.4** - `easy showAnything` Added support for converting other types (e.g., tensor conditions, images, etc.) - -**2024-02-02** - -- Fixed xyplot replace getfont with getbbox to be compatible with Pillow>9.5 - -**2024-01-31** - -- Fixed `easy wildcards` An error is reported when running with the PS extension - Added `easy showLoaderSettingsNames` can display the model and VAE name in the output loader assembly - -**2024-01-29** - -- Changing the first-time install node package no longer automatically replaces the theme, you need to manually adjust and refresh the page -- `easy imageSave` added **only_preivew** - Added `easy promptList` -- Adjust the `easy latentCompositeMaskedWithCond` node - -**v1.0.4(2024-01-28)** - -- `easy kSamplerInpainting` Added the **patch** input value to be used with the FooocusInpaintLoader node - Added `easy fooocusInpaintLoader` (only the process of SDXLModel is supported) - Added **Logic** nodes - Added `easy imageSave` - Image saving node with date conversion and aspect and height formatting - Added `easy joinImageBatch` +- `easy kSamplerInpainting` Added the **patch** input value to be used with the FooocusInpaintLoader node + +- Fixed xyplot error when with Pillow>9.5 +- Fixed `easy wildcards` An error is reported when running with the PS extension - Fixed `easy XYInputs: ControlNet` Error - Fixed `easy loraStack` error when **toggle** is disabled -
-2024-01-22 -- Fixed `easy XYInputs: Sampler/Scheduler` Error -- Fixed the right menu has a problem when clicking the button -- Adjust the UI theme, divided into two sets of styles: the official default background and the dark black background, which can be switched in the color palette in the settings -
+- Changing the first-time install node package no longer automatically replaces the theme, you need to manually adjust and refresh the page +- `easy imageSave` added **only_preivew** +- Adjust the `easy latentCompositeMaskedWithCond` node -
-22024-01-21 -- Modify the styles path to be compatible with other environments -- Fixed `easy comfyLoader` error -- Fixed xyPlot error when connecting to zero123 -
+**v1.0.3** -v1.0.3(2024-01-19)** - -- Fixed the error message in the loader when the prompt word was component - Added `easy stylesSelector` - Added **scale_soft_weights** in `easy controlnetLoader` and `easy controlnetLoaderADV` - Added the queue progress bar setting item, which is not enabled by default + + +- Fixed `easy XYInputs: Sampler/Scheduler` Error +- Fixed the right menu has a problem when clicking the button +- Fixed `easy comfyLoader` error +- Fixed xyPlot error when connecting to zero123 +- Fixed the error message in the loader when the prompt word was component - Fixed `easy getNode` and `easy setNode` the title does not change when loading - Fixed all samplers using subdirectories to store images -
-2024-01-12 -- Fixed UI loading failure in the new version of ComfyUI -
+- Adjust the UI theme, divided into two sets of styles: the official default background and the dark black background, which can be switched in the color palette in the settings +- Modify the styles path to be compatible with other environments -
-2024-01-11 -- Replaced the font file used in the generation of XY diagrams -
- -
-2024-01-09 - -- Fixed XYPlot is not working when `a1111_prompt_style` is True -- An `autocomplete` folder has been added, If you have [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) installed, the txt files in that folder will be merged and overwritten to the autocomplete .txt file of the pyssss package at startup. -- Added a `📜Groups Map(EasyUse)` to the context menu. -
- -
-2024-01-08 - -- `easy XYInputs ModelMergeBlocks` Values can be imported from CSV files -- Fixed `easy pipeToBasicPipe` Bug -- Removed `easy imageRemBg` -
- -**v1.0.2(2024-01-05)** +**v1.0.2** - Added `easy XYPlotAdvanced` and some nodes about `easy XYInputs` - Added **Alt+1-Alt+9** Shortcut keys to quickly paste node presets for Node templates (corresponding to 1~9 sequences) +- Added a `📜Groups Map(EasyUse)` to the context menu. +- An `autocomplete` folder has been added, If you have [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts) installed, the txt files in that folder will be merged and overwritten to the autocomplete .txt file of the pyssss package at startup. + + +- Fixed XYPlot is not working when `a1111_prompt_style` is True +- Fixed UI loading failure in the new version of ComfyUI +- `easy XYInputs ModelMergeBlocks` Values can be imported from CSV files +- Fixed `easy pipeToBasicPipe` Bug + + +- Removed `easy imageRemBg` - Remove the introductory diagram and workflow files from the package to reduce the package size +- Replaced the font file used in the generation of XY diagrams +
-2024-01-03 +v1.0.1 - Fixed `easy comfyLoader` error - Fixed All nodes that contain the value of the image size - Added `easy kSamplerInpainting` - Added `easy pipeToBasicPipe` -
- -
-2024-01-02 - - Fixed `width` and `height` can not customize in `easy svdLoader` - Fixed all preview image path (Previously, it was not possible to preview the image on the Mac system) -
- -
-2023-12-31 - - Fixed `vae_name` is not working in `easy fullLoader` and `easy a1111Loader` and `easy comfyLoader` - Fixed `easy fullkSampler` outputs error -
- -
-2023-12-29 - - Fixed `model_override` is not working in `easy fullLoader` - Fixed `easy hiresFix` error -
- -
-2023-12-27 - - Fixed `easy xyplot` font file path error - Fixed seed that cannot be fixed when you convert `seed_num` to `easy seed` - Fixed `easy pipeIn` inputs bug - `easy preDetailerFix` have added a new parameter `optional_image` -
- -**v1.0.1(Updated at 12/26/2023)** - - Fixed `easy zero123Loader` and `easy svdLoader` model into cache. - Added `easy seed` - Fixed `image_output` default value is "Preview" - `easy fullLoader` and `easy a1111Loader` have added a new parameter `a1111_prompt_style`,that can reproduce the same image generated from stable-diffusion-webui on comfyui, but you need to install [ComfyUI_smZNodes](https://github.com/shiimizu/ComfyUI_smZNodes) to use this feature in the current version - - -
-Updated at 2023-12-25 - -- Fixed `easy globalSeed` is not working -- Fixed an issue where all `seed_num` values were out of order due to [cg-use-everywhere](https://github.com/chrisgoringe/cg-use-everywhere) updating the chart in real time
-v1.0.0(Updated at 12/24/2023) +v1.0.0 - Added `easy positive` - simple positive prompt text - Added `easy negative` - simple negative prompt text @@ -194,7 +140,8 @@ v1.0.3(2024-01-19)** - Added `easy poseEditor` - Pose editor - New UI Theme (Obsidian) - Auto-load UI by default, which can also be changed in the settings - +- Fixed `easy globalSeed` is not working +- Fixed an issue where all `seed_num` values were out of order due to [cg-use-everywhere](https://github.com/chrisgoringe/cg-use-everywhere) updating the chart in real time - Fixed `easy imageSize`, `easy imageSizeBySide`, `easy imageSizeByLongerSide` as end nodes - Fixed the bug that `seed_num` (random seed value) could not be read consistently in history
diff --git a/README.md b/README.md index 53706f6..e325875 100644 --- a/README.md +++ b/README.md @@ -37,151 +37,101 @@ ## 更新日志 -**2024-02-03** +**v1.0.5 (2024-02-07)** -- `easy showAnything` 增加支持转换其他类型(如:tensor类型的条件、图像等) +- 增加 `easy isSDXL` +- `easy svdLoader` 增加提示词控制, 可配合open_clip模型进行使用 -**2024-02-02** +**v1.0.4** -- 修改 xyplot 中 getsize 方法为 getbbox 以兼容 pillow>9.5 - -**2024-01-31** - -- 修复 `easy wildcards` 在使用PS扩展插件运行时报错 - 增加 `easy showLoaderSettingsNames` 可显示与输出加载器部件中的 模型与VAE名称 - -**2024-01-29** - -- 更改首次安装节点包不再自动替换主题,需手动调整并刷新页面 -- `easy imageSave` 增加 **only_preivew** - 增加 `easy promptList` - 提示词列表 -- 修改 `easy latentCompositeMaskedWithCond` - -**v1.0.4(2024-01-28)** - -- `easy kSamplerInpainting` 增加 **patch** 传入值,配合Fooocus内补节点使用 - 增加 `easy fooocusInpaintLoader` - Fooocus内补节点(仅支持XL模型的流程) - 增加 **Logic** 逻辑类节点 - 包含类型、计算、判断和转换类型等 - 增加 `easy imageSave` - 带日期转换和宽高格式化的图像保存节点 - 增加 `easy joinImageBatch` - 合并图像批次 +- `easy showAnything` 增加支持转换其他类型(如:tensor类型的条件、图像等) +- `easy kSamplerInpainting` 增加 **patch** 传入值,配合Fooocus内补节点使用 +- `easy imageSave` 增加 **only_preivew** + +- 修复 xyplot在pillow>9.5中报错 +- 修复 `easy wildcards` 在使用PS扩展插件运行时报错 +- 修复 `easy latentCompositeMaskedWithCond` - 修复 `easy XYInputs: ControlNet` 报错 - 修复 `easy loraStack` **toggle** 为 disabled 时报错 -**2024-01-22** +- 修改首次安装节点包不再自动替换主题,需手动调整并刷新页面 + +**v1.0.3** + +- 增加 `easy stylesSelector` 风格化提示词选择器 +- 增加队列进度条设置项,默认为未启用状态 +- `easy controlnetLoader` 和 `easy controlnetLoaderADV` 增加参数 **scale_soft_weights** + - 修复 `easy XYInputs: Sampler/Scheduler` 报错 -- 修复 右侧菜单 点击按钮时老是跑位的问题 -- 调整UI主题,分为官方默认背景和深黑色背景两套样式,可在设置里调色板里切换(调整原因:深黑色背景对亮度较暗的用户和UP主不太友好) - -
-2024-01-21> - -- 修改 styles 路径以兼容其他环境 +- 修复 右侧菜单 点击按钮时老是跑位的问题 +- 修复 styles 路径在其他环境报错 - 修复 `easy comfyLoader` 读取错误 - 修复 xyPlot 在连接 zero123 时报错 -
- -**v1.0.3(2024-01-19)** - - 修复加载器中提示词为组件时报错 -- 增加 `easy stylesSelector` 风格化提示词选择器 -- `easy controlnetLoader` 和 `easy controlnetLoaderADV` 增加参数 **scale_soft_weights** -- 增加队列进度条设置项,默认为未启用状态 - 修复 `easy getNode` 和 `easy setNode` 加载时标题未更改 - 修复所有采样器中存储图片使用子目录前缀不生效的问题 -
-2024-01-12 -- 修复在Comfy新版本中UI加载失败 -
+- 调整UI主题 +
-2024-01-11 +v1.0.2 -- 替换了XY图生成时的字体文件 -
- -
-2024-01-09 +- 增加 **autocomplete** 文件夹,如果您安装了 [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts), 将在启动时合并该文件夹下的所有txt文件并覆盖到pyssss包里的autocomplete.txt文件。 +- 增加 `easy XYPlotAdvanced` 和 `easy XYInputs` 等相关节点 +- 增加 **Alt+1到9** 快捷键,可快速粘贴 Node templates 的节点预设 (对应 1到9 顺序) - 修复 `easy imageInsetCrop` 测量值为百分比时步进为1 - 修复 开启 `a1111_prompt_style` 时XY图表无法使用的问题 -- 增加了一个 **autocomplete** 文件夹,如果您安装了 [ComfyUI-Custom-Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts), 将在启动时合并该文件夹下的所有txt文件并覆盖到pyssss包里的autocomplete.txt文件。 - 右键菜单中增加了一个 `📜Groups Map(EasyUse)` -
- -
-2024-01-08 +- 修复在Comfy新版本中UI加载失败 +- 修复 `easy pipeToBasicPipe` 报错 - 修改 `easy fullLoader` 和 `easy a1111Loader` 中的 **a1111_prompt_style** 默认值为 False - `easy XYInputs ModelMergeBlocks` 支持csv文件导入数值 -- 修复 `easy pipeToBasicPipe` 报错 -- 移除了 `easy imageRemBg` (很多包中都有移除背景的节点,由于比较占用ComfyUI启动加载时间,这次更新中注释掉了其相关代码) -
-**v1.0.2(2024-01-05)** +- 替换了XY图生成时的字体文件 -- 增加 `easy XYPlotAdvanced` 和 `easy XYInputs` 等相关节点 -- 增加 **Alt+1到9** 快捷键,可快速粘贴 Node templates 的节点预设 (对应 1到9 顺序) +- 移除 `easy imageRemBg` - 移除包中的介绍图和工作流文件,减少包体积 + +
-2024-01-03 +v1.0.1 + +- 新增 `easy seed` - 简易随机种 +- `easy preDetailerFix` 新增了 `optional_image` 传入图像可选,如未传默认取值为pipe里的图像 +- 新增 `easy kSamplerInpainting` 用于内补潜空间的采样器 +- 新增 `easy pipeToBasicPipe` 用于转换到Impact的某些节点上 - 修复 `easy comfyLoader` 报错 - 修复所有包含输出图片尺寸的节点取值方式无法批处理的问题 -- 增加 `easy kSamplerInpainting` 用于内补潜空间的采样器 -- 增加 `easy pipeToBasicPipe` 用于转换到Impact的某些节点上 -
- -
-2024-01-02 - - 修复 `width` 和 `height` 无法在 `easy svdLoader` 自定义的报错问题 - 修复所有采样器预览图片的地址链接 (解决在 MACOS 系统中图片无法在采样器中预览的问题) -
- -
-2023-12-31 - - 修复 `vae_name` 在 `easy fullLoader` 和 `easy a1111Loader` 和 `easy comfyLoader` 中选择但未替换原始vae问题 - 修复 `easy fullkSampler` 除pipe外其他输出值的报错 -
- -
-2023-12-29 - - 修复 `easy hiresFix` 输入连接pipe和image、vae同时存在时报错 - 修复 `easy fullLoader` 中 `model_override` 连接后未执行 -
- -
-2023-12-27 - - 修复 因新增`easy seed` 导致action错误 - 修复 `easy xyplot` 的字体文件路径读取错误 - 修复 convert 到 `easy seed` 随机种无法固定的问题 - 修复 `easy pipeIn` 值传入的报错问题 -- `easy preDetailerFix` 新增了 `optional_image` 传入图像可选,如未传默认取值为pipe里的图像 -
- -**v1.0.1(2023-12-26)** - - 修复 `easy zero123Loader` 和 `easy svdLoader` 读取模型时将模型加入到缓存中 -- 新增 `easy seed` - 简易随机种 - 修复 `easy kSampler` `easy kSamplerTiled` `easy detailerFix` 的 `image_output` 默认值为 Preview - `easy fullLoader` 和 `easy a1111Loader` 新增了 `a1111_prompt_style` 参数可以重现和webui生成相同的图像,当前您需要安装 [ComfyUI_smZNodes](https://github.com/shiimizu/ComfyUI_smZNodes) 才能使用此功能 - -
-2023-12-25 - -- 修复 `easy globalSeed` 不生效问题 -- 修复所有的`seed_num` 因 [cg-use-everywhere](https://github.com/chrisgoringe/cg-use-everywhere) 实时更新图表导致值错乱的问题
-v1.0.0(2023-12-24) +v1.0.0 - 新增`easy positive` - 简易正面提示词文本 - 新增`easy negative` - 简易负面提示词文本 @@ -202,33 +152,26 @@ - 新增`easy poseEditor` - 姿势编辑器 - 新增UI主题(黑曜石)- 默认自动加载UI, 也可在设置中自行更替 - +- 修复 `easy globalSeed` 不生效问题 +- 修复所有的`seed_num` 因 [cg-use-everywhere](https://github.com/chrisgoringe/cg-use-everywhere) 实时更新图表导致值错乱的问题 - 修复`easy imageSize` `easy imageSizeBySide` `easy imageSizeByLongerSide` 可作为终节点 - 修复 `seed_num` (随机种子值) 在历史记录中读取无法一致的Bug
-
-2023-12-14 -- `easy a1111Loader` 和 `easy comfyLoader` 新增 `batch_size` 传入参数 +
+v0.5 + - 新增 `easy controlnetLoaderADV` 节点 +- 新增 `easy imageSizeBySide` 节点,可选输出为长边或短边 +- 新增 `easy LLLiteLoader` 节点,如果您预先安装过 kohya-ss/ControlNet-LLLite-ComfyUI 包,请将 models 里的模型文件移动至 ComfyUI\models\controlnet\ (即comfy默认的controlnet路径里,请勿修改模型的文件名,不然会读取不到)。 +- 新增 `easy imageSize` 和 `easy imageSizeByLongerSize` 输出的尺寸显示。 +- 新增 `easy showSpentTime` 节点用于展示图片推理花费时间与VAE解码花费时间。 - `easy controlnetLoaderADV` 和 `easy controlnetLoader` 新增 `control_net` 可选传入参数 - `easy preSampling` 和 `easy preSamplingAdvanced` 新增 `image_to_latent` 可选传入参数 -- 新增 `easy imageSizeBySide` 节点,可选输出为长边或短边 -
+- `easy a1111Loader` 和 `easy comfyLoader` 新增 `batch_size` 传入参数 -
-2023-12-13 - -- 新增 `easy LLLiteLoader` 节点,如果您预先安装过 kohya-ss/ControlNet-LLLite-ComfyUI 包,请将 models 里的模型文件移动至 ComfyUI\models\controlnet\ (即comfy默认的controlnet路径里,请勿修改模型的文件名,不然会读取不到)。 - 修改 `easy controlnetLoader` 到 loader 分类底下。 -- 新增 `easy imageSize` 和 `easy imageSizeByLongerSize` 输出的尺寸显示。 -
- -
-2023-12-11 - -- 新增 `easy showSpentTime` 节点用于展示图片推理花费时间与VAE解码花费时间。
## 涉及到的相关节点包 diff --git a/__init__.py b/__init__.py index de407f9..f59d734 100644 --- a/__init__.py +++ b/__init__.py @@ -87,4 +87,4 @@ WEB_DIRECTORY = "./web" __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS', "WEB_DIRECTORY"] -print('\033[34mComfy-Easy-Use (v1.0.4): \033[92mLoaded\033[0m') \ No newline at end of file +print('\033[34mComfy-Easy-Use (v1.0.5): \033[92mLoaded\033[0m') \ No newline at end of file diff --git a/py/api.py b/py/api.py index 7852239..5111b6e 100644 --- a/py/api.py +++ b/py/api.py @@ -1,5 +1,6 @@ import re import os +import torch import sys import json from server import PromptServer diff --git a/py/config.py b/py/config.py index 396ed27..1f7ab17 100644 --- a/py/config.py +++ b/py/config.py @@ -56,4 +56,8 @@ FOOOCUS_INPAINT_PATCH = { "inpaint (1.32GB)": { "model_url": "https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/inpaint.fooocus.patch" }, +} + +OPEN_CLIP = { + } \ No newline at end of file diff --git a/py/easyNodes.py b/py/easyNodes.py index 534fcde..7022c2b 100644 --- a/py/easyNodes.py +++ b/py/easyNodes.py @@ -28,7 +28,7 @@ from typing import Dict, List, Optional, Tuple, Union, Any from .adv_encode import advanced_encode, advanced_encode_XL from server import PromptServer -from nodes import VAELoader, MAX_RESOLUTION, RepeatLatentBatch, NODE_CLASS_MAPPINGS as ALL_NODE_CLASS_MAPPINGS, ConditioningSetMask +from nodes import VAELoader, MAX_RESOLUTION, RepeatLatentBatch, NODE_CLASS_MAPPINGS as ALL_NODE_CLASS_MAPPINGS, ConditioningSetMask, ConditioningConcat from comfy_extras.nodes_mask import LatentCompositeMasked from .config import BASE_RESOLUTIONS, RESOURCES_DIR, INPAINT_DIR, FOOOCUS_STYLES_DIR, FOOOCUS_INPAINT_HEAD, FOOOCUS_INPAINT_PATCH from .log import log_node_info, log_node_error, log_node_warn, log_node_success @@ -2227,20 +2227,26 @@ class svdLoader: return [file for file in filenames if file != "put_models_here.txt" and "svd" in file] return {"required": { - "ckpt_name": (get_file_list(folder_paths.get_filename_list("checkpoints")),), - "vae_name": (["Baked VAE"] + folder_paths.get_filename_list("vae"),), + "ckpt_name": (get_file_list(folder_paths.get_filename_list("checkpoints")),), + "vae_name": (["Baked VAE"] + folder_paths.get_filename_list("vae"),), + "clip_name": (["None"] + folder_paths.get_filename_list("clip"),), - "init_image": ("IMAGE",), - "resolution": (resolution_strings, {"default": "1024 x 576"}), - "empty_latent_width": ("INT", {"default": 256, "min": 16, "max": MAX_RESOLUTION, "step": 8}), - "empty_latent_height": ("INT", {"default": 256, "min": 16, "max": MAX_RESOLUTION, "step": 8}), + "init_image": ("IMAGE",), + "resolution": (resolution_strings, {"default": "1024 x 576"}), + "empty_latent_width": ("INT", {"default": 256, "min": 16, "max": MAX_RESOLUTION, "step": 8}), + "empty_latent_height": ("INT", {"default": 256, "min": 16, "max": MAX_RESOLUTION, "step": 8}), - "video_frames": ("INT", {"default": 14, "min": 1, "max": 4096}), - "motion_bucket_id": ("INT", {"default": 127, "min": 1, "max": 1023}), - "fps": ("INT", {"default": 6, "min": 1, "max": 1024}), - "augmentation_level": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 10.0, "step": 0.01}) - }, - "hidden": {"prompt": "PROMPT"}, "my_unique_id": "UNIQUE_ID"} + "video_frames": ("INT", {"default": 14, "min": 1, "max": 4096}), + "motion_bucket_id": ("INT", {"default": 127, "min": 1, "max": 1023}), + "fps": ("INT", {"default": 6, "min": 1, "max": 1024}), + "augmentation_level": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 10.0, "step": 0.01}) + }, + "optional": { + "optional_positive": ("STRING", {"default": "", "multiline": True}), + "optional_negative": ("STRING", {"default": "", "multiline": True}), + }, + "hidden": {"prompt": "PROMPT", "my_unique_id": "UNIQUE_ID"} + } RETURN_TYPES = ("PIPE_LINE", "MODEL", "VAE") RETURN_NAMES = ("pipe", "model", "vae") @@ -2248,7 +2254,7 @@ class svdLoader: FUNCTION = "adv_pipeloader" CATEGORY = "EasyUse/Loaders" - def adv_pipeloader(self, ckpt_name, vae_name, init_image, resolution, empty_latent_width, empty_latent_height, video_frames, motion_bucket_id, fps, augmentation_level, prompt=None, my_unique_id=None): + def adv_pipeloader(self, ckpt_name, vae_name, clip_name, init_image, resolution, empty_latent_width, empty_latent_height, video_frames, motion_bucket_id, fps, augmentation_level, optional_positive=None, optional_negative=None, prompt=None, my_unique_id=None): model: ModelPatcher | None = None vae: VAE | None = None clip: CLIP | None = None @@ -2282,6 +2288,22 @@ class svdLoader: negative = [[torch.zeros_like(pooled), {"motion_bucket_id": motion_bucket_id, "fps": fps, "augmentation_level": augmentation_level, "concat_latent_image": torch.zeros_like(t)}]] + if clip_name != 'None': + clip_path = folder_paths.get_full_path("clip", clip_name) + clip = comfy.sd.load_clip(ckpt_paths=[clip_path], + embedding_directory=folder_paths.get_folder_paths("embeddings")) + if optional_positive is not None: + tokens = clip.tokenize(optional_positive) + cond, pooled = clip.encode_from_tokens(tokens, return_pooled=True) + positive_embeddings_final = [[cond, {"pooled_output": pooled}]] + positive, = ConditioningConcat().concat(positive, positive_embeddings_final) + if optional_negative is not None: + tokens = clip.tokenize(optional_negative) + cond, pooled = clip.encode_from_tokens(tokens, return_pooled=True) + negative_embeddings_final = [[cond, {"pooled_output": pooled}]] + negative, = ConditioningConcat().concat(negative, negative_embeddings_final) + + latent = torch.zeros([video_frames, 4, empty_latent_height // 8, empty_latent_width // 8]) samples = {"samples": latent} diff --git a/py/logic.py b/py/logic.py index 6f05bb1..909ab48 100644 --- a/py/logic.py +++ b/py/logic.py @@ -1,6 +1,7 @@ from typing import Iterator, List, Tuple, Dict, Any, Union, Optional from _decimal import Context, getcontext from decimal import Decimal +import torch import numpy as np import json @@ -334,6 +335,34 @@ class If: def execute(self, *args, **kwargs): return (kwargs['if'] if kwargs['any'] else kwargs['else'],) + +#是否为SDXL +from comfy.sdxl_clip import SDXLClipModel, SDXLRefinerClipModel, SDXLClipG +class isSDXL: + @classmethod + def INPUT_TYPES(s): + return { + "required": {}, + "optional": { + "optional_pipe": ("PIPE_LINE",), + "optional_clip": ("CLIP",), + } + } + + RETURN_TYPES = ("BOOLEAN",) + RETURN_NAMES = ("boolean",) + FUNCTION = "execute" + CATEGORY = "EasyUse/Logic" + + def execute(self, optional_pipe=None, optional_clip=None): + if optional_pipe is None and optional_clip is None: + raise Exception(f"[ERROR] optional_pipe or optional_clip is missing") + clip = optional_clip if optional_clip is not None else optional_pipe['clip'] + if isinstance(clip.cond_stage_model, (SDXLClipModel, SDXLRefinerClipModel, SDXLClipG)): + return (True,) + else: + return (False,) + #xy矩阵 class xyAny: @@ -438,6 +467,26 @@ class showAnything: return {"ui": {"text": values}} +# cleanGpuUsed +class cleanGPUUsed: + @classmethod + def INPUT_TYPES(s): + return {"required": {"anything": (AlwaysEqualProxy("*"), {})}, "optional": {}, + "hidden": {"unique_id": "UNIQUE_ID", "extra_pnginfo": "EXTRA_PNGINFO", + }} + + RETURN_TYPES = () + RETURN_NAMES = () + OUTPUT_NODE = True + FUNCTION = "empty_cache" + CATEGORY = "EasyUse/Logic" + + def empty_cache(self, anything, unique_id=None, extra_pnginfo=None): + if torch.cuda.is_available(): + torch.cuda.empty_cache() + + return () + NODE_CLASS_MAPPINGS = { "easy string": String, "easy int": Int, @@ -448,9 +497,11 @@ NODE_CLASS_MAPPINGS = { "easy compare": Compare, "easy imageSwitch": imageSwitch, "easy if": If, + "easy isSDXL": isSDXL, "easy xyAny": xyAny, "easy convertAnything": ConvertAnything, "easy showAnything": showAnything, + "easy cleanGpuUsed": cleanGPUUsed } NODE_DISPLAY_NAME_MAPPINGS = { "easy string": "String", @@ -462,7 +513,9 @@ NODE_DISPLAY_NAME_MAPPINGS = { "easy compare": "Compare", "easy imageSwitch": "Image Switch", "easy if": "If", + "easy isSDXL": "Is SDXL", "easy xyAny": "XYAny", "easy convertAnything": "Convert Any", "easy showAnything": "Show Any", + "easy cleanGpuUsed": "Clean GPU Used" } \ No newline at end of file diff --git a/web/js/easy/easyDynamicWidgets.js b/web/js/easy/easyDynamicWidgets.js index 692732d..ef17c80 100644 --- a/web/js/easy/easyDynamicWidgets.js +++ b/web/js/easy/easyDynamicWidgets.js @@ -39,6 +39,7 @@ function widgetLogic(node, widget) { toggleWidget(node, findWidgetByName(node, 'lora_model_strength'), true) toggleWidget(node, findWidgetByName(node, 'lora_clip_strength'), true) } + updateNodeHeight(node) } if (widget.name === 'rescale') { let rescale_after_model = findWidgetByName(node, 'rescale_after_model').value @@ -58,6 +59,7 @@ function widgetLogic(node, widget) { toggleWidget(node, findWidgetByName(node, 'height')) toggleWidget(node, findWidgetByName(node, 'percent')) } + updateNodeHeight(node) } if (widget.name === 'upscale_method') { if (widget.value === "None") { @@ -67,6 +69,7 @@ function widgetLogic(node, widget) { toggleWidget(node, findWidgetByName(node, 'factor'), true) toggleWidget(node, findWidgetByName(node, 'crop'), true) } + updateNodeHeight(node) } if (widget.name === 'image_output') { if (widget.value === 'Sender' || widget.value === 'Sender/Save'){ @@ -96,6 +99,7 @@ function widgetLogic(node, widget) { toggleWidget(node, findWidgetByName(node, 'seed_num'), true) toggleWidget(node, findWidgetByName(node, 'control_before_generate'), true) } + updateNodeHeight(node) } if (widget.name === 'num_loras') { let number_to_show = widget.value + 1 @@ -755,7 +759,7 @@ app.registerExtension({ }); -const getSetWidgets = ['rescale_after_model', 'rescale', 'image_output', +const getSetWidgets = ['rescale_after_model', 'rescale', 'image_output', 'lora_name', 'lora1_name', 'lora2_name', 'lora3_name', 'refiner_lora1_name', 'refiner_lora2_name', 'upscale_method', 'image_output', 'add_noise', 'info', 'sampler_name',