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", torch_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
AnyID: Ultra-Fidelity Universal Identity-Preserving Video Generation from Any Visual References
β CVPR 2026 β
Jiahao Wang1
Β·
Hualian Sheng2
Β·
Sijia Cai2,β
Β·
Yuxiao Yang3
Β·
Weizhan Zhang1,*
Β·
Caixia Yan1
Β·
Bing Deng2
Β·
Jieping Ye2
1Xi'an Jiaotong University
2Alibaba Cloud
3Tsinghua University
*Corresponding Author β Project Lead
Please give us a starβ on GitHub if you like our work.
π 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 video diffusion backbone. It does not contain the base model β download Wan2.2 TI2V-5B separately (see Quick Start).
| Item | Value |
|---|---|
| Version | Preview (subject to future updates) |
| Model type | LoRA adapter (PEFT) |
| Base model | 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.
1. Get the code and set up the environment (NVIDIA A100, CUDA 12.1):
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:
# 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):
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:
CKPT_DIR=checkpoints/Wan2.2-TI2V-5B \
MERGED_DIT=checkpoints/AnyID \
bash scripts/infer.sh
Or call the generator directly:
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 in the
GitHub repo for a runnable example.
[
{
"ref": ["person_primary.png", "person_auxiliary.png"],
"prompt": "..."
}
]
π Citation
If you find AnyID useful in your research, please consider citing:
@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 for their support.
π License
This model is released under the CC BY-NC-SA 4.0 license. You are free to share and adapt this work for non-commercial purposes only, with proper attribution and under the same license.
- Downloads last month
- -
Model tree for JonneyWang/AnyID
Base model
Wan-AI/Wan2.2-TI2V-5B