You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Full training and LoRA support for Wan 2.1 and Wan 2.2 #362
Thank you for the great work! I recently test max diffusion and it works really well on my TPU setup. (v4)
But I would need Wan 2.1/2.2 LoRA supports to do the related research, as described below.
Summary
Wan 2.1 and Wan 2.2 are currently the most capable open-source video diffusion models available, yet MaxDiffusion still lacks full training and LoRA support for them. This significantly limits the applicability of MaxDiffusion for the video generation community.
Current State
Wan 2.1: Full DiT finetuning is supported (added Oct 2025), but LoRA training is not supported.
Wan 2.2: Neither full training nor LoRA training is supported. Wan 2.2 introduces a MoE architecture with high-noise and low-noise experts (A14B), along with a high-compression VAE and a 5B dense model (TI2V-5B).
Request
Wan 2.2 full training + LoRA training: Wan 2.2 has been available since July 2025. Given its MoE design (dual-expert DiT), supporting both full finetuning and LoRA would require handling the high-noise/low-noise expert routing and the updated VAE.
Wan 2.1 LoRA training: The existing Wan 2.1 full finetuning implementation should make adding LoRA relatively straightforward.
Context
Both models have been publicly available for 6+ months. Other training frameworks already support LoRA training for Wan 2.1 and Wan 2.2, but none of them provide JAX/XLA-native implementations for TPU, which is MaxDiffusion's core advantage.
Or do you know if there is other Wan 2.1/2.2 LoRA that can run on TPUs? thanks!
Willingness to Contribute
I'm happy to submit a pull request if the maintainers can provide guidance on the preferred implementation approach (e.g., LoRA injection points, config structure, checkpoint compatibility with diffusers).
@linwk20 we don't have plans at the moment to add LoRA training to Wan 2.1 or Wan 2.2 full training.
We happily accept contributions and I can work with you towards getting those contributions into the repo.
For LoRA training, tunix would be the preferred method.
For Wan 2.2 training, it would be very similar to the Wan 2.1 training script but loading two models instead and switching them based on the high/low noise ratio.
Hey @entrpn — saw your note about Tunix being the preferred path for LoRA training. Happy to
pick this up if it's still open.
@linwk20 — are you already working on this? Happy to split it up or hand off pieces if so.
Spent some time reading through the LoRA path. The encouraging part is that the trainer barely
needs to change. base_wan_trainer splits on nnx.Param, and everything after that is generic
over whatever comes back — loss, value_and_grad, apply_gradients, partition specs, the
checkpoint save. Filter on nnx.LoRAParam instead and you get the adapter-only TrainState,
optimizer state and sharding without touching wan_trainer at all. So the actual work is
adapter injection upstream of that split, plus export.
The part I want your call on before writing code is Tunix. It delegates to qwix.apply_lora_to_model, which injects by tracing a dummy forward pass and expects a get_model_input() on the model that we don't have. It also turns remat off to make that trace
work. Our configs ship with remat_policy: NONE so that's not biting today, but the block
forward is wrapped in gradient_checkpoint.apply(...) inside nnx.scan, so anyone enabling it
runs into the same thing. Either way, trace-based injection over scanned blocks doesn't drop in
cleanly right now.
So:
Would you rather I make injection scan-aware upstream in qwix, or build the adapter locally
in MaxDiffusion against nnx.LoRAParam and come back to Tunix once it handles stacked
layouts? Related question — is taking on tunix + qwix as dependencies fine here? Neither is
in the tree today.
For 2.2, do you want both experts trained in one run by sampling timesteps across the
boundary, or two separate runs producing the two files Wan2_2NNXLoraLoader already expects?
Rough sequencing I had in mind: adapter plus shape tests, then the 2.1 trainer, then export
round-tripping back through Wan2_1NNXLoraLoader, then the 2.2 dual-expert path last. The first
three stand on their own if the last one slips.
On testing, I'd put the adapter and injection tests on a 1-layer WanModel the way wan_transformer_test already does, so most of it stays reviewable at CI scale. End to end I can
run base_wan_1_3b for 2.1. The 2.2 path is the only piece that really needs a slice, which is
the other reason I'd leave it for last.
If that direction looks right I'll start with a small PR for just the adapter layer and tests.
Hi @harkanwalbedi , thanks for offering to pick this up!
I did originally intend to work on this using the TPUs I had access to through Google’s academic program.
Unfortunately, about a week after my earlier reply, as I was preparing to start the implementation, Google revoked my TPU access and declined my request for continued TPU resources. Without that access, I haven’t been able to move forward with the implementation and testing.
Please feel free to take this on. I really appreciate your help, and thanks to @entrpn for the guidance as well!
Activity
entrpn commentedon Mar 24, 2026
@linwk20 we don't have plans at the moment to add LoRA training to Wan 2.1 or Wan 2.2 full training.
We happily accept contributions and I can work with you towards getting those contributions into the repo.
For LoRA training, tunix would be the preferred method.
For Wan 2.2 training, it would be very similar to the Wan 2.1 training script but loading two models instead and switching them based on the high/low noise ratio.
harkanwalbedi commentedon Sep 11, 2026
Hey @entrpn — saw your note about Tunix being the preferred path for LoRA training. Happy to
pick this up if it's still open.
@linwk20 — are you already working on this? Happy to split it up or hand off pieces if so.
Spent some time reading through the LoRA path. The encouraging part is that the trainer barely
needs to change.
base_wan_trainersplits onnnx.Param, and everything after that is genericover whatever comes back — loss,
value_and_grad,apply_gradients, partition specs, thecheckpoint save. Filter on
nnx.LoRAParaminstead and you get the adapter-only TrainState,optimizer state and sharding without touching
wan_trainerat all. So the actual work isadapter injection upstream of that split, plus export.
The part I want your call on before writing code is Tunix. It delegates to
qwix.apply_lora_to_model, which injects by tracing a dummy forward pass and expects aget_model_input()on the model that we don't have. It also turns remat off to make that tracework. Our configs ship with
remat_policy: NONEso that's not biting today, but the blockforward is wrapped in
gradient_checkpoint.apply(...)insidennx.scan, so anyone enabling itruns into the same thing. Either way, trace-based injection over scanned blocks doesn't drop in
cleanly right now.
So:
in MaxDiffusion against
nnx.LoRAParamand come back to Tunix once it handles stackedlayouts? Related question — is taking on tunix + qwix as dependencies fine here? Neither is
in the tree today.
boundary, or two separate runs producing the two files
Wan2_2NNXLoraLoaderalready expects?Rough sequencing I had in mind: adapter plus shape tests, then the 2.1 trainer, then export
round-tripping back through
Wan2_1NNXLoraLoader, then the 2.2 dual-expert path last. The firstthree stand on their own if the last one slips.
On testing, I'd put the adapter and injection tests on a 1-layer
WanModelthe waywan_transformer_testalready does, so most of it stays reviewable at CI scale. End to end I canrun
base_wan_1_3bfor 2.1. The 2.2 path is the only piece that really needs a slice, which isthe other reason I'd leave it for last.
If that direction looks right I'll start with a small PR for just the adapter layer and tests.
linwk20 commentedon Sep 11, 2026
Hi @harkanwalbedi , thanks for offering to pick this up!
I did originally intend to work on this using the TPUs I had access to through Google’s academic program.
Unfortunately, about a week after my earlier reply, as I was preparing to start the implementation, Google revoked my TPU access and declined my request for continued TPU resources. Without that access, I haven’t been able to move forward with the implementation and testing.
Please feel free to take this on. I really appreciate your help, and thanks to @entrpn for the guidance as well!