Wensong Song
·
Hong Jiang
·
Zongxing Yang
·
Ruijie Quan
·
Yi Yang
Zhejiang University | Harvard University | Nanyang Technological University
- [Soon] Release train code.
- [Soon] Release AnyInsertion text-prompt dataset on HuggingFace.
- [2025.5.7] Release inference for nunchaku demo to support 10GB VRAM.
- [2025.5.6] Support ComfyUI integration for easier workflow management.
- [2025.5.6] Update inference demo to support 26GB VRAM, with increased inference time.
- [2025.4.26] Support online demo on HuggingFace.
- [2025.4.25] Release AnyInsertion mask-prompt dataset on HuggingFace.
- [2025.4.22] Release inference demo and pretrained checkpoint.
Begin by cloning the repository:
git clone https://github.com/song-wensong/insert-anything
cd insert-anythingConda's installation instructions are available here.
conda create -n insertanything python==3.10
conda activate insertanything
pip install -r requirements.txt10 VRAM :
-
Insert Anything Model: Download the main checkpoint from HuggingFace and replace
/path/to/lora-for-nunchakuin inference_for_nunchaku.py. -
FLUX.1-Fill-dev Model: This project relies on FLUX.1-Fill-dev and FLUX.1-Redux-dev as components. Download its checkpoint(s) as well and replace
/path/to/black-forest-labs-FLUX.1-Fill-devand/path/to/black-forest-labs-FLUX.1-Redux-dev. -
Nunchaku-FLUX.1-Fill-dev Model: Download the main checkpoint from HuggingFace and replace
/path/to/svdq-int4-flux.1-fill-dev.
26 or 40 VRAM :
-
Insert Anything Model: Download the main checkpoint from HuggingFace and replace
/path/to/lorain inference.py and app.py. -
FLUX.1-Fill-dev Model: This project relies on FLUX.1-Fill-dev and FLUX.1-Redux-dev as components. Download its checkpoint(s) as well and replace
/path/to/black-forest-labs-FLUX.1-Fill-devand/path/to/black-forest-labs-FLUX.1-Redux-dev.
We are very grateful to @judian17 for providing the nunchaku version of LoRA.After downloading the required weights, you need to go to the official nunchaku repository to install the appropriate version of nunchaku.
python inference_for_nunchaku.pypython inference.pypython app.pyClone the official ComfyUI repository and follow the installation instructions.
Move the ComfyUI_InsertAnything/Node_InsertAnything folder into your local ComfyUI's custom_nodes/ directory
Move the ComfyUI_InsertAnything/InsertAnything.json file into your local ComfyUI's user/default/workflows directory
Use the Mask Option component to choose between two mask types:
- Sketch: Draw a mask directly in the ComfyUI interface.
- Upload: Upload an external image file as a mask.
We also provide a Nunchaku version of ComfyUI. You just need to follow the instructions above and replace the file names with those of the Nunchaku version (ComfyUI_Nunchaku_InsertAnything) .
🔷 To run mask-prompt examples, you may need to obtain the corresponding masks. You can choose to use Grounded SAM or the draw_mask script provided by us
python draw_mask.py 🔷 The mask must fully cover the area to be edited.
- AnyInsertion dataset: Download the AnyInsertion dataset from HuggingFace.
We appreciate the open source of the following projects:
@article{song2025insert,
title={Insert Anything: Image Insertion via In-Context Editing in DiT},
author={Song, Wensong and Jiang, Hong and Yang, Zongxing and Quan, Ruijie and Yang, Yi},
journal={arXiv preprint arXiv:2504.15009},
year={2025}
}