ComfyUI_KV_Edit

ComfyUI_KV_Edit
★ 61

图像编辑背景保留无训练方法ComfyUI节点
在ComfyUI中提供的KV-Edit节点,实现在无需训练的前提下对图像进行精细编辑,精确保留与一致性背景信息。
💡 在ComfyUI中对图像进行精确背景保留的无训练编辑
🍴 3 Forks💻 Python🔄 2025-09-30
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/c1eafc754fbb
📦 requirements.txt
torch
einops
#fire
#gradio==5.17.1
#huggingface-hub
#invisible-watermark
#matplotlib
numpy
opencv-python
Pillow
Requests
safetensors
scikit-learn
scipy
scikit-image
torchvision
tqdm
#transformers==4.49.0
sentencepiece
📄 README

ComfyUI_KV_Edit

KV_Edit: Training-Free Image Editing for Precise Background Preservation,you can use it in comfyUI

update

  • use single dit like kj or other /修改模型加载占用及去掉重复量化,加入加速lora支持
  • 1. Installation

    In the ./ComfyUI/custom_node directory, run the following:

    git clone https://github.com/smthemex/ComfyUI_KV_Edit

    2. Requirements

    pip install -r requirements.txt

    3.Model

  • 3.1.1 download ‘ae.safetensor’ and ‘flux1-dev.safetensors’ from here 下载ae和flux单体模型模型,文件结构如下图
  • 3.1.2 download ‘clip_l.safetensors’ and ‘t5xxl_fp8_e4m3fn.safetensors’ from here下载T5和clip l单体模型模型,文件结构如下图
  • --   ComfyUI/models/diffusion_models  # or unet
        ├── flux1-dev.safetensors #23.8G 全量
        ├── flux1-kj-dev-fp8.safetensors #11G 名字中有fp8自动开启量化,注意不支持comfy量化的版本
    --   ComfyUI/models/clip
        ├── clip_l.safetensors
        ├── t5xxl_fp8_e4m3fn.safetensorsvae
    --   ComfyUI/models/vae
        ├── ae.safetensor

    Example

  • new
  • use comfy T5 and clip and flux dev single checkpoints用comfy的text encoder和flux的fp16/fp8模型,推荐
  • use comfy or flux dev single checkpoints 仅使用单体模型,速度更慢,更占内存,主要是量化两次模型
  • Citation

    If you find our work helpful, please star 🌟 this repo and cite 📑 our paper. Thanks for your support!

    @article{zhu2025kv,
      title={KV-Edit: Training-Free Image Editing for Precise Background Preservation},
      author={Zhu, Tianrui and Zhang, Shiyi and Shao, Jiawei and Tang, Yansong},
      journal={arXiv preprint arXiv:2502.17363},
      year={2025}
    }

    👍🏻 Acknowledgements

    Our code is modified based on FLUX and RF-Solver-Edit. Special thanks to Wenke Huang for his early inspiration and helpful guidance to this project!

    📧 Contact

    This repository is currently under active development and restructuring. The codebase is being optimized for better stability and reproducibility. While we strive to maintain code quality, you may encounter temporary issues during this transition period. For any questions or technical discussions, feel free to open an issue or contact us via email at xilluill070513@gmail.com.