Instructions to use JonneyWang/AnyID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use JonneyWang/AnyID with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Wan-AI/Wan2.2-TI2V-5B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("JonneyWang/AnyID") prompt = "A man with short gray hair plays a red electric guitar." input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png") image = pipe(image=input_image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Wan2.2
How to use JonneyWang/AnyID with Wan2.2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
File size: 8,214 Bytes
b00ab11 b9b7e99 18b1846 b00ab11 18b1846 b00ab11 b9b7e99 b00ab11 b9b7e99 b00ab11 13bcf1e b9b7e99 b00ab11 b9b7e99 b00ab11 13bcf1e b9b7e99 b00ab11 b9b7e99 b00ab11 13bcf1e b9b7e99 b00ab11 b9b7e99 b00ab11 13bcf1e b9b7e99 b00ab11 b9b7e99 b00ab11 b9b7e99 b00ab11 13bcf1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | ---
license: cc-by-nc-sa-4.0
library_name: diffusers
pipeline_tag: image-to-video
base_model: Wan-AI/Wan2.2-TI2V-5B
base_model_relation: adapter
tags:
- video generation
- identity-preserving
- lora
- wan2.2
- image-to-video
- text-to-video
- cvpr2026
---
<h1 align='center'>AnyID: Ultra-Fidelity Universal Identity-Preserving Video Generation from Any Visual References</h1>
<p align='center'>
☆ CVPR 2026 ☆
</p>
<p align="center">
<strong><a href="https://scholar.google.com/citations?hl=en&user=zQnTBEoAAAAJ">Jiahao Wang</a><sup>1</sup></strong>
·
<strong><a href="https://scholar.google.com/citations?user=73JaDUQAAAAJ&hl=en&oi=ao">Hualian Sheng</a><sup>2</sup></strong>
·
<strong><a href="https://scholar.google.com/citations?user=LMVeRVAAAAAJ&hl=en&oi=ao">Sijia Cai</a><sup>2,†</sup></strong>
·
<strong><a href="https://scholar.google.com/citations?hl=zh-CN&user=WwKt4BEAAAAJ">Yuxiao Yang</a><sup>3</sup></strong>
·
<strong><a href="https://gr.xjtu.edu.cn/web/zhangwzh123/">Weizhan Zhang</a><sup>1,*</sup></strong>
·
<strong><a href="https://gr.xjtu.edu.cn/web/yancaixia">Caixia Yan</a><sup>1</sup></strong>
·
<strong><a href="https://scholar.google.com/citations?user=VQp_ye4AAAAJ&hl=zh-CN&oi=ao">Bing Deng</a><sup>2</sup></strong>
·
<strong><a href="https://scholar.google.com/citations?user=T9AzhwcAAAAJ&hl=zh-CN&oi=ao">Jieping Ye</a><sup>2</sup></strong>
<br>
<sup>1</sup>Xi'an Jiaotong University
<sup>2</sup>Alibaba Cloud
<sup>3</sup>Tsinghua University
<br>
<sup>*</sup>Corresponding Author <sup>†</sup>Project Lead
<br>
<br>
<a href="https://arxiv.org/abs/2603.25188"><img src='https://img.shields.io/badge/+-arXiv-b31b1b' alt='Paper PDF'></a>
<a href="https://johnneywang.github.io/AnyID-webpage"><img src='https://img.shields.io/badge/+-Project_Page-blue' alt='Project Page'></a>
<a href="https://github.com/JoHnneyWang/AnyID"><img src='https://img.shields.io/badge/+-GitHub-black'></a>
<a href="https://huggingface.co/JonneyWang/AnyID"><img src='https://img.shields.io/badge/+-HuggingFace-yellow'></a>
<br>
<br>
Please give us a star⭐ on GitHub if you like our work.
</p>
## 📝 Intro
**AnyID** is an **ultra-fidelity, universal identity-preserving video generation framework** that overcomes the limitations of single-reference methods by leveraging **multiple free-form inputs**, including faces, portraits, and video clips. By unifying heterogeneous references through a **scalable omni-referenced architecture** and employing a **primary-referenced generation paradigm with differential prompts**, AnyID achieves **precise attribute-level controllability** while maintaining **robust identity consistency** across varying angles and expressions. Further refined by **human-centric reinforcement learning**, the framework delivers superior visual quality, ensuring both **high-fidelity character preservation** and **accurate adherence to user instructions**. Hope you have fun with this demo! 🎬

> ⚠️ **Preview release.** The weights hosted in this repository are a **preview version**,
> released for research and evaluation purposes. They may be updated or replaced with an
> improved version in the future.
## 🧩 Model Card
This repository hosts the **AnyID LoRA**, a lightweight adapter trained on top of the
**[Wan2.2 TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B)** video diffusion backbone.
It does **not** contain the base model — download Wan2.2 TI2V-5B separately (see [Quick Start](#-quick-start)).
| Item | Value |
|-----------------|--------------------------------------------------------------------|
| Version | **Preview** (subject to future updates) |
| Model type | LoRA adapter (PEFT) |
| Base model | [Wan-AI/Wan2.2-TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B) |
| Rank / Alpha | 256 / 256 (scaling = 1.0) |
| Target modules | All `nn.Linear` layers (self-/cross-attention `q,k,v,o`, FFN, embeddings, head) |
| Precision | bf16 |
| Task | Identity-preserving text/image/video → video generation |
### Files in this repository
| File | Description |
|--------------------------|----------------------------------------------|
| `anyid_lora.safetensors` | AnyID LoRA weights |
| `lora_config.json` | PEFT LoRA config (rank / alpha / targets) |
## 🚀 Quick Start
The inference code lives in the [GitHub repository](https://github.com/JoHnneyWang/AnyID).
**1. Get the code and set up the environment** (NVIDIA A100, CUDA 12.1):
```bash
git clone https://github.com/JoHnneyWang/AnyID.git
cd AnyID
conda create -n anyid python=3.10 -y
conda activate anyid
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install flash-attn --no-build-isolation
pip install -r requirements.txt
```
**2. Download the weights** — the base Wan2.2 TI2V-5B and this AnyID LoRA:
```bash
# Base model (T5 + VAE + base DiT)
huggingface-cli download Wan-AI/Wan2.2-TI2V-5B --local-dir checkpoints/Wan2.2-TI2V-5B
# AnyID LoRA (this repository)
huggingface-cli download JonneyWang/AnyID --local-dir checkpoints/AnyID
```
**3. Merge the LoRA into the DiT.** Injecting the LoRA dynamically takes minutes to load,
so pre-merge it into the DiT once (the merged weights are written into the LoRA directory):
```bash
PYTHONPATH=. python trainer/models/wan22/merge_lora.py \
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
--lora_path checkpoints/AnyID
```
**4. Run inference** — T5/VAE are loaded from the base folder, the merged DiT from the AnyID folder:
```bash
CKPT_DIR=checkpoints/Wan2.2-TI2V-5B \
MERGED_DIT=checkpoints/AnyID \
bash scripts/infer.sh
```
Or call the generator directly:
```bash
PYTHONPATH=. torchrun --nproc_per_node=1 \
trainer/models/wan22/generate.py \
--task ti2v-5B --size 1280*704 \
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
--merged_dit checkpoints/AnyID \
--prompt prompts/example.json \
--frame_num 121 \
--sample_guide_scale 4.0 --sample_shift 5.0 \
--convert_model_dtype --offload_model False \
--out_dir outputs
```
## 📥 Input Format
The prompt file is a JSON list of items. Each item carries a **differential prompt** and a single
unified **`ref`** field — a path or a list of paths — that works for both image and video
references. The **first** reference is the primary reference; the rest are auxiliary. Use **either**
up to **five images** **or** **one video** (they cannot be mixed). See
[`prompts/example.json`](https://github.com/JoHnneyWang/AnyID/blob/main/prompts/example.json) in the
GitHub repo for a runnable example.
```json
[
{
"ref": ["person_primary.png", "person_auxiliary.png"],
"prompt": "..."
}
]
```
## 📚 Citation
If you find AnyID useful in your research, please consider citing:
```bibtex
@InProceedings{Wang_2026_CVPR,
author = {Wang, Jiahao and Sheng, Hualian and Cai, Sijia and Yang, Yuxiao and Zhang, Weizhan and Yan, Caixia and Deng, Bing and Ye, Jieping},
title = {AnyID: Ultra-Fidelity Universal Identity-Preserving Video Generation from Any Visual References},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2026},
pages = {12808-12817}
}
```
## 🙏 Acknowledgements
We would like to express our sincere thank to [Wan Team](https://github.com/Wan-Video) for their support.
## 📄 License
This model is released under the [CC BY-NC-SA 4.0](LICENSE) license. You are free to share and
adapt this work for **non-commercial** purposes only, with proper attribution and under the same
license. |