chore: clean up project metadata and docs

This commit is contained in:
gaclove
2026-10-23 15:27:11 +08:00
parent c13737d6d0
commit 2df4f7b7ff
7 changed files with 180 additions and 366 deletions
+1
View File
@@ -6,6 +6,7 @@ on:
- "v*.*.*"
permissions:
contents: read
issues: write
jobs:
+27
View File
@@ -0,0 +1,27 @@
name: Quality checks
on:
push:
pull_request:
permissions:
contents: read
jobs:
pre-commit:
name: Ruff and repository checks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install pre-commit
run: python -m pip install pre-commit
- name: Run checks
run: pre-commit run --all-files
+32
View File
@@ -0,0 +1,32 @@
# Contributing
## Development setup
The wrapper follows the Python version supported by the bundled LightX2V
submodule (Python 3.10 or newer).
```bash
git clone --recursive https://github.com/ModelTC/ComfyUI-Lightx2vWrapper.git
cd ComfyUI-Lightx2vWrapper
python -m pip install -r lightx2v/requirements.txt
python -m pip install -r requirements.txt pre-commit
pre-commit install
```
## Before opening a pull request
Run the repository checks from the project root:
```bash
pre-commit run --all-files
```
For workflow or runner changes, validate the affected ComfyUI workflow with a
local LightX2V installation and include the workflow or reproduction details
in the pull request description. Keep changes to the `lightx2v` submodule in a
separate upstream contribution unless the wrapper specifically requires a
submodule revision update.
Pull requests should explain the user-visible behavior, list validation
performed, and avoid committing model weights, generated media, credentials,
or local debugging artifacts.
+62 -167
View File
@@ -1,202 +1,97 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/) [![ComfyUI](https://img.shields.io/badge/ComfyUI-Custom%20Node-brightgreen)](https://github.com/comfyanonymous/ComfyUI) [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20Models-lightx2v-yellow)](https://huggingface.co/lightx2v) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/GacLove/ComfyUI-Lightx2vWrapper)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
[![ComfyUI](https://img.shields.io/badge/ComfyUI-Custom%20Node-brightgreen)](https://github.com/comfyanonymous/ComfyUI)
[![Models](https://img.shields.io/badge/models-LightX2V-yellow)](https://huggingface.co/lightx2v)
# ComfyUI-Lightx2vWrapper
[中文版](./README_CN.md) | English
ComfyUI custom nodes for [LightX2V](https://github.com/ModelTC/LightX2V). The
wrapper exposes LightX2V's modular configuration and runner APIs, together
with ComfyUI-friendly file inputs and output previews.
A ComfyUI custom node wrapper for LightX2V, enabling modular video generation with advanced optimization features.
[中文文档](README_CN.md)
## Features
## Supported workflows
- **Modular Configuration System**: Separate nodes for each aspect of video generation
- **Text-to-Video (T2V) and Image-to-Video (I2V)**: Support for both generation modes
- **Advanced Optimizations**:
- TeaCache acceleration (up to 3x speedup)
- Quantization support (int8, fp8)
- Memory optimization with CPU offloading
- Lightweight VAE options
- **LoRA Support**: Chain multiple LoRA models for customization
- **Multiple Model Support**: wan2.1, hunyuan architectures
The repository includes runnable workflow examples under
[`example_workflows/`](example_workflows/):
- [Wan 2.2](example_workflows/lighx2v_wan2.2.json) text/image-to-video
- [SekoTalk](example_workflows/lightx2v_seko_talk.json) and [static
SekoTalk](example_workflows/lightx2v_seko_talk_static.json)
- [Multi-person SekoTalk](example_workflows/lightx2v_seko_talk_multi_talk.json)
- [SeedVR2](example_workflows/lightx2v_seedvr.json) video restoration
- [SwiftVR image](example_workflows/lightx2v_swiftvr_image.json) and [SwiftVR
video](example_workflows/lightx2v_swiftvr_video.json) restoration
The examples are versioned with the wrapper and are the best reference for
current node names and connections.
## Installation
1. Clone this repository with submodules into your ComfyUI's `custom_nodes` directory:
Clone the repository with its LightX2V submodule into ComfyUI's
`custom_nodes` directory:
```bash
cd ComfyUI/custom_nodes
git clone --recursive https://github.com/gaclove/ComfyUI-Lightx2vWrapper.git
git clone --recursive https://github.com/ModelTC/ComfyUI-Lightx2vWrapper.git
cd ComfyUI-Lightx2vWrapper
python -m pip install -r lightx2v/requirements.txt
python -m pip install -r requirements.txt
```
If you already cloned without submodules, initialize them:
For an existing checkout, update the submodule with:
```bash
cd ComfyUI-Lightx2vWrapper
git submodule update --init --recursive
```
2. Install dependencies:
Download the model files from [LightX2V on Hugging Face](https://huggingface.co/lightx2v)
and place them under `ComfyUI/models/lightx2v/`.
```bash
cd ComfyUI-Lightx2vWrapper
# Install lightx2v submodule dependencies
pip install -r lightx2v/requirements.txt
# Install ComfyUI wrapper dependencies
pip install -r requirements.txt
```
## Node groups
3. Download models and place them in `ComfyUI/models/lightx2v/` directory
- **Configuration:** `LightX2VInferenceConfig`, `LightX2VTeaCache`,
`LightX2VQuantization`, and `LightX2VMemoryOptimization`.
- **Composition:** `LightX2VConfigCombinerV2` and `LightX2VConfigCombinerV3`.
- **Inference:** `LightX2VModularInferenceV2`.
- **Talk inputs:** single-object, file-list, JSON, and multi-object talk
combiners.
- **Video inputs and restoration:** `LightX2VInputVideoPath`, SeedVR2 and
SwiftVR loaders/samplers, plus `LightX2VOutputVideoPreview`.
- **LoRA:** `LightX2VLoRALoader`.
## Node Overview
The inference node currently accepts the model classes exposed by
`model_utils.support_model_cls_list`: Wan 2.1/2.2 variants, SekoTalk,
Qwen Image, and SeedVR2. The retired `*_distill` values remain selectable as
compatibility aliases for saved ComfyUI workflows and are normalized before
LightX2V's runner is built.
### Configuration Nodes
## Model files
#### 1. LightX2V Inference Config
Place each model in its own directory under `ComfyUI/models/lightx2v/`. LoRA
files can be placed in either `ComfyUI/models/lightx2v/loras/` or
`ComfyUI/models/loras/`.
Basic inference configuration for video generation.
- **Inputs**: model, task_type, inference_steps, seed, cfg_scale, width, height, video_length, fps
- **Output**: Base configuration object
#### 2. LightX2V TeaCache
Feature caching acceleration configuration.
- **Inputs**: enable, threshold (0.0-1.0), use_ret_steps
- **Output**: TeaCache configuration
- **Note**: Lower threshold = more speedup (0.1 ~2x, 0.2 ~3x)
#### 3. LightX2V Quantization
Model quantization settings for memory efficiency.
- **Inputs**: dit_precision, t5_precision, clip_precision, backend, sensitive_layers_precision
- **Output**: Quantization configuration
- **Backends**: Auto-detected (vllm, sgl, q8f)
#### 4. LightX2V Memory Optimization
Memory management strategies.
- **Inputs**: optimization_level, attention_type, enable_rotary_chunking, cpu_offload, unload_after_generate
- **Output**: Memory optimization configuration
#### 5. LightX2V Lightweight VAE
VAE optimization options.
- **Inputs**: use_tiny_vae, use_tiling_vae
- **Output**: VAE configuration
#### 6. LightX2V LoRA Loader
Load and chain LoRA models.
- **Inputs**: lora_name, strength (0.0-2.0), lora_chain (optional)
- **Output**: LoRA chain configuration
### Combination Node
#### 7. LightX2V Config Combiner
Combines all configuration modules into a single configuration.
- **Inputs**: All configuration types (optional)
- **Output**: Combined configuration object
### Inference Node
#### 8. LightX2V Modular Inference
Main inference node for video generation.
- **Inputs**: combined_config, prompt, negative_prompt, image (optional), audio (optional)
- **Outputs**: Generated video frames
## Usage Examples
### Basic T2V Workflow
1. Create LightX2V Inference Config (task_type: "t2v")
2. Use LightX2V Config Combiner
3. Connect to LightX2V Modular Inference with text prompt
4. Save video output
### I2V with Optimizations
1. Load input image
2. Create LightX2V Inference Config (task_type: "i2v")
3. Add LightX2V TeaCache (threshold: 0.26)
4. Add LightX2V Memory Optimization
5. Combine configs with LightX2V Config Combiner
6. Run LightX2V Modular Inference
### With LoRA
1. Create base configuration
2. Load LoRA with LightX2V LoRA Loader
3. Chain multiple LoRAs if needed
4. Combine all configs
5. Run inference
## Model Directory Structure
Download models from: <https://huggingface.co/lightx2v>
Models should be placed in:
```txt
```text
ComfyUI/models/lightx2v/
├── Wan2.1-I2V-14B-720P-xxx/ # Main model checkpoints
├── Wan2.1-I2V-14B-480P-xxx/ # Main model checkpoints
├── loras/ # LoRA models
├── Wan2.2-I2V-A14B-distill-fp8/
├── seedvr2_ema_3b_fp8/
└── loras/
```
## Tips
The exact directory names depend on the downloaded checkpoint. The model
picker only lists directories that exist on the local ComfyUI installation.
- Start with default settings and adjust based on your hardware
- Use TeaCache with threshold 0.1-0.2 for significant speedup
- Enable memory optimization if running on limited VRAM
- Quantization can reduce memory usage but may affect quality
- Chain multiple LoRAs for complex style combinations
## Development
## Troubleshooting
- **Out of Memory**: Enable memory optimization or use quantization
- **Slow Generation**: Enable TeaCache or reduce inference steps
- **Model Not Found**: Check model paths in `ComfyUI/models/lightx2v/`
## Example Workflows
Example workflow JSON files are provided in the `examples/` directory:
- `wan_i2v.json` - Basic image-to-video
- `wan_i2v_with_distill_lora.json` - I2V with distillation LoRA
- `wan_t2v_with_distill_lora.json` - T2V with distillation LoRA
## Contributing Guidelines
We welcome community contributions! Before submitting code, please ensure you follow these steps:
### Install Development Dependencies
```bash
pip install ruff pre-commit
```
### Code Quality Check
Before committing code, run the following command:
Install the development hook and run the same checks used by CI:
```bash
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
```
This will automatically check code formatting, syntax errors, and other code quality issues.
### Contribution Process
1. Fork this repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Create a Pull Request
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for pull request and workflow
validation guidelines.
+55 -168
View File
@@ -1,202 +1,89 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/downloads/) [![ComfyUI](https://img.shields.io/badge/ComfyUI-自定义节点-brightgreen)](https://github.com/comfyanonymous/ComfyUI) [![Hugging Face](https://img.shields.io/badge/%F0%9F%A4%97%20模型-lightx2v-yellow)](https://huggingface.co/lightx2v) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/GacLove/ComfyUI-Lightx2vWrapper)
[![许可证](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/downloads/)
[![ComfyUI](https://img.shields.io/badge/ComfyUI-自定义节点-brightgreen)](https://github.com/comfyanonymous/ComfyUI)
[![模型](https://img.shields.io/badge/models-LightX2V-yellow)](https://huggingface.co/lightx2v)
# ComfyUI-Lightx2vWrapper
[English](./README.md) | 中文版
[English](README.md) | 中文
LightX2V 的 ComfyUI 自定义节点封装,通过模块化配置实现视频生成和高级优化功能。
[LightX2V](https://github.com/ModelTC/LightX2V) 的 ComfyUI 自定义节点封装,
提供模块化配置、ComfyUI 文件输入以及视频输出预览。
## 功能特性
## 已提供的工作流
- **模块化配置系统**:为视频生成的各个方面提供独立的配置节点
- **文本生成视频(T2V)和图像生成视频(I2V)**:支持两种生成模式
- **高级优化功能**:
- TeaCache 加速(最高可达 3 倍速度提升)
- 量化支持(int8、fp8)
- 内存优化与 CPU 卸载
- 轻量级 VAE 选项
- **LoRA 支持**:可串联多个 LoRA 模型进行自定义
- **多模型支持**:wan2.1、hunyuan 架构
仓库在 [`example_workflows/`](example_workflows/) 中提供了与当前节点注册表
同步的示例:
## 安装说明
- [Wan 2.2](example_workflows/lighx2v_wan2.2.json) 文生视频/图生视频
- [SekoTalk](example_workflows/lightx2v_seko_talk.json) 和[静态
SekoTalk](example_workflows/lightx2v_seko_talk_static.json)
- [多人 SekoTalk](example_workflows/lightx2v_seko_talk_multi_talk.json)
- [SeedVR2](example_workflows/lightx2v_seedvr.json) 视频修复
- [SwiftVR 图像](example_workflows/lightx2v_swiftvr_image.json) 和 [SwiftVR
视频](example_workflows/lightx2v_swiftvr_video.json) 修复
1. 将此仓库克隆到 ComfyUI 的 `custom_nodes` 目录,包含子模块:
示例工作流会随封装器一起更新,可作为当前节点名称和连线方式的参考。
## 安装
将仓库和 LightX2V 子模块一起克隆到 ComfyUI 的 `custom_nodes` 目录:
```bash
cd ComfyUI/custom_nodes
git clone --recursive https://github.com/gaclove/ComfyUI-Lightx2vWrapper.git
git clone --recursive https://github.com/ModelTC/ComfyUI-Lightx2vWrapper.git
cd ComfyUI-Lightx2vWrapper
python -m pip install -r lightx2v/requirements.txt
python -m pip install -r requirements.txt
```
如果已经克隆但未包含子模块,请初始化子模块:
如果已有仓库但还没有子模块:
```bash
cd ComfyUI-Lightx2vWrapper
git submodule update --init --recursive
```
2. 安装依赖:
从 [Hugging Face 的 LightX2V 页面](https://huggingface.co/lightx2v) 下载模型,
放到 `ComfyUI/models/lightx2v/` 下。
```bash
cd ComfyUI-Lightx2vWrapper
# 安装 lightx2v 子模块依赖
pip install -r lightx2v/requirements.txt
# 安装 ComfyUI 封装器依赖
pip install -r requirements.txt
```
## 节点分组
3. 下载模型并放置在 `ComfyUI/models/lightx2v/` 目录
- **配置:** `LightX2VInferenceConfig`、`LightX2VTeaCache`、
`LightX2VQuantization`、`LightX2VMemoryOptimization`
- **组合:** `LightX2VConfigCombinerV2`、`LightX2VConfigCombinerV3`
- **推理:** `LightX2VModularInferenceV2`
- **Talk 输入:** 单对象、文件列表、JSON 和多人 Talk 组合节点
- **视频输入与修复:** `LightX2VInputVideoPath`、SeedVR2/SwiftVR 加载器与
采样器、`LightX2VOutputVideoPreview`
- **LoRA:** `LightX2VLoRALoader`
## 节点概览
推理节点当前支持 `model_utils.support_model_cls_list` 中的 Wan 2.1/2.2
变体、SekoTalk、Qwen Image 和 SeedVR2。旧 workflow 使用的 `*_distill`
值仍作为兼容别名保留,构建 LightX2V runner 前会自动归一化。
### 配置节点
## 模型目录
#### 1. LightX2V Inference Config(推理配置)
每个模型放在 `ComfyUI/models/lightx2v/` 下的独立目录中。LoRA 可以放在
`ComfyUI/models/lightx2v/loras/` 或 `ComfyUI/models/loras/`:
视频生成的基础推理配置。
- **输入**:model(模型)、task_type(任务类型)、inference_steps(推理步数)、seed(种子)、cfg_scale(CFG 缩放)、width(宽度)、height(高度)、video_length(视频长度)、fps(帧率)
- **输出**:基础配置对象
#### 2. LightX2V TeaCache(TeaCache 配置)
特征缓存加速配置。
- **输入**:enable(启用)、threshold(阈值 0.0-1.0)、use_ret_steps(使用返回步数)
- **输出**:TeaCache 配置
- **注意**:阈值越低 = 速度提升越大(0.1 约 2 倍,0.2 约 3 倍)
#### 3. LightX2V Quantization(量化配置)
模型量化设置,提升内存效率。
- **输入**:dit_precision(DIT 精度)、t5_precision(T5 精度)、clip_precision(CLIP 精度)、backend(后端)、sensitive_layers_precision(敏感层精度)
- **输出**:量化配置
- **后端**:自动检测(vllm、sgl、q8f)
#### 4. LightX2V Memory Optimization(内存优化)
内存管理策略。
- **输入**:optimization_level(优化级别)、attention_type(注意力类型)、enable_rotary_chunking(启用旋转分块)、cpu_offload(CPU 卸载)、unload_after_generate(生成后卸载)
- **输出**:内存优化配置
#### 5. LightX2V Lightweight VAE(轻量级 VAE)
VAE 优化选项。
- **输入**:use_tiny_vae(使用微型 VAE)、use_tiling_vae(使用平铺 VAE)
- **输出**:VAE 配置
#### 6. LightX2V LoRA Loader(LoRA 加载器)
加载并串联 LoRA 模型。
- **输入**:lora_name(LoRA 名称)、strength(强度 0.0-2.0)、lora_chain(LoRA 链,可选)
- **输出**:LoRA 链配置
### 组合节点
#### 7. LightX2V Config Combiner(配置组合器)
将所有配置模块组合成单一配置。
- **输入**:所有配置类型(可选)
- **输出**:组合后的配置对象
### 推理节点
#### 8. LightX2V Modular Inference(模块化推理)
视频生成的主推理节点。
- **输入**:combined_config(组合配置)、prompt(提示词)、negative_prompt(负面提示词)、image(图像,可选)、audio(音频,可选)
- **输出**:生成的视频帧
## 使用示例
### 基础 T2V 工作流
1. 创建 LightX2V Inference Config(task_type: "t2v")
2. 使用 LightX2V Config Combiner
3. 连接到 LightX2V Modular Inference,输入文本提示词
4. 保存视频输出
### 带优化的 I2V
1. 加载输入图像
2. 创建 LightX2V Inference Config(task_type: "i2v")
3. 添加 LightX2V TeaCache(threshold: 0.26)
4. 添加 LightX2V Memory Optimization
5. 使用 LightX2V Config Combiner 组合配置
6. 运行 LightX2V Modular Inference
### 使用 LoRA
1. 创建基础配置
2. 使用 LightX2V LoRA Loader 加载 LoRA
3. 如需要可串联多个 LoRA
4. 组合所有配置
5. 运行推理
## 模型目录结构
从以下地址下载模型:<https://huggingface.co/lightx2v>
模型应放置在:
```txt
```text
ComfyUI/models/lightx2v/
├── Wan2.1-I2V-14B-720P-xxx/ # 主模型检查点
├── Wan2.1-I2V-14B-480P-xxx/ # 主模型检查点
├── loras/ # LoRA 模型
├── Wan2.2-I2V-A14B-distill-fp8/
├── seedvr2_ema_3b_fp8/
└── loras/
```
## 使用技巧
具体目录名取决于下载的 checkpoint;模型选择器只会列出当前 ComfyUI 中存在
的目录。
- 从默认设置开始,根据硬件情况调整
- 使用 TeaCache,阈值设为 0.1-0.2 可显著提速
- 在显存有限时启用内存优化
- 量化可减少内存使用但可能影响质量
- 串联多个 LoRA 实现复杂风格组合
## 开发
## 故障排除
- **内存不足**:启用内存优化或使用量化
- **生成速度慢**:启用 TeaCache 或减少推理步数
- **找不到模型**:检查 `ComfyUI/models/lightx2v/` 中的模型路径
## 示例工作流
`examples/` 目录中提供了示例工作流 JSON 文件:
- `wan_i2v.json` - 基础图像生成视频
- `wan_i2v_with_distill_lora.json` - 带蒸馏 LoRA 的 I2V
- `wan_t2v_with_distill_lora.json` - 带蒸馏 LoRA 的 T2V
## 贡献指南
我们欢迎社区贡献!在提交代码之前,请确保遵循以下步骤:
### 安装开发依赖
```bash
pip install ruff pre-commit
```
### 代码质量检查
在提交代码之前,请运行以下命令:
安装 pre-commit 并运行 CI 使用的检查:
```bash
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
```
这将自动检查代码格式、语法错误和其他代码质量问题。
### 贡献流程
1. Fork 本仓库
2. 创建功能分支 (`git checkout -b feature/amazing-feature`)
3. 提交更改 (`git commit -m 'Add some amazing feature'`)
4. 推送到分支 (`git push origin feature/amazing-feature`)
5. 创建 Pull Request
贡献流程和 workflow 验证要求见 [`CONTRIBUTING.md`](CONTRIBUTING.md)。
-28
View File
@@ -142,34 +142,6 @@ class AudioFileHandler(FileHandler):
return waveform
def _save_with_wave(self, path: str, waveform: np.ndarray, sample_rate: int):
"""Save audio using wave module."""
import wave
with wave.open(path, "wb") as wav_file:
wav_file.setnchannels(1 if waveform.ndim == 1 else waveform.shape[-1])
wav_file.setsampwidth(2) # 16-bit
wav_file.setframerate(sample_rate)
if waveform.dtype != np.int16:
waveform = (waveform * 32767).astype(np.int16)
wav_file.writeframes(waveform.tobytes())
def _load_with_wave(self, path: str) -> Tuple[np.ndarray, int]:
"""Load audio using wave module."""
import wave
with wave.open(path, "rb") as wav_file:
sample_rate = wav_file.getframerate()
frames = wav_file.readframes(wav_file.getnframes())
waveform = np.frombuffer(frames, dtype=np.int16)
if wav_file.getnchannels() > 1:
waveform = waveform.reshape(-1, wav_file.getnchannels())
return waveform, sample_rate
class ImageFileHandler(FileHandler):
"""Handler for image files."""
+3 -3
View File
@@ -2,6 +2,8 @@
name = "lightx2vwrapper"
description = "ComfyUI-Lightx2vWrapper is an inference wrapper for Lightx2v designed for use with ComfyUI."
version = "1.1.0"
readme = "README.md"
requires-python = ">=3.10"
license = { file = "LICENSE" }
[project.urls]
@@ -19,10 +21,8 @@ line-length = 150
indent-width = 4
[tool.ruff.lint]
extend-select = ["I", "F401"]
ignore = ["F"]
extend-select = ["I"]
[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["F401"]
"**/lightx2v_kernel/*" = ["F401"]
"**/{cookbook,docs}/*" = ["E402", "F401", "F811", "F841"]