This commit is contained in:
LAOGOU-666
2025-12-24 23:11:03 +08:00
parent ce13df1006
commit 74632b08e8
18 changed files with 273 additions and 6 deletions
+132
View File
@@ -0,0 +1,132 @@
# ComfyUI-LG_SamplingUtils
![Image](./assets/1.png)
[中文文档](README_CN.md) | **English**
---
## Overview
**ComfyUI-LG_SamplingUtils** is a comprehensive toolset designed for ComfyUI by LAOGOU-666, providing a series of practical sampling nodes that make operations more intuitive and convenient. This extension focuses on advanced sampling techniques, particularly optimized for Flow Matching models like ZImage and Lumina2.
## Features
This extension includes four powerful nodes:
### 1. 🎈 ZImage Timestep Noise
Adds noise perturbation to timesteps during the sampling process to break model homogenization and produce more diverse outputs with different seeds.
**Key Features:**
- Two modes: `sigma` (traditional diffusion models) and `flow` (Flow Matching models)
- Adjustable noise strength and application range
- Optional mask support for localized effects
- Seed-based reproducibility
**Parameters:**
- `mode`: Choose between `sigma` (multiplicative noise) or `flow` (additive noise)
- `noise_strength`: Control the intensity of noise (0.0-2.0)
- `seed`: Random seed for reproducibility
- `start_percent` / `end_percent`: Define the sampling range where noise is applied
- `mask` (optional): Limit the effect to specific regions
### 2. 🎈 LG Noise Injection
Injects features from a reference image into the generation process through the CFG mechanism, allowing the model to "learn" specific qualities from the reference.
**Key Features:**
- Inject surface details like water droplets, sweat, textures
- Add material properties and reflections
- Mask support for targeted feature injection
- Strength decay over sampling steps
**Parameters:**
- `reference_image`: Image containing desired features
- `strength`: Injection strength (0.1-0.2 subtle, 0.2-0.4 noticeable)
- `start_percent` / `end_percent`: Define when feature injection occurs
- `mask` (optional): White areas receive feature injection
**Variant:** 🎈 **LG Noise Injection (Latent)** - Works directly with latent representations and automatically uses `noise_mask` if present in the latent.
### 3. Model Sampling ZImage
Adjusts sampling parameters for ZImage/Lumina2 models.
**Key Features:**
- Proper timestep scaling for Flow Matching models
- Adjustable noise schedule shift
- Compatible with ZImage, Lumina2, and AuraFlow
**Parameters:**
- `shift`: Noise schedule shift (default 3.0 for ZImage)
- `shift=1.0`: Linear schedule
- `shift>1.0`: Shifts toward high noise, more aggressive early steps
- `multiplier`: Timestep multiplier (1.0 for ZImage/AuraFlow, 1000 for SD3/Flux)
### 4. Sigmas Editor 🎚️
Interactive visual editor for adjusting the sigmas curve in real-time.
**Key Features:**
- Drag-and-drop curve editing
- Real-time visualization
- Fine-tune noise schedules for optimal results
## Examples
<div align="center">
![Example 1](./assets/01.jpg)
![Example 2](./assets/02.jpg)
![Example 3](./assets/03.jpg)
![Example 4](./assets/04.jpg)
![Example 5](./assets/05.jpg)
![Example 6](./assets/06.jpg)
![Example 7](./assets/07.jpg)
![Example 8](./assets/08.jpg)
</div>
## Installation
### Method 1: ComfyUI Manager (Recommended)
1. Open ComfyUI Manager
2. Search for "ComfyUI-LG_SamplingUtils"
3. Click Install
### Method 2: Manual Installation
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils.git
```
Restart ComfyUI after installation.
## Contact
- **WeChat**: wenrulaogou2033
- **Bilibili**: [老狗_学习笔记](https://space.bilibili.com/175873218?spm_id_from=333.788.0.0)
## Repository
[https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils](https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils)
## Support
If you encounter any issues or have suggestions, please open an issue on GitHub.
## Changelog
### v1.0.0
- Initial release
- Added ZImage Timestep Noise node
- Added LG Noise Injection nodes (Image and Latent variants)
- Added Model Sampling ZImage node
- Added Sigmas Editor node
---
**Enjoy creating with ComfyUI-LG_SamplingUtils! 🎈**
+133
View File
@@ -0,0 +1,133 @@
# ComfyUI-LG_SamplingUtils
![Image](./assets/1.png)
**中文** | [English](README.md)
---
## 概述
**ComfyUI-LG_SamplingUtils** 是由 LAOGOU-666 为 ComfyUI 设计的综合工具集,提供一系列实用的采样节点,使操作更加直观和便捷。本扩展专注于高级采样技术,特别针对 ZImage 和 Lumina2 等 Flow Matching 模型进行了优化。
## 功能特性
本扩展包含四个强大的节点:
### 1. 🎈 ZImage Timestep Noise(时间步噪声)
在采样过程中对时间步添加噪声扰动,打破模型的同质化输出,使不同种子能产生更明显的差异。
**核心功能:**
- 两种模式:`sigma`(传统扩散模型)和 `flow`(Flow Matching 模型)
- 可调节的噪声强度和应用范围
- 可选的遮罩支持,实现局部效果
- 基于种子的可重现性
**参数说明:**
- `mode`:选择 `sigma`(乘性噪声)或 `flow`(加性噪声)
- `noise_strength`:控制噪声强度(0.0-2.0)
- `seed`:随机种子,确保可重现
- `start_percent` / `end_percent`:定义噪声应用的采样范围
- `mask`(可选):限制效果到特定区域
### 2. 🎈 LG Noise Injection(噪声注入)
通过 CFG 机制将参考图像的特征注入到生成过程中,让模型"学习"参考图像的特定品质。
**核心功能:**
- 注入表面细节,如水珠、汗珠、纹理
- 添加材质属性和反射效果
- 支持遮罩进行定向特征注入
- 采样过程中强度逐渐衰减
**参数说明:**
- `reference_image`:包含所需特征的参考图像
- `strength`:注入强度(0.1-0.2 轻微,0.2-0.4 明显)
- `start_percent` / `end_percent`:定义特征注入的时机
- `mask`(可选):白色区域接收特征注入
**变体:** 🎈 **LG Noise Injection (Latent)** - 直接使用潜在表示工作,如果潜在中存在 `noise_mask` 则自动使用。
### 3. Model Sampling ZImage(ZImage 采样)
调整 ZImage/Lumina2 模型的采样参数。
**核心功能:**
- 为 Flow Matching 模型提供正确的时间步缩放
- 可调节的噪声调度偏移
- 兼容 ZImage、Lumina2 和 AuraFlow
**参数说明:**
- `shift`:噪声调度偏移(ZImage 默认 3.0)
- `shift=1.0`:线性调度
- `shift>1.0`:向高噪声偏移,早期步骤更激进
- `multiplier`:时间步乘数(ZImage/AuraFlow 为 1.0,SD3/Flux 为 1000)
### 4. Sigmas Editor 🎚️(Sigmas 编辑器)
交互式可视化编辑器,实时调整 sigmas 曲线。
**核心功能:**
- 拖放式曲线编辑
- 实时可视化
- 微调噪声调度以获得最佳结果
## 示例展示
<div align="center">
![Example 1](./assets/01.jpg)
![Example 2](./assets/02.jpg)
![Example 3](./assets/03.jpg)
![Example 4](./assets/04.jpg)
![Example 5](./assets/05.jpg)
![Example 6](./assets/06.jpg)
![Example 7](./assets/07.jpg)
![Example 8](./assets/08.jpg)
</div>
## 安装方法
### 方法 1:ComfyUI Manager(推荐)
1. 打开 ComfyUI Manager
2. 搜索 "ComfyUI-LG_SamplingUtils"
3. 点击安装
### 方法 2:手动安装
```bash
cd ComfyUI/custom_nodes
git clone https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils.git
```
安装后重启 ComfyUI。
## 联系方式
- **微信**: wenrulaogou2033
- **Bilibili**: [老狗_学习笔记](https://space.bilibili.com/175873218?spm_id_from=333.788.0.0)
## 仓库地址
[https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils](https://github.com/LAOGOU-666/ComfyUI-LG_SamplingUtils)
## 支持
如果您遇到任何问题或有建议,请在 GitHub 上提交 issue。
## 更新日志
### v1.0.0
- 首次发布
- 添加 ZImage Timestep Noise 节点
- 添加 LG Noise Injection 节点(图像和潜在变体)
- 添加 Model Sampling ZImage 节点
- 添加 Sigmas Editor 节点
---
**使用 ComfyUI-LG_SamplingUtils 愉快创作!🎈**
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -70,7 +70,7 @@ class LGNoiseInjection:
RETURN_TYPES = ("MODEL",)
FUNCTION = "apply"
CATEGORY = "advanced/model"
CATEGORY = "🎈LAOGOU/Sampling Utils"
DESCRIPTION = "将参考图像的特征(如水珠、纹理等)注入到生成结果中。"
def apply(self, model, vae, reference_image, strength, start_percent, end_percent, mask=None):
@@ -242,7 +242,7 @@ class LGNoiseInjectionLatent:
RETURN_TYPES = ("MODEL",)
FUNCTION = "apply"
CATEGORY = "advanced/model"
CATEGORY = "🎈LAOGOU/Sampling Utils"
DESCRIPTION = "直接输入 latent 进行特征注入,自动使用 latent 的 noise_mask 作为遮罩。"
def apply(self, model, reference_latent, strength, start_percent, end_percent):
+1 -1
View File
@@ -48,7 +48,7 @@ class ModelSamplingZImage:
RETURN_TYPES = ("MODEL",)
FUNCTION = "patch"
CATEGORY = "advanced/model"
CATEGORY = "🎈LAOGOU/Sampling Utils"
DESCRIPTION = "调整 ZImage/Lumina2 模型的采样参数。可设置 shift 和 multiplier。"
def patch(self, model, shift, multiplier):
+1 -1
View File
@@ -41,7 +41,7 @@ class SigmasEditor:
RETURN_TYPES = ("SIGMAS",)
RETURN_NAMES = ("adjusted_sigmas",)
FUNCTION = "adjust_sigmas"
CATEGORY = "sampling/custom_sampling/sigmas"
CATEGORY = "🎈LAOGOU/Sampling Utils"
DESCRIPTION = "Interactively adjust sigmas curve by dragging control points"
def adjust_sigmas(self, sigmas, sigmas_adjustments="[]", unique_id=None):
+1 -1
View File
@@ -65,7 +65,7 @@ class ZImageTimestepNoise:
RETURN_TYPES = ("MODEL",)
FUNCTION = "patch"
CATEGORY = "advanced/model"
CATEGORY = "🎈LAOGOU/Sampling Utils"
DESCRIPTION = "对 timestep 添加噪声扰动,改变模型对去噪步骤的感知。sigma 模式适用于传统扩散模型,flow 模式适用于 Flow Matching 模型(如 ZImage/Lumina2)。可选遮罩限制影响区域。"
def patch(self, model, sigmas, mode, noise_strength, seed, start_percent, end_percent, mask=None):
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_lg_samplingutils"
description = "This is a toolset designed for ComfyUI by LAOGOU-666, providing a series of practical sampling nodes, making our operation more intuitive and convenient"
version = "1.0.0"
version = "1.0.1"
license = { text = "LICENSE.txt" }
dependencies = [""]