Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

InstantID

> 编程语言
Open source

InstantID: Zero-shot Identity-Preserving Generation in Seconds

12.0K stars0 likes1 views
WebsiteGitHub

About

InstantID: Zero-shot Identity-Preserving Generation in Seconds

InstantID is a new state-of-the-art tuning-free method to achieve ID-Preserving generation with only single image, supporting various downstream tasks.

Release

  • [2024/07/18] We are training InstantID for Kolors. The weight requires significant computational power, which is currently in the process of iteration. After the model training is completed, it will be open-sourced. The latest checkpoint results are referenced in Kolors Version.
  • [2024/04/03] We release our recent work InstantStyle for style transfer, compatible with InstantID!
  • [2024/02/01] We have supported LCM acceleration and Multi-ControlNets on our Huggingface Spaces Demo! Our depth estimator is supported by Depth-Anything.
  • [2024/01/31] OneDiff now supports accelerated inference for InstantID, check this for details!
  • [2024/01/23] Our pipeline has been merged into diffusers!
  • [2024/01/22] We release the pre-trained checkpoints, inference code and gradio demo!
  • [2024/01/15] We release the technical report.
  • [2023/12/11] We launch the project page.

Demos

Stylized Synthesis

Comparison with Previous Works

Comparison with existing tuning-free state-of-the-art techniques. InstantID achieves better fidelity and retain good text editability (faces and styles blend better).

Comparison with pre-trained character LoRAs. We don't need multiple images and still can achieve competitive results as LoRAs without any training.

Comparison with InsightFace Swapper (also known as ROOP or Refactor). However, in non-realistic style, our work is more flexible on the integration of face and background.

Kolors Version

We have adapted InstantID for Kolors. Leveraging Kolors' robust text generation capabilities , InstantID can be integrated with Kolors to simultaneously generate ID and text.

demo demo demo

Download

You can directly download the model from Huggingface. You also can download the model in python script:

python
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="InstantX/InstantID", filename="ControlNetModel/config.json", local_dir="./checkpoints")
hf_hub_download(repo_id="InstantX/InstantID", filename="ControlNetModel/diffusion_pytorch_model.safetensors", local_dir="./checkpoints")
hf_hub_download(repo_id="InstantX/InstantID", filename="ip-adapter.bin", local_dir="./checkpoints")

Or run the following command to download all models:

python
pip install -r gradio_demo/requirements.txt
python gradio_demo/download_models.py

If you cannot access to Huggingface, you can use hf-mirror to download models.

python
export HF_ENDPOINT=https://hf-mirror.com
huggingface-cli download --resume-download InstantX/InstantID --local-dir checkpoints --local-dir-use-symlinks False

For face encoder, you need to manually download via this URL to models/antelopev2 as the default link is invalid. Once you have prepared all models, the folder tree should be like:

  .
  ├── models
  ├── checkpoints
  ├── ip_adapter
  ├── pipeline_stable_diffusion_xl_instantid.py
  └── README.md

Usage

If you want to reproduce results in the paper, please refer to the code in infer_full.py. If you want to compare the results with other methods, even without using depth-controlnet, it is recommended that you use this code.

If you are pursuing better results, it is recommended to follow InstantID-Rome.

The following code comes from infer.py. If you want to quickly experience InstantID, please refer to the code in infer.py.

…

Then, you can customized your own face images

…

To save VRAM, you can enable CPU offloading

python
pipe.enable_model_cpu_offload()
pipe.enable_vae_tiling()

Speed Up with LCM-LoRA

Our work is compatible with LCM-LoRA. First, download the model.

python
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="latent-consistency/lcm-lora-sdxl", filename="pytorch_lora_weights.safetensors", local_dir="./checkpoints")

To use it, you just need to load it and infer with a small num_inference_steps. Note that it is recommendated to set guidance_scale between [0, 1].

python
from diffusers import LCMScheduler

lcm_lora_path = "./checkpoints/pytorch_lora_weights.safetensors"

pipe.load_lora_weights(lcm_lora_path)
pipe.fuse_lora()
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)

num_inference_steps = 10
guidance_scale = 0

Start a local gradio demo

Run the following command:

python
python gradio_demo/app.py

or MultiControlNet version:

python
gradio_demo/app-multicontrolnet.py 

Usage Tips

  • For higher similarity, increase the weight of controlnet_conditioning_scale (IdentityNet) and ip_adapter_scale (Adapter).
  • For over-saturation, decrease the ip_adapter_scale. If not work, decrease controlnet_conditioning_scale.
  • For higher text control ability, decrease ip_adapter_scale.
  • For specific styles, choose corresponding base model makes differences.
  • We have not supported multi-person yet, only use the largest face as reference facial landmarks.
  • We provide a style template for reference.

Community Resources

Replicate Demo

  • zsxkib/instant-id

WebUI

  • Mikubill/sd-webui-controlnet

ComfyUI

  • cubiq/ComfyUI_InstantID
  • ZHO-ZHO-ZHO/ComfyUI-InstantID
  • huxiuhan/ComfyUI-InstantID

Windows

  • sdbds/InstantID-for-windows

Acknowledgements

  • InstantID is developed by InstantX Team, all copyright reserved.
  • Our work is highly inspired by IP-Adapter and ControlNet. Thanks for their great works!
  • Thanks Yamer for developing YamerMIX, we use it as base model in our demo.
  • Thanks ZHO-ZHO-ZHO, huxiuhan, sdbds, zsxkib for their generous contributions.
  • Thanks to the HuggingFace gradio team for their free GPU support!
  • Thanks to the ModelScope team for their free GPU support!
  • Thanks to the OpenXLab team for their free GPU support!
  • Thanks to SiliconFlow for their OneDiff integration of InstantID!

Disclaimer

The code of InstantID is released under Apache License for both academic and commercial usage. However, both manual-downloading and auto-downloading face models from insightface are for non-commercial research purposes only according to their license. Our released checkpoints are also for research purposes only. Users are granted the freedom to create images using this tool, but they are obligated to comply with local laws and utilize it responsibly. The developers will not assume any responsibility for potential misuse by users.

Star History

Sponsor Us

If you find this project useful, you can buy us a coffee via Github Sponsor! We support Paypal and WeChat Pay.

Cite

If you find InstantID useful for your research and applications, please cite us using this BibTeX:

bibtex
@article{wang2024instantid,
  title={InstantID: Zero-shot Identity-Preserving Generation in Seconds},
  author={Wang, Qixun and Bai, Xu and Wang, Haofan and Qin, Zekui and Chen, Anthony},
  journal={arXiv preprint arXiv:2401.07519},
  year={2024}
}

For any question, please feel free to contact us via [email protected] or [email protected].

Issues· 187 open

View all issuesOpen on GitHub
  • #306

    Aahu

    Updated Sep 13, 2026
  • #81

    How to Use Multi-ID

    Updated Sep 6, 2026
  • #305

    Home services

    Updated Jun 7, 2026
  • #304

    cancer treatment crispr

    Updated May 24, 2026
  • #303

    James Shackelford

    Updated May 23, 2026
  • #302

    hybrid craft

    Updated May 22, 2026
  • #301

    water treatment methods

    Updated May 16, 2026
  • #300

    James Shackelford from Durham NC

    Updated Mar 14, 2026
  • #298

    Neuromorphic computing integration

    Updated Jan 25, 2026
  • #297

    Z-image Compatibility

    Updated Dec 26, 2025

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言