[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70964":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},70964,"InstantID","instantX-research\u002FInstantID","instantX-research","InstantID: Zero-shot Identity-Preserving Generation in Seconds 🔥","https:\u002F\u002Finstantid.github.io\u002F",null,"Python",11956,884,125,178,0,3,14,9,43.84,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:02:45","\u003Cdiv align=\"center\">\n\u003Ch1>InstantID: Zero-shot Identity-Preserving Generation in Seconds\u003C\u002Fh1>\n\n[**Qixun Wang**](https:\u002F\u002Fgithub.com\u002Fwangqixun)\u003Csup>12\u003C\u002Fsup> · [**Xu Bai**](https:\u002F\u002Fhuggingface.co\u002Fbaymin0220)\u003Csup>12\u003C\u002Fsup> · [**Haofan Wang**](https:\u002F\u002Fhaofanwang.github.io\u002F)\u003Csup>12*\u003C\u002Fsup> · [**Zekui Qin**](https:\u002F\u002Fgithub.com\u002FZekuiQin)\u003Csup>12\u003C\u002Fsup> · [**Anthony Chen**](https:\u002F\u002Fantonioo-c.github.io\u002F)\u003Csup>123\u003C\u002Fsup>\n\nHuaxia Li\u003Csup>2\u003C\u002Fsup> · Xu Tang\u003Csup>2\u003C\u002Fsup> · Yao Hu\u003Csup>2\u003C\u002Fsup>\n\n\u003Csup>1\u003C\u002Fsup>InstantX Team · \u003Csup>2\u003C\u002Fsup>Xiaohongshu Inc · \u003Csup>3\u003C\u002Fsup>Peking University\n\n\u003Csup>*\u003C\u002Fsup>corresponding authors\n\n\u003Ca href='https:\u002F\u002Finstantid.github.io\u002F'>\u003Cimg src='https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FProject-Page-green'>\u003C\u002Fa>\n\u003Ca href='https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.07519'>\u003Cimg src='https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTechnique-Report-red'>\u003C\u002Fa>\n\u003Ca href='https:\u002F\u002Fhuggingface.co\u002Fpapers\u002F2401.07519'>\u003Cimg src='https:\u002F\u002Fimg.shields.io\u002Fstatic\u002Fv1?label=Paper&message=Huggingface&color=orange'>\u003C\u002Fa> \n[![GitHub](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002FInstantID\u002FInstantID?style=social)](https:\u002F\u002Fgithub.com\u002FInstantID\u002FInstantID)\n\n\u003Ca href='https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FInstantX\u002FInstantID'>\u003Cimg src='https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Hugging%20Face-Spaces-blue'>\u003C\u002Fa>\n[![ModelScope](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FModelScope-Studios-blue)](https:\u002F\u002Fmodelscope.cn\u002Fstudios\u002Finstantx\u002FInstantID\u002Fsummary)\n[![Open in OpenXLab](https:\u002F\u002Fcdn-static.openxlab.org.cn\u002Fapp-center\u002Fopenxlab_app.svg)](https:\u002F\u002Fopenxlab.org.cn\u002Fapps\u002Fdetail\u002FInstantX\u002FInstantID)\n\n\u003C\u002Fdiv>\n\nInstantID is a new state-of-the-art tuning-free method to achieve ID-Preserving generation with only single image, supporting various downstream tasks.\n\n\u003Cimg src='assets\u002Fapplications.png'>\n\n## Release\n- [2024\u002F07\u002F18] 🔥 We are training InstantID for [Kolors](https:\u002F\u002Fhuggingface.co\u002FKwai-Kolors\u002FKolors-diffusers). 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](#kolors-version). \n- [2024\u002F04\u002F03] 🔥 We release our recent work [InstantStyle](https:\u002F\u002Fgithub.com\u002FInstantStyle\u002FInstantStyle) for style transfer, compatible with InstantID!\n- [2024\u002F02\u002F01] 🔥 We have supported LCM acceleration and Multi-ControlNets on our [Huggingface Spaces Demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FInstantX\u002FInstantID)! Our depth estimator is supported by [Depth-Anything](https:\u002F\u002Fgithub.com\u002FLiheYoung\u002FDepth-Anything).\n- [2024\u002F01\u002F31] 🔥 [OneDiff](https:\u002F\u002Fgithub.com\u002Fsiliconflow\u002Fonediff?tab=readme-ov-file#easy-to-use) now supports accelerated inference for InstantID, check [this](https:\u002F\u002Fgithub.com\u002Fsiliconflow\u002Fonediff\u002Fblob\u002Fmain\u002Fbenchmarks\u002Finstant_id.py) for details!\n- [2024\u002F01\u002F23] 🔥 Our pipeline has been merged into [diffusers](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdiffusers\u002Fblob\u002Fmain\u002Fexamples\u002Fcommunity\u002Fpipeline_stable_diffusion_xl_instantid.py)!\n- [2024\u002F01\u002F22] 🔥 We release the [pre-trained checkpoints](https:\u002F\u002Fhuggingface.co\u002FInstantX\u002FInstantID), [inference code](https:\u002F\u002Fgithub.com\u002FInstantID\u002FInstantID\u002Fblob\u002Fmain\u002Finfer.py) and [gradio demo](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FInstantX\u002FInstantID)!\n- [2024\u002F01\u002F15] 🔥 We release the [technical report](https:\u002F\u002Farxiv.org\u002Fabs\u002F2401.07519).\n- [2023\u002F12\u002F11] 🔥 We launch the [project page](https:\u002F\u002Finstantid.github.io\u002F).\n\n## Demos\n\n### Stylized Synthesis\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002FStylizedSynthesis.png\">\n\u003C\u002Fp>\n\n### Comparison with Previous Works\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fcompare-a.png\">\n\u003C\u002Fp>\n\nComparison with existing tuning-free state-of-the-art techniques. InstantID achieves better fidelity and retain good text editability (faces and styles blend better).\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fcompare-c.png\">\n\u003C\u002Fp>\n\nComparison with pre-trained character LoRAs. We don't need multiple images and still can achieve competitive results as LoRAs without any training.\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"assets\u002Fcompare-b.png\">\n\u003C\u002Fp>\n\nComparison 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.\n\n### Kolors Version\n\nWe have adapted InstantID for [Kolors](https:\u002F\u002Fhuggingface.co\u002FKwai-Kolors\u002FKolors-diffusers). Leveraging Kolors' robust text generation capabilities 👍👍👍, InstantID can be integrated with Kolors to simultaneously generate **ID** and **text**.\n\n\n| demo | demo | demo |\n|:-----:|:-----:|:-----:|\n\u003Cimg src=\".\u002Fassets\u002Fkolor\u002Fdemo_1.jpg\" >|\u003Cimg src=\".\u002Fassets\u002Fkolor\u002Fdemo_2.jpg\" >|\u003Cimg src=\".\u002Fassets\u002Fkolor\u002Fdemo_3.jpg\" >|\n\n\n\n## Download\n\nYou can directly download the model from [Huggingface](https:\u002F\u002Fhuggingface.co\u002FInstantX\u002FInstantID).\nYou also can download the model in python script:\n\n```python\nfrom huggingface_hub import hf_hub_download\nhf_hub_download(repo_id=\"InstantX\u002FInstantID\", filename=\"ControlNetModel\u002Fconfig.json\", local_dir=\".\u002Fcheckpoints\")\nhf_hub_download(repo_id=\"InstantX\u002FInstantID\", filename=\"ControlNetModel\u002Fdiffusion_pytorch_model.safetensors\", local_dir=\".\u002Fcheckpoints\")\nhf_hub_download(repo_id=\"InstantX\u002FInstantID\", filename=\"ip-adapter.bin\", local_dir=\".\u002Fcheckpoints\")\n```\n\nOr run the following command to download all models:\n\n```python\npip install -r gradio_demo\u002Frequirements.txt\npython gradio_demo\u002Fdownload_models.py\n```\n\nIf you cannot access to Huggingface, you can use [hf-mirror](https:\u002F\u002Fhf-mirror.com\u002F) to download models.\n```python\nexport HF_ENDPOINT=https:\u002F\u002Fhf-mirror.com\nhuggingface-cli download --resume-download InstantX\u002FInstantID --local-dir checkpoints --local-dir-use-symlinks False\n```\n\nFor face encoder, you need to manually download via this [URL](https:\u002F\u002Fgithub.com\u002Fdeepinsight\u002Finsightface\u002Fissues\u002F1896#issuecomment-1023867304) to `models\u002Fantelopev2` as the default link is invalid. Once you have prepared all models, the folder tree should be like:\n\n```\n  .\n  ├── models\n  ├── checkpoints\n  ├── ip_adapter\n  ├── pipeline_stable_diffusion_xl_instantid.py\n  └── README.md\n```\n\n## Usage\n\nIf you want to reproduce results in the paper, please refer to the code in [infer_full.py](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. \n\nIf you are pursuing better results, it is recommended to follow [InstantID-Rome](https:\u002F\u002Fgithub.com\u002FinstantX-research\u002FInstantID-Rome).\n\nThe following code👇 comes from [infer.py](infer.py). If you want to quickly experience InstantID, please refer to the code in [infer.py](infer.py). \n\n\n\n```python\n# !pip install opencv-python transformers accelerate insightface\nimport diffusers\nfrom diffusers.utils import load_image\nfrom diffusers.models import ControlNetModel\n\nimport cv2\nimport torch\nimport numpy as np\nfrom PIL import Image\n\nfrom insightface.app import FaceAnalysis\nfrom pipeline_stable_diffusion_xl_instantid import StableDiffusionXLInstantIDPipeline, draw_kps\n\n# prepare 'antelopev2' under .\u002Fmodels\napp = FaceAnalysis(name='antelopev2', root='.\u002F', providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])\napp.prepare(ctx_id=0, det_size=(640, 640))\n\n# prepare models under .\u002Fcheckpoints\nface_adapter = f'.\u002Fcheckpoints\u002Fip-adapter.bin'\ncontrolnet_path = f'.\u002Fcheckpoints\u002FControlNetModel'\n\n# load IdentityNet\ncontrolnet = ControlNetModel.from_pretrained(controlnet_path, torch_dtype=torch.float16)\n\nbase_model = 'wangqixun\u002FYamerMIX_v8'  # from https:\u002F\u002Fcivitai.com\u002Fmodels\u002F84040?modelVersionId=196039\npipe = StableDiffusionXLInstantIDPipeline.from_pretrained(\n    base_model,\n    controlnet=controlnet,\n    torch_dtype=torch.float16\n)\npipe.cuda()\n\n# load adapter\npipe.load_ip_adapter_instantid(face_adapter)\n```\n\nThen, you can customized your own face images\n\n```python\n# load an image\nface_image = load_image(\".\u002Fexamples\u002Fyann-lecun_resize.jpg\")\n\n# prepare face emb\nface_info = app.get(cv2.cvtColor(np.array(face_image), cv2.COLOR_RGB2BGR))\nface_info = sorted(face_info, key=lambda x:(x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]))[-1]  # only use the maximum face\nface_emb = face_info['embedding']\nface_kps = draw_kps(face_image, face_info['kps'])\n\n# prompt\nprompt = \"film noir style, ink sketch|vector, male man, highly detailed, sharp focus, ultra sharpness, monochrome, high contrast, dramatic shadows, 1940s style, mysterious, cinematic\"\nnegative_prompt = \"ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, vibrant, colorful\"\n\n# generate image\nimage = pipe(\n    prompt,\n    negative_prompt=negative_prompt,\n    image_embeds=face_emb,\n    image=face_kps,\n    controlnet_conditioning_scale=0.8,\n    ip_adapter_scale=0.8,\n).images[0]\n```\n\nTo save VRAM, you can enable CPU offloading\n```python\npipe.enable_model_cpu_offload()\npipe.enable_vae_tiling()\n```\n\n## Speed Up with LCM-LoRA\n\nOur work is compatible with [LCM-LoRA](https:\u002F\u002Fgithub.com\u002Fluosiallen\u002Flatent-consistency-model). First, download the model.\n\n```python\nfrom huggingface_hub import hf_hub_download\nhf_hub_download(repo_id=\"latent-consistency\u002Flcm-lora-sdxl\", filename=\"pytorch_lora_weights.safetensors\", local_dir=\".\u002Fcheckpoints\")\n```\n\nTo 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].\n```python\nfrom diffusers import LCMScheduler\n\nlcm_lora_path = \".\u002Fcheckpoints\u002Fpytorch_lora_weights.safetensors\"\n\npipe.load_lora_weights(lcm_lora_path)\npipe.fuse_lora()\npipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)\n\nnum_inference_steps = 10\nguidance_scale = 0\n```\n\n## Start a local gradio demo \u003Ca href='https:\u002F\u002Fgithub.com\u002Fgradio-app\u002Fgradio'>\u003Cimg src='https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fgradio-app\u002Fgradio'>\u003C\u002Fa>\nRun the following command:\n\n```python\npython gradio_demo\u002Fapp.py\n```\n\nor MultiControlNet version:\n```python\ngradio_demo\u002Fapp-multicontrolnet.py \n```\n\n## Usage Tips\n- For higher similarity, increase the weight of controlnet_conditioning_scale (IdentityNet) and ip_adapter_scale (Adapter).\n- For over-saturation, decrease the ip_adapter_scale. If not work, decrease controlnet_conditioning_scale.\n- For higher text control ability, decrease ip_adapter_scale.\n- For specific styles, choose corresponding base model makes differences.\n- We have not supported multi-person yet, only use the largest face as reference facial landmarks.\n- We provide a [style template](https:\u002F\u002Fgithub.com\u002Fahgsql\u002FStyleSelectorXL\u002Fblob\u002Fmain\u002Fsdxl_styles.json) for reference.\n\n## Community Resources\n\n### Replicate Demo\n- [zsxkib\u002Finstant-id](https:\u002F\u002Freplicate.com\u002Fzsxkib\u002Finstant-id)\n\n### WebUI\n- [Mikubill\u002Fsd-webui-controlnet](https:\u002F\u002Fgithub.com\u002FMikubill\u002Fsd-webui-controlnet\u002Fdiscussions\u002F2589)\n\n### ComfyUI\n- [cubiq\u002FComfyUI_InstantID](https:\u002F\u002Fgithub.com\u002Fcubiq\u002FComfyUI_InstantID)\n- [ZHO-ZHO-ZHO\u002FComfyUI-InstantID](https:\u002F\u002Fgithub.com\u002FZHO-ZHO-ZHO\u002FComfyUI-InstantID)\n- [huxiuhan\u002FComfyUI-InstantID](https:\u002F\u002Fgithub.com\u002Fhuxiuhan\u002FComfyUI-InstantID)\n\n### Windows\n- [sdbds\u002FInstantID-for-windows](https:\u002F\u002Fgithub.com\u002Fsdbds\u002FInstantID-for-windows)\n\n## Acknowledgements\n- InstantID is developed by InstantX Team, all copyright reserved.\n- Our work is highly inspired by [IP-Adapter](https:\u002F\u002Fgithub.com\u002Ftencent-ailab\u002FIP-Adapter) and [ControlNet](https:\u002F\u002Fgithub.com\u002Flllyasviel\u002FControlNet). Thanks for their great works!\n- Thanks [Yamer](https:\u002F\u002Fcivitai.com\u002Fuser\u002FYamer) for developing [YamerMIX](https:\u002F\u002Fcivitai.com\u002Fmodels\u002F84040?modelVersionId=196039), we use it as base model in our demo.\n- Thanks [ZHO-ZHO-ZHO](https:\u002F\u002Fgithub.com\u002FZHO-ZHO-ZHO), [huxiuhan](https:\u002F\u002Fgithub.com\u002Fhuxiuhan), [sdbds](https:\u002F\u002Fgithub.com\u002Fsdbds), [zsxkib](https:\u002F\u002Freplicate.com\u002Fzsxkib) for their generous contributions.\n- Thanks to the [HuggingFace](https:\u002F\u002Fgithub.com\u002Fhuggingface) gradio team for their free GPU support!\n- Thanks to the [ModelScope](https:\u002F\u002Fgithub.com\u002Fmodelscope\u002Fmodelscope) team for their free GPU support!\n- Thanks to the [OpenXLab](https:\u002F\u002Fopenxlab.org.cn\u002Fapps\u002Fdetail\u002FInstantX\u002FInstantID) team for their free GPU support!\n- Thanks to [SiliconFlow](https:\u002F\u002Fgithub.com\u002Fsiliconflow) for their OneDiff integration of InstantID! \n\n## Disclaimer\nThe code of InstantID is released under [Apache License](https:\u002F\u002Fgithub.com\u002FInstantID\u002FInstantID?tab=Apache-2.0-1-ov-file#readme) 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](https:\u002F\u002Fgithub.com\u002Fdeepinsight\u002Finsightface?tab=readme-ov-file#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.\n\n## Star History\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=InstantID\u002FInstantID&type=Date)](https:\u002F\u002Fstar-history.com\u002F#InstantID\u002FInstantID&Date)\n\n\n## Sponsor Us\nIf you find this project useful, you can buy us a coffee via Github Sponsor! We support [Paypal](https:\u002F\u002Fko-fi.com\u002Finstantx) and [WeChat Pay](https:\u002F\u002Ftinyurl.com\u002Finstantx-pay).\n\n## Cite\nIf you find InstantID useful for your research and applications, please cite us using this BibTeX:\n\n```bibtex\n@article{wang2024instantid,\n  title={InstantID: Zero-shot Identity-Preserving Generation in Seconds},\n  author={Wang, Qixun and Bai, Xu and Wang, Haofan and Qin, Zekui and Chen, Anthony},\n  journal={arXiv preprint arXiv:2401.07519},\n  year={2024}\n}\n```\n\nFor any question, please feel free to contact us via haofanwang.ai@gmail.com or wangqixun.ai@gmail.com.\n","InstantID 是一种无需微调即可实现身份保持生成的最新方法，仅需单张图片即可支持多种下游任务。其核心功能包括零样本身份保持图像生成，支持快速风格迁移和多种控制网络，并且兼容流行的深度估计工具。该项目使用 Python 开发，具有强大的社区支持和持续更新。InstantID 适用于需要高效、高质量身份保持图像生成的应用场景，如虚拟试衣、游戏角色定制等，特别适合对计算资源有一定要求但希望减少人工干预的企业和个人开发者。",2,"2026-06-11 03:35:12","high_star"]