← 开源

基于LTX2.3的向高清修复、视频去水印等编辑任务,提出统一的时空扩散技术路线:在 LTX-2.3 框架下以任务感知型适配器(Task-Aware Adapters)替代单一 LoRA 增量,通过轻量 Control-Transformer、零初始化残差连接与分层解耦注入机制,分别建模结构修复与纹理风格控制。为提升时序稳定性,方法在潜空间引入流引导注意力(Flow-Guided Latent Attention),结合跨帧滑窗关联与光流运动先验,降低闪烁并增强遮挡区域补全的一致性。针对三类核心场景,系统进一步整合语义遮挡重构、布局保持的指令编辑与频率域纹理精修,并采用渐进式多任务课程学习与任务路由策略,实现单模型多任务协同优化。

ModelsVision modelsPython
增长势头
+024 小时新增 Star0.0%
169
Star
12
Fork
+1
本周
1
贡献者
创建于 2026-04-23 · 更新于 2026-11-30 · 今日第 28031 名
主要开发者
Nueractive
README

LTX2-ICEdit-Insight:任务感知 IC-LoRA 的统一视频编辑框架

🎈 项目简介

本项目面向高清修复、视频去水印与语义编辑任务,提出统一的时空扩散技术路线:在 LTX-2.3 框架下以任务感知型适配器(Task-Aware Adapters)替代单一 LoRA 增量,通过轻量 Control-Transformer、零初始化残差连接与分层解耦注入机制,分别建模结构修复与纹理风格控制。为提升时序稳定性,方法在潜空间引入流引导注意力(Flow-Guided Latent Attention),结合跨帧滑窗关联与光流运动先验,降低闪烁并增强遮挡区域补全的一致性。针对三类核心场景,系统进一步整合语义遮挡重构、布局保持的指令编辑与频率域纹理精修,并采用渐进式多任务课程学习与任务路由策略,实现单模型多任务协同优化。

项目对应的 Hugging Face 模型仓库:

📄 论文信息

论文摘要对应的核心方法

  • TADA(Task-Aware Decoupled Adapter):通过任务感知门控、分支解耦注入与弱正交约束,分离“结构恢复”和“纹理/语义编辑”两类目标,减轻共享骨干上的任务干扰。
  • FGLC(Flow-Guided Latent Consistency):在潜空间联合光流对齐与跨帧注意力偏置,显式约束时间一致性,降低闪烁并提升运动区域和遮挡补全稳定性。
  • PMTR(Progressive Multi-Task Routing):通过渐进式课程学习与协同任务路由,提高单模型多任务联合训练时的收敛稳定性与泛化表现。

本仓库与论文的对应关系

  • 论文整体目标覆盖三类任务:视频超分/增强、遮挡去除与修复、语义编辑。
  • 当前仓库开放的推理入口聚焦于四个落地方向:视频修复、视频高清、去水印、去字幕。
  • 其中“去水印 / 去字幕”属于论文中的 occlusion removal and repair 场景;更通用的 instruction-driven semantic editing 当前仍处于训练中。

✨ 技术特点

  • 任务感知 IC-Edit 框架:针对视频修复、视频高清、去水印、去字幕四类任务分别构建指令条件与任务型 IC-LoRA,使模型不仅增强视觉质量,也理解不同编辑目标背后的恢复意图。
  • LTX-2.3 DiT 骨干适配:在 LTX-2.3 扩散 Transformer 视频底座上强化 latent 空间可编辑性、文本指令跟随能力、跨帧稳定性与高频细节恢复能力。
  • 时空一致性优化:通过跨帧约束降低闪烁、背景重建漂移、字幕残影、色彩跳变与运动过程中的细节抖动。
  • 退化感知训练课程:覆盖压缩伪影、运动模糊、噪声、低码率、文本遮挡、水印、logo、局部遮挡与低分辨率输入,提升真实短视频和移动端素材上的泛化表现。
  • 遮挡区域重建:对去水印和去字幕任务,不仅移除目标区域,还结合空间上下文与时序线索重建被遮挡内容后的合理背景结构、边界、光照与纹理连续性。
  • 频域增强型高清恢复:在视频高清任务中强化发丝、织物、皮肤、物体边缘、背景纹理与类文字精细结构的感知锐度与自然清晰度。

🎬 效果展示

视频修复 视频高清
去水印 去字幕

📖 目录

  1. 🛣️ 项目状态
  2. 📄 论文信息
  3. 💼 环境配置
  4. 🗂️ 项目结构
  5. 🧠 模型文件布局
  6. 🎨 ComfyUI 工作流文件
  7. 🚀 快速开始
  8. 🧩 流水线架构
  9. 🔧 关键技术修复
  10. ⚙️ 参数说明
  11. 📐 分辨率与帧数约束
  12. 🎯 应用场景
  13. 💾 VRAM 优化
  14. 📚 引用

🛣️ 项目状态

  • ✅ Insight 单入口推理脚本(run_pipeline.py)、工作流参考文件与运行参数说明
  • ✅ 视频修复
  • ✅ 视频高清
  • ✅ 去水印
  • ✅ 去字幕
  • ⬜ 通用视频编辑(训练中)

💼 环境配置

🧾 系统要求

项目 要求
GPU NVIDIA RTX 4090(24GB)或同等 Ada Lovelace / Hopper 架构
CUDA 12.4+
Python 3.10+
ffmpeg 系统级安装(非 pip)

1. 创建 conda 环境

conda create -n LTX2-icedit python=3.12 -y
conda activate LTX2-icedit

2. 安装 PyTorch(匹配 CUDA 版本)

# CUDA 12.8(RTX 4090 推荐)
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128

# CUDA 12.4
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu124

3. 安装依赖

pip install -r requirements.txt

4. 安装 ffmpeg(系统级)

# Ubuntu / Debian
sudo apt install ffmpeg

# conda(不推荐,可能与系统 libav 冲突)
# conda install -c conda-forge ffmpeg

🗂️ 项目结构

LTX2-ICEdit-Insight/
├── run_pipeline.py               # Insight 推理主脚本(单入口)
├── run_restoration.sh            # 视频修复脚本
├── run_hd.sh                     # 视频高清脚本
├── run_watermark_rm.sh           # 去水印脚本
├── run_subtitle_rm.sh            # 去字幕脚本
├── preprocess_video.py           # 视频预处理(ffmpeg 缩放到 480p)
├── workflows/
│   ├── LTX-2.3-ICLORA编辑-官方模型版本.json
│   └── LTX-2.3-IC编辑-comfyui模型版本.json
├── models/
│   ├── checkpoints/              # Insight 一体化 checkpoint
│   ├── latent_upscale_models/    # 空间上采样模型
│   ├── gemma_configs/            # Gemma(HF 格式)
│   └── loras/                    # IC-LoRA(按任务切换)
├── ltx_vendor/                   # vendored SDK(ltx_core + ltx_pipelines)
├── tests/
├── inputs/
└── outputs/

ltx_vendor/ 已内嵌 SDK,脚本通过 sys.path.insert(0, "ltx_vendor") 加载,无需外部 LTX-2/ 目录。


🧠 模型文件布局

项目对应的 Hugging Face 模型仓库:

Insight 版(run_pipeline.py)

组件 默认路径(相对仓库根目录)
Insight Checkpoint(内含 transformer + video/audio vae + text projection + vocoder) models/checkpoints/ltx-2.3-edit-insight-dev-fp8.safetensors
Upsampler models/latent_upscale_models/ltx-2.3-spatial-upscaler-x2-1.1.safetensors
Gemma models/gemma_configs/
视频修复 IC-LoRA models/loras/ltx2.3-train/ltx2.3-video-restoration-general.safetensors
视频高清 IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-video-upscale-general.safetensors
去水印 IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-watermark-remove-general.safetensors
去字幕 IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-subtitles-remove-general.safetensors

兼容性说明:本项目基于 Insight 基模训练的 IC-LoRA 不局限于 Insight 一体化 checkpoint,同样可以挂载到 ComfyUI 中的 LTX-2.3 原生模型上直接推理。具体接法详见 workflows/ 文件夹中的工作流参考文件。


🎨 ComfyUI 工作流文件

本项目训练的 IC-LoRA 可通过 ComfyUI 挂载到 LTX-2.3 官方原生模型上推理,不要求使用 Insight 一体化 checkpoint。workflows/ 文件夹提供以下参考工作流:

工作流文件 说明
workflows/LTX-2.3-ICLORA编辑-官方模型版本.json 官方原生模型 + IC-LoRA,涵盖视频修复、视频高清、去水印、去字幕等任务
workflows/LTX-2.3-IC编辑-comfyui模型版本.json ComfyUI 分离模型格式参考

🚀 快速开始

所有脚本在仓库根目录执行。

1. 预处理输入视频(可选)

python preprocess_video.py ./inputs/your_video.mp4 ./inputs/input_480p.mp4

2. Insight 一键脚本

bash run_restoration.sh                        # 视频修复
bash run_hd.sh                                 # 视频高清
bash run_hd.sh /path/to/input.mp4             # 视频高清(自定义输入)
bash run_watermark_rm.sh                       # 去水印
bash run_watermark_rm.sh /path/to/input.mp4   # 去水印(自定义输入)
bash run_subtitle_rm.sh                        # 去字幕
bash run_subtitle_rm.sh /path/to/input.mp4    # 去字幕(自定义输入)

3. 手动命令示例(run_pipeline.py)

视频修复模式:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode restoration \
  --video ./inputs/input_480p.mp4 \
  --prompt "将视频转换为超高清画质,在消除伪影的同时重建高频细节。" \
  --output ./outputs/output_restoration.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

视频高清模式:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode hd \
  --video ./inputs/input_480p.mp4 \
  --prompt "将视频转换为超高清画质,大幅提升画面清晰度与细节丰富度,增强色彩表现力与纹理细节。" \
  --output ./outputs/output_hd.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

去水印模式:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode watermark_rm \
  --video ./inputs/input_480p.mp4 \
  --prompt "去除视频画面中的短视频平台水印与相关遮挡痕迹,恢复干净、清晰、自然的原始画面。" \
  --output ./outputs/output_watermark_rm.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 1546 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

去字幕模式:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode subtitle_rm \
  --video ./inputs/input_480p.mp4 \
  --prompt "去除视频画面中的字幕文字与相关遮挡痕迹,恢复干净、自然的原始画面。" \
  --output ./outputs/output_subtitle_rm.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

🧩 流水线架构

默认单阶段推理流程(single_stage=True)

输入视频
    │
    ▼
[Video VAE Encoder]
    │ reference latent(编码参考帧)
    ▼
[VideoConditionByReferenceLatent]   ← IC-LoRA 引导:参考 latent 时序拼接到去噪序列
    │ conditionings
    ▼
[Transformer DiffusionStage]        ← 带融合 LoRA 权重,全分辨率,单次扩散
    │ sigma: [1.0 → 0.9375 → 0.8125 → 0.5625 → 0.25 → 0.0]
    ▼
[Video VAE Decoder]
    │
    ▼
输出 MP4

两阶段推理流程(--two-stage)

输入视频
    │
    ▼
[Video VAE Encoder @ 1/2 分辨率]
    │ reference latent(编码参考帧)
    ▼
[VideoConditionByReferenceLatent]   ← IC-LoRA 引导(仅 Stage1)
    │ conditionings
    ▼
[Transformer DiffusionStage - Stage1]
    │ sigma(stage1): [1.0 → 0.9375 → 0.8125 → 0.5625 → 0.25 → 0.0]
    ▼
[VideoUpsampler(latent 空间 ×2)]
    │ upscaled_latent
    ▼
[Transformer DiffusionStage - Stage2]
    │ 全分辨率 refinement(无 IC-LoRA,基于 upscaled_latent)
    │ sigma(stage2): [0.85 → 0.7250 → 0.4219 → 0.0]
    ▼
[Video VAE Decoder]
    │
    ▼
输出 MP4

ComfyUI 节点与 run_pipeline.py 对应关系

ComfyUI 节点 run_pipeline.py 实现
LTXLoadVideoModel / CheckpointLoaderSimple FixedBuilder(构建 transformer / VAE / text encoder,处理 fp8_input_scaled 反量化)
LTXICLoRALoaderModelOnly resolve_mode_settings + LoraPathStrengthAndSDOps(默认 strength=1.0,可由 --lora / --lora-strength 覆盖)
LTXAddVideoICLoRAGuide VideoConditionByReferenceLatent(通过 image_conditioner + create_ic_lora_conditionings 注入)
SamplerCustomAdvanced / LTXVSampler stage_1: DiffusionStage + resolve_sigma_schedule(profile)[0]
LatentUpscaleModel VideoUpsampler(仅 --two-stage)
Second-pass Sampler (refinement) stage_2: DiffusionStage + resolve_sigma_schedule(profile)[1](无 IC-LoRA,initial_latent=upscaled_latent)
LTXDecodeVideo / VAEDecode VideoDecoder

🔧 关键技术修复

  1. FP8 权重反量化修复 LoRA 方向问题 在 apply_loras 之前先将 fp8_input_scaled 权重反量化到 bf16,避免 LoRA delta 融合方向错误。

  2. 默认单阶段全分辨率,避免两阶段 Stage2 换脸/内容漂移 与工作流一致,默认 single_stage=True。

  3. 一体化 checkpoint 与 Gemma HF key 兼容 VAE / Audio VAE / Vocoder 复用 SDK 内置 key filter,Gemma 使用 GEMMA_HF_TEXT_ONLY_KEY_OPS 做 HF key 对齐。


⚙️ 参数说明

通用参数(run_pipeline.py)

参数 默认值 说明
--mode restoration restoration / hd / watermark_rm / subtitle_rm
--lora 由 mode 决定 覆盖默认 IC-LoRA 路径
--lora-strength 1.0 IC-LoRA 强度
--video 必填 输入视频
--prompt 必填 文本提示
--output 必填 输出路径
--height 1184 输出高度
--width 704 输出宽度
--num-frames 97 生成帧数,需满足 8k+1
--fps 24.0 帧率
--seed 42 随机种子
--two-stage 关闭 启用两阶段
--streaming-prefetch-count 2 layer streaming 预取层数
--no-streaming 关闭 禁用 layer streaming
--sigma-profile workflow workflow / distilled
--disable-white-mask 关闭 禁用全白 conditioning mask
--model-checkpoint models/checkpoints/ltx-2.3-edit-insight-dev-fp8.safetensors 覆盖 Insight 一体化 checkpoint
--model-upsampler models/latent_upscale_models/ltx-2.3-spatial-upscaler-x2-1.1.safetensors 覆盖 upsampler 路径
--model-gemma-root models/gemma_configs/ 覆盖 Gemma 根目录

📐 分辨率与帧数约束

  • 单阶段(默认):height / width 需为 32 的倍数
  • 两阶段(--two-stage):height / width 需为 64 的倍数
  • 帧数需满足:frames = 8k + 1(如 25 / 97 / 217)

常见输出分辨率(输入 270×480):

目标 实际值(32 对齐)
720×1280 704×1184
360×640 352×640
480p 对齐 512×288

🎯 应用场景

  • 短视频内容去水印与后处理
  • 广告素材修复与质量增强
  • 老旧视频修复与高清化
  • 低清素材清晰度提升与纹理恢复
  • AIGC 视频后期修正(闪烁、细节、稳定性)

💾 VRAM 优化

4090 24GB 估算(与其他进程共存):

配置 估算峰值 VRAM 备注
704×1184 × 217 帧 ~20GB+ 建议关闭 ComfyUI 等进程
704×1184 × 97 帧 ~17GB 常用长度
704×1184 × 25 帧 ~14GB 快速测试
512×288 × 217 帧 ~8GB 低分辨率全时长

优化建议:

  1. 使用 --streaming-prefetch-count 2(默认)
  2. 设置 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
  3. 关闭其他占用显存的进程

📚 引用

如果本项目或模型权重对你的研究或应用有帮助,可以引用以下论文:

@article{tang2026ltxinsight,
  title   = {LTX-Insight: Unified Video Restoration and Semantic Editing via Task-Aware Adaptation and Temporal Consistency},
  author  = {Tang, Fan and Li, Siyuan},
  journal = {Research Square},
  year    = {2026},
  month   = {05},
  doi     = {10.21203/rs.3.rs-9775063/v1},
  url     = {https://www.researchsquare.com/article/rs-9775063/v1}
}


LTX2-ICEdit-Insight: Unified Video Editing Framework with Task-Aware IC-LoRA

🎈 Introduction

This project targets high-definition restoration, video watermark removal, and semantic editing tasks, proposing a unified spatiotemporal diffusion approach. Under the LTX-2.3 framework, Task-Aware Adapters replace single LoRA increments. Through a lightweight Control-Transformer, zero-initialized residual connections, and hierarchical decoupled injection mechanisms, the method separately models structural restoration and texture/style control. To improve temporal stability, the approach introduces Flow-Guided Latent Attention in the latent space, combined with cross-frame sliding window correlation and optical flow motion priors, reducing flickering and enhancing consistency in occluded region completion. For three core scenarios, the system further integrates semantic occlusion reconstruction, layout-preserving instruction editing, and frequency-domain texture refinement, employing progressive multi-task curriculum learning and task routing strategies for single-model multi-task joint optimization.

This project is developed by the JoyFox organization, with the corresponding model weights and research-oriented release package maintained alongside the codebase.

Project Hugging Face model repository:

📄 Paper

Key Modules Introduced in the Paper

  • TADA (Task-Aware Decoupled Adapter) separates structure restoration from texture/semantic editing through task-aware gating, branch-separated injection, and a weak orthogonality constraint.
  • FGLC (Flow-Guided Latent Consistency) combines optical-flow alignment with cross-frame attention bias in latent space to reduce flicker and improve motion-region stability.
  • PMTR (Progressive Multi-Task Routing) uses curriculum-based task scheduling and collaborative routing to stabilize joint multi-task training and improve generalization.

How This Repository Maps to the Paper

  • The paper studies three high-level settings: video super-resolution/enhancement, occlusion removal and repair, and semantic editing.
  • This repository currently exposes four practical inference routes: video restoration, video HD enhancement, watermark removal, and subtitle removal.
  • In that mapping, watermark removal and subtitle removal are concrete forms of the paper's occlusion-removal setting, while broader instruction-driven semantic editing is still under training.

✨ Technical Highlights

  • Task-aware IC-Edit framework: Each restoration direction uses dedicated instruction conditioning and task-specific IC-LoRA adapters, so the model learns both visual enhancement and task intent.
  • LTX-2.3 DiT backbone adaptation: The LTX-2.3 diffusion-transformer video backbone is adapted for latent-space editability, instruction following, temporal stability, and high-frequency detail recovery.
  • Spatiotemporal consistency optimization: Cross-frame constraints reduce flicker, unstable background reconstruction, subtitle ghosting, color shift, and motion-time detail popping.
  • Degradation-aware training curriculum: Training covers compression artifacts, motion blur, noise, low bitrate, text overlays, watermarks, logos, local occlusions, and low-resolution inputs for stronger real-world generalization.
  • Occlusion-aware reconstruction: For watermark and subtitle removal, the model reconstructs plausible background structure, boundaries, lighting, and texture continuity behind the removed region instead of simply smearing it.
  • Frequency-enhanced HD restoration: The HD enhancement branch focuses on perceptual sharpness and fine-detail recovery for hair, fabric, skin, product edges, background textures, and typography-like structures.

🎬 Demo

Video Restoration Video HD Enhancement
Watermark Removal Subtitle Removal

📖 Table of Contents

  1. 🛣️ Project Status
  2. 📄 Paper
  3. 💼 Environment Setup
  4. 🗂️ Project Structure
  5. 🧠 Model File Layout
  6. 🎨 ComfyUI Workflow Files
  7. 🚀 Quick Start
  8. 🧩 Pipeline Architecture
  9. 🔧 Key Technical Fixes
  10. ⚙️ Parameters
  11. 📐 Resolution & Frame Count Constraints
  12. 🎯 Use Cases
  13. 💾 VRAM Optimization
  14. 📚 Citation

🛣️ Project Status

  • ✅ Insight single-entry inference script (run_pipeline.py), workflow reference files, and parameter documentation
  • ✅ Video restoration
  • ✅ Video HD enhancement
  • ✅ Watermark removal
  • ✅ Subtitle removal
  • ⬜ General video editing (in training)

💼 Environment Setup

🧾 System Requirements

Item Requirement
GPU NVIDIA RTX 4090 (24GB) or equivalent Ada Lovelace / Hopper architecture
CUDA 12.4+
Python 3.10+
ffmpeg System-level install (not pip)

1. Create conda environment

conda create -n LTX2-icedit python=3.12 -y
conda activate LTX2-icedit

2. Install PyTorch (matching your CUDA version)

# CUDA 12.8 (recommended for RTX 4090)
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128

# CUDA 12.4
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu124

3. Install dependencies

pip install -r requirements.txt

4. Install ffmpeg (system-level)

# Ubuntu / Debian
sudo apt install ffmpeg

# conda (not recommended — may conflict with system libav)
# conda install -c conda-forge ffmpeg

🗂️ Project Structure

LTX2-ICEdit-Insight/
├── run_pipeline.py               # Insight inference entry point
├── run_restoration.sh            # Video restoration script
├── run_hd.sh                     # Video HD enhancement script
├── run_watermark_rm.sh           # Watermark removal script
├── run_subtitle_rm.sh            # Subtitle removal script
├── preprocess_video.py           # Video preprocessing (ffmpeg scale to 480p)
├── workflows/
│   ├── LTX-2.3-ICLORA编辑-官方模型版本.json
│   └── LTX-2.3-IC编辑-comfyui模型版本.json
├── models/
│   ├── checkpoints/              # Insight all-in-one checkpoint
│   ├── latent_upscale_models/    # Spatial upsampler model
│   ├── gemma_configs/            # Gemma (HuggingFace format)
│   └── loras/                    # IC-LoRA (task-specific)
├── ltx_vendor/                   # Vendored SDK (ltx_core + ltx_pipelines)
├── tests/
├── inputs/
└── outputs/

ltx_vendor/ embeds the SDK directly. Scripts load it via sys.path.insert(0, "ltx_vendor") — no external LTX-2/ directory needed.


🧠 Model File Layout

Project Hugging Face model repository:

Insight version (run_pipeline.py)

Component Default Path (relative to repo root)
Insight Checkpoint (insight transformer + video/audio VAE + text projection + vocoder) models/checkpoints/ltx-2.3-edit-insight-dev-fp8.safetensors
Upsampler models/latent_upscale_models/ltx-2.3-spatial-upscaler-x2-1.1.safetensors
Gemma models/gemma_configs/
Video restoration IC-LoRA models/loras/ltx2.3-train/ltx2.3-video-restoration-general.safetensors
Video HD enhancement IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-video-upscale-general.safetensors
Watermark removal IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-watermark-remove-general.safetensors
Subtitle removal IC-LoRA models/loras/ltx2.3-train/ltx2.3-ic-subtitles-remove-general.safetensors

Compatibility note: The IC-LoRA weights in this project are not limited to the Insight all-in-one checkpoint. They can also be loaded directly onto the native LTX-2.3 model in ComfyUI. See the workflows/ folder for ready-to-use workflow references.


🎨 ComfyUI Workflow Files

This project ships two ComfyUI reference workflows:

Workflow File Task Description
workflows/LTX-2.3-ICLORA编辑-官方模型版本.json Official native model + IC-LoRA Covers restoration, HD enhancement, watermark removal, subtitle removal
workflows/LTX-2.3-IC编辑-comfyui模型版本.json ComfyUI split-model format Reference workflow using separated model files

All IC-LoRA weights in this project are compatible with the native LTX-2.3 model in ComfyUI. The Insight all-in-one checkpoint is not required.

How to import:

  1. Open ComfyUI
  2. Select Load/Import Workflow
  3. Import the corresponding JSON file
  4. Download any missing models and input video, then run

🚀 Quick Start

All scripts should be run from the repository root.

1. Preprocess input video (optional)

python preprocess_video.py ./inputs/your_video.mp4 ./inputs/input_480p.mp4

2. One-click Insight scripts

bash run_restoration.sh                        # Video restoration
bash run_hd.sh                                 # Video HD enhancement
bash run_hd.sh /path/to/input.mp4             # Video HD enhancement (custom input)
bash run_watermark_rm.sh                       # Watermark removal
bash run_watermark_rm.sh /path/to/input.mp4   # Watermark removal (custom input)
bash run_subtitle_rm.sh                        # Subtitle removal
bash run_subtitle_rm.sh /path/to/input.mp4    # Subtitle removal (custom input)

3. Manual command examples (run_pipeline.py)

Video restoration mode:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode restoration \
  --video ./inputs/input_480p.mp4 \
  --prompt "Convert the video to ultra-high definition quality, rebuilding high-frequency details while eliminating artifacts." \
  --output ./outputs/output_restoration.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

Video HD enhancement mode:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode hd \
  --video ./inputs/input_480p.mp4 \
  --prompt "Convert the video to ultra-high definition quality, greatly improving clarity and detail richness." \
  --output ./outputs/output_hd.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

Watermark removal mode:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode watermark_rm \
  --video ./inputs/input_480p.mp4 \
  --prompt "Remove short-video platform watermarks and related occlusions from the video, restoring a clean, clear, and natural original image." \
  --output ./outputs/output_watermark_rm.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 1546 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

Subtitle removal mode:

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
python run_pipeline.py \
  --mode subtitle_rm \
  --video ./inputs/input_480p.mp4 \
  --prompt "Remove subtitles and text overlays from the video, restoring a clean and natural original image." \
  --output ./outputs/output_subtitle_rm.mp4 \
  --height 1184 --width 704 --num-frames 97 \
  --fps 24.0 --seed 42 \
  --sigma-profile workflow \
  --streaming-prefetch-count 2

🧩 Pipeline Architecture

Default single-stage inference (single_stage=True)

Input Video
    │
    ▼
[Video VAE Encoder]
    │ reference latent (encode reference frame)
    ▼
[VideoConditionByReferenceLatent]   ← IC-LoRA guidance: reference latent
    │ conditionings                    concatenated temporally to denoising sequence
    ▼
[Transformer DiffusionStage]        ← fused LoRA weights, full resolution, single pass
    │ sigma: [1.0 → 0.9375 → 0.8125 → 0.5625 → 0.25 → 0.0]
    ▼
[Video VAE Decoder]
    │
    ▼
Output MP4

Two-stage inference (--two-stage)

Input Video
    │
    ▼
[Video VAE Encoder @ 1/2 resolution]
    │ reference latent (encode reference frame)
    ▼
[VideoConditionByReferenceLatent]          ← IC-LoRA guidance (Stage 1 only)
    │ conditionings
    ▼
[Transformer DiffusionStage - Stage 1]
    │ sigma(stage1): [1.0 → 0.9375 → 0.8125 → 0.5625 → 0.25 → 0.0]
    ▼
[VideoUpsampler (latent space ×2)]
    │ upscaled_latent
    ▼
[Transformer DiffusionStage - Stage 2]
    │ full-resolution refinement (no IC-LoRA, initial_latent=upscaled_latent)
    │ sigma(stage2): [0.85 → 0.7250 → 0.4219 → 0.0]
    ▼
[Video VAE Decoder]
    │
    ▼
Output MP4

ComfyUI node to run_pipeline.py mapping

ComfyUI Node run_pipeline.py Implementation
LTXLoadVideoModel / CheckpointLoaderSimple FixedBuilder (builds transformer / VAE / text encoder, handles fp8_input_scaled dequantization)
LTXICLoRALoaderModelOnly resolve_mode_settings + LoraPathStrengthAndSDOps (default strength=1.0, overridable via --lora / --lora-strength)
LTXAddVideoICLoRAGuide VideoConditionByReferenceLatent (injected via image_conditioner + create_ic_lora_conditionings)
SamplerCustomAdvanced / LTXVSampler stage_1: DiffusionStage + resolve_sigma_schedule(profile)[0]
LatentUpscaleModel VideoUpsampler (--two-stage only)
Second-pass Sampler (refinement) stage_2: DiffusionStage + resolve_sigma_schedule(profile)[1] (no IC-LoRA, initial_latent=upscaled_latent)
LTXDecodeVideo / VAEDecode VideoDecoder

🔧 Key Technical Fixes

  1. FP8 weight dequantization fixes LoRA direction issue Before apply_loras, dequantize fp8_input_scaled weights to bf16 to avoid incorrect LoRA delta fusion direction.

  2. Default single-stage full-resolution to prevent face-swap / content drift in Stage 2 Consistent with the workflow, defaults to single_stage=True.

  3. All-in-one checkpoint and Gemma HF key compatibility VAE / Audio VAE / Vocoder reuse SDK built-in key filters; Gemma uses GEMMA_HF_TEXT_ONLY_KEY_OPS for HF key alignment.


⚙️ Parameters

General parameters (run_pipeline.py)

Parameter Default Description
--mode restoration restoration / hd / watermark_rm / subtitle_rm
--lora determined by mode Override default IC-LoRA path
--lora-strength 1.0 IC-LoRA strength
--video required Input video path
--prompt required Text prompt
--output required Output path
--height 1184 Output height
--width 704 Output width
--num-frames 97 Frame count, must satisfy 8k+1
--fps 24.0 Frame rate
--seed 42 Random seed
--two-stage off Enable two-stage inference
--streaming-prefetch-count 2 Layer streaming prefetch count
--no-streaming off Disable layer streaming
--sigma-profile workflow workflow / distilled
--disable-white-mask off Disable all-white conditioning mask
--model-checkpoint models/checkpoints/ltx-2.3-edit-insight-dev-fp8.safetensors Override Insight checkpoint path
--model-upsampler models/latent_upscale_models/ltx-2.3-spatial-upscaler-x2-1.1.safetensors Override upsampler path
--model-gemma-root models/gemma_configs/ Override Gemma root directory

📐 Resolution & Frame Count Constraints

  • Single-stage (default): height / width must be multiples of 32
  • Two-stage (--two-stage): height / width must be multiples of 64
  • Frame count must satisfy: frames = 8k + 1 (e.g. 25 / 97 / 217)

Common output resolutions (input 270×480):

Target Actual (32-aligned)
720×1280 704×1184
360×640 352×640
480p aligned 512×288

🎯 Use Cases

  • Short-video watermark removal and post-processing
  • Advertising material restoration and quality enhancement
  • Old video restoration and upscaling
  • Clarity improvement and texture recovery for low-quality footage
  • AIGC video post-correction (flickering, detail, stability)

💾 VRAM Optimization

Estimated peak VRAM on RTX 4090 24GB (with other processes running):

Configuration Estimated Peak VRAM Notes
704×1184 × 217 frames ~20GB+ Recommend closing ComfyUI and other GPU processes
704×1184 × 97 frames ~17GB Common length
704×1184 × 25 frames ~14GB Quick testing
512×288 × 217 frames ~8GB Low-resolution full duration

Optimization tips:

  1. Use --streaming-prefetch-count 2 (enabled by default)
  2. Set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
  3. Close other GPU-intensive processes

📚 Citation

If this repository or the released model weights are useful in your research or production workflow, please cite:

@article{tang2026ltxinsight,
  title   = {LTX-Insight: Unified Video Restoration and Semantic Editing via Task-Aware Adaptation and Temporal Consistency},
  author  = {Tang, Fan and Li, Siyuan},
  journal = {Research Square},
  year    = {2026},
  month   = {05},
  doi     = {10.21203/rs.3.rs-9775063/v1},
  url     = {https://www.researchsquare.com/article/rs-9775063/v1}
}
排名相邻
同类项目

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载