[ICLR'26] IC-Custom: Diverse Image Customization via In-Context Learning
163
stars
19
commits
Python
primary language
Sep 15, 2025
updated
IC-Custom is designed for diverse image customization scenarios, including:
Position-aware: Input a reference image, target background, and specify the customization location (via segmentation or drawing)
Position-free: Input a reference image and a target description to generate a new image with the reference image's ID
Community Support
ComfyUI: ComfyUI_RH_ICCustom
RunningHub:
Demonstration video:
Acknowledgements: ComfyUI deployment support by HM-RunningHub; RunningHub workflows by T8star-Aix.
IC-Custom has been implemented and tested on:
Clone the repository
git clone https://github.com/TencentARC/IC-Custom.git
cd IC-Custom
Set up Python environment
conda create -n ic-custom python=3.10 -y
conda activate ic-custom
pip install -e .
pip install -r requirements.txt
Custom CUDA versions (optional)
If you require a different CUDA version, you can ignore the torch-related packages listed in requirements.txt. Instead, please install PyTorch and xformers that are compatible with your CUDA version by following the instructions on the official PyTorch website.
Example for CUDA 12.4:
pip3 install xformers torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu124
Flash Attention 2 (optional) If your device supports Flash Attention 2, you can optionally install flash-attn. We use flash-attn==2.7.3. Find compatible versions at flash-attention releases.
You'll need to obtain the model checkpoints before running the inference or app.
HF_TOKEN).sh scripts/inference/download_models.sh $HF_TOKEN
Expected directory structure (example):
|-- models
|-- clip-vit-large-patch14
|-- ic-custom
| |-- dit_boundary_embeddings_0x1561.safetensors
| |-- dit_lora_0x1561.safetensors
| |-- dit_task_register_embeddings_0x1561.safetensors
| |-- dit_txt_img_in_0x1561.safetensors
| ...
|-- siglip-so400m-patch14-384
|-- t5-v1_1-xxl
|-- ae.safetensors
|-- flux1-fill-dev.safetensors
|-- flux1-redux-dev.safetensors
After manual download, edit the YAMLs in configs/** (e.g., inference.yaml) to point to your local model paths.
MODEL_CARD.md.When running the app, all required models are automatically downloaded. Optional models are fetched only when explicitly enabled.
sh src/app/run_app.sh $HF_TOKEN $HF_CACHE_DIR
For required vs optional models and configuration, see APP.md.
Run the inference script with your Hugging Face token:
sh scripts/inference/inference.sh $HF_TOKEN $HF_CACHE_DIR
Parameters:
$HF_TOKEN: Your Hugging Face access token (required for automatic model download, optional if model paths are specified in configs/**/*.yaml)$HF_CACHE_DIR (optional): Custom cache directory for downloaded models (default: "~/.cache/huggingface/hub")@article{li2025ic,
title={IC-Custom: Diverse Image Customization via In-Context Learning},
author={Li, Yaowei and Li, Xiaoyu and Zhang, Zhaoyang and Bian, Yuxuan and Liu, Gan and Li, Xinyuan and Xu, Jiale and Hu, Wenbo and Liu, Yating and Li, Lingen and others},
journal={arXiv preprint arXiv:2507.01926},
year={2025}
}
We gratefully acknowledge the use of code from:
We also thank Hugging Face for providing professional model hosting and Spaces for deployment.
Current limitations are mainly inference speed and the need for more flexible instruction following. We plan to improve these aspects in future updates. If you have any feedback, please feel free to contact us.
We are pleased to support the open source community. For complete license details, see LICENSE and NOTICE.
For any questions, feel free to email.
18 commits
1 commits
Python
99.4%
[ICLR'26] IC-Custom: Diverse Image Customization via In-Context Learning
163
stars
19
commits
Python
primary language
Sep 15, 2025
updated
IC-Custom is designed for diverse image customization scenarios, including:
Position-aware: Input a reference image, target background, and specify the customization location (via segmentation or drawing)
Position-free: Input a reference image and a target description to generate a new image with the reference image's ID
Community Support
ComfyUI: ComfyUI_RH_ICCustom
RunningHub:
Demonstration video:
Acknowledgements: ComfyUI deployment support by HM-RunningHub; RunningHub workflows by T8star-Aix.
IC-Custom has been implemented and tested on:
Clone the repository
git clone https://github.com/TencentARC/IC-Custom.git
cd IC-Custom
Set up Python environment
conda create -n ic-custom python=3.10 -y
conda activate ic-custom
pip install -e .
pip install -r requirements.txt
Custom CUDA versions (optional)
If you require a different CUDA version, you can ignore the torch-related packages listed in requirements.txt. Instead, please install PyTorch and xformers that are compatible with your CUDA version by following the instructions on the official PyTorch website.
Example for CUDA 12.4:
pip3 install xformers torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu124
Flash Attention 2 (optional) If your device supports Flash Attention 2, you can optionally install flash-attn. We use flash-attn==2.7.3. Find compatible versions at flash-attention releases.
You'll need to obtain the model checkpoints before running the inference or app.
HF_TOKEN).sh scripts/inference/download_models.sh $HF_TOKEN
Expected directory structure (example):
|-- models
|-- clip-vit-large-patch14
|-- ic-custom
| |-- dit_boundary_embeddings_0x1561.safetensors
| |-- dit_lora_0x1561.safetensors
| |-- dit_task_register_embeddings_0x1561.safetensors
| |-- dit_txt_img_in_0x1561.safetensors
| ...
|-- siglip-so400m-patch14-384
|-- t5-v1_1-xxl
|-- ae.safetensors
|-- flux1-fill-dev.safetensors
|-- flux1-redux-dev.safetensors
After manual download, edit the YAMLs in configs/** (e.g., inference.yaml) to point to your local model paths.
MODEL_CARD.md.When running the app, all required models are automatically downloaded. Optional models are fetched only when explicitly enabled.
sh src/app/run_app.sh $HF_TOKEN $HF_CACHE_DIR
For required vs optional models and configuration, see APP.md.
Run the inference script with your Hugging Face token:
sh scripts/inference/inference.sh $HF_TOKEN $HF_CACHE_DIR
Parameters:
$HF_TOKEN: Your Hugging Face access token (required for automatic model download, optional if model paths are specified in configs/**/*.yaml)$HF_CACHE_DIR (optional): Custom cache directory for downloaded models (default: "~/.cache/huggingface/hub")@article{li2025ic,
title={IC-Custom: Diverse Image Customization via In-Context Learning},
author={Li, Yaowei and Li, Xiaoyu and Zhang, Zhaoyang and Bian, Yuxuan and Liu, Gan and Li, Xinyuan and Xu, Jiale and Hu, Wenbo and Liu, Yating and Li, Lingen and others},
journal={arXiv preprint arXiv:2507.01926},
year={2025}
}
We gratefully acknowledge the use of code from:
We also thank Hugging Face for providing professional model hosting and Spaces for deployment.
Current limitations are mainly inference speed and the need for more flexible instruction following. We plan to improve these aspects in future updates. If you have any feedback, please feel free to contact us.
We are pleased to support the open source community. For complete license details, see LICENSE and NOTICE.
For any questions, feel free to email.
18 commits
1 commits
Python
99.4%