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") output = 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
- Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -104,7 +104,7 @@ pip install -r requirements.txt
|
|
| 104 |
# Base model (T5 + VAE + base DiT)
|
| 105 |
huggingface-cli download Wan-AI/Wan2.2-TI2V-5B --local-dir checkpoints/Wan2.2-TI2V-5B
|
| 106 |
# AnyID LoRA (this repository)
|
| 107 |
-
huggingface-cli download JonneyWang/AnyID --local-dir checkpoints/AnyID
|
| 108 |
```
|
| 109 |
|
| 110 |
**3. Merge the LoRA into the DiT.** Injecting the LoRA dynamically takes minutes to load,
|
|
@@ -113,14 +113,14 @@ so pre-merge it into the DiT once (the merged weights are written into the LoRA
|
|
| 113 |
```bash
|
| 114 |
PYTHONPATH=. python trainer/models/wan22/merge_lora.py \
|
| 115 |
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
|
| 116 |
-
--lora_path checkpoints/AnyID
|
| 117 |
```
|
| 118 |
|
| 119 |
**4. Run inference** — T5/VAE are loaded from the base folder, the merged DiT from the AnyID folder:
|
| 120 |
|
| 121 |
```bash
|
| 122 |
CKPT_DIR=checkpoints/Wan2.2-TI2V-5B \
|
| 123 |
-
MERGED_DIT=checkpoints/AnyID
|
| 124 |
bash scripts/infer.sh
|
| 125 |
```
|
| 126 |
|
|
@@ -131,7 +131,7 @@ PYTHONPATH=. torchrun --nproc_per_node=1 \
|
|
| 131 |
trainer/models/wan22/generate.py \
|
| 132 |
--task ti2v-5B --size 1280*704 \
|
| 133 |
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
|
| 134 |
-
--merged_dit checkpoints/AnyID
|
| 135 |
--prompt prompts/example.json \
|
| 136 |
--frame_num 121 \
|
| 137 |
--sample_guide_scale 4.0 --sample_shift 5.0 \
|
|
@@ -180,4 +180,4 @@ We would like to express our sincere thank to [Wan Team](https://github.com/Wan-
|
|
| 180 |
|
| 181 |
This model is released under the [CC BY-NC-SA 4.0](LICENSE) license. You are free to share and
|
| 182 |
adapt this work for **non-commercial** purposes only, with proper attribution and under the same
|
| 183 |
-
license.
|
|
|
|
| 104 |
# Base model (T5 + VAE + base DiT)
|
| 105 |
huggingface-cli download Wan-AI/Wan2.2-TI2V-5B --local-dir checkpoints/Wan2.2-TI2V-5B
|
| 106 |
# AnyID LoRA (this repository)
|
| 107 |
+
huggingface-cli download JonneyWang/AnyID --local-dir checkpoints/AnyID
|
| 108 |
```
|
| 109 |
|
| 110 |
**3. Merge the LoRA into the DiT.** Injecting the LoRA dynamically takes minutes to load,
|
|
|
|
| 113 |
```bash
|
| 114 |
PYTHONPATH=. python trainer/models/wan22/merge_lora.py \
|
| 115 |
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
|
| 116 |
+
--lora_path checkpoints/AnyID
|
| 117 |
```
|
| 118 |
|
| 119 |
**4. Run inference** — T5/VAE are loaded from the base folder, the merged DiT from the AnyID folder:
|
| 120 |
|
| 121 |
```bash
|
| 122 |
CKPT_DIR=checkpoints/Wan2.2-TI2V-5B \
|
| 123 |
+
MERGED_DIT=checkpoints/AnyID \
|
| 124 |
bash scripts/infer.sh
|
| 125 |
```
|
| 126 |
|
|
|
|
| 131 |
trainer/models/wan22/generate.py \
|
| 132 |
--task ti2v-5B --size 1280*704 \
|
| 133 |
--ckpt_dir checkpoints/Wan2.2-TI2V-5B \
|
| 134 |
+
--merged_dit checkpoints/AnyID \
|
| 135 |
--prompt prompts/example.json \
|
| 136 |
--frame_num 121 \
|
| 137 |
--sample_guide_scale 4.0 --sample_shift 5.0 \
|
|
|
|
| 180 |
|
| 181 |
This model is released under the [CC BY-NC-SA 4.0](LICENSE) license. You are free to share and
|
| 182 |
adapt this work for **non-commercial** purposes only, with proper attribution and under the same
|
| 183 |
+
license.
|