Skip to content

Commit 9a2eaed

Browse files
authored
[LoRA] support lightx2v lora in wan (#12040)
* support lightx2v lora in wan * add docsa. * reviewer feedback * empty
1 parent 0c71189 commit 9a2eaed

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

docs/source/en/api/pipelines/wan.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@
2929
You can find all the original Wan2.1 checkpoints under the [Wan-AI](https://huggingface.co/Wan-AI) organization.
3030

3131
The following Wan models are supported in Diffusers:
32+
3233
- [Wan 2.1 T2V 1.3B](https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B-Diffusers)
3334
- [Wan 2.1 T2V 14B](https://huggingface.co/Wan-AI/Wan2.1-T2V-14B-Diffusers)
3435
- [Wan 2.1 I2V 14B - 480P](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P-Diffusers)
3536
- [Wan 2.1 I2V 14B - 720P](https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P-Diffusers)
3637
- [Wan 2.1 FLF2V 14B - 720P](https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P-diffusers)
3738
- [Wan 2.1 VACE 1.3B](https://huggingface.co/Wan-AI/Wan2.1-VACE-1.3B-diffusers)
3839
- [Wan 2.1 VACE 14B](https://huggingface.co/Wan-AI/Wan2.1-VACE-14B-diffusers)
40+
- [Wan 2.2 T2V 14B](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers)
41+
- [Wan 2.2 I2V 14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers)
42+
- [Wan 2.2 TI2V 5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers)
3943

4044
> [!TIP]
4145
> Click on the Wan2.1 models in the right sidebar for more examples of video generation.
@@ -327,6 +331,8 @@ The general rule of thumb to keep in mind when preparing inputs for the VACE pip
327331

328332
- Try lower `shift` values (`2.0` to `5.0`) for lower resolution videos and higher `shift` values (`7.0` to `12.0`) for higher resolution images.
329333

334+
- Wan 2.1 and 2.2 support using [LightX2V LoRAs](https://huggingface.co/Kijai/WanVideo_comfy/tree/main/Lightx2v) to speed up inference. Using them on Wan 2.2 is slightly more involed. Refer to [this code snippet](https://github.com/huggingface/diffusers/pull/12040#issuecomment-3144185272) to learn more.
335+
330336
## WanPipeline
331337

332338
[[autodoc]] WanPipeline

src/diffusers/loaders/lora_conversion_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,10 @@ def _convert_non_diffusers_wan_lora_to_diffusers(state_dict):
19741974
converted_key = f"condition_embedder.image_embedder.{img_ours}.lora_B.weight"
19751975
if original_key in original_state_dict:
19761976
converted_state_dict[converted_key] = original_state_dict.pop(original_key)
1977+
bias_key_theirs = original_key.removesuffix(f".{lora_up_key}.weight") + ".diff_b"
1978+
if bias_key_theirs in original_state_dict:
1979+
bias_key = converted_key.removesuffix(".weight") + ".bias"
1980+
converted_state_dict[bias_key] = original_state_dict.pop(bias_key_theirs)
19771981

19781982
if len(original_state_dict) > 0:
19791983
diff = all(".diff" in k for k in original_state_dict)

0 commit comments

Comments
 (0)