r""" Wan diffusion backbone supporting both text-to-video and image-to-video.
| 430 | |
| 431 | |
| 432 | class WanModel(ModelMixin, ConfigMixin): |
| 433 | r""" |
| 434 | Wan diffusion backbone supporting both text-to-video and image-to-video. |
| 435 | """ |
| 436 | |
| 437 | ignore_for_config = [ |
| 438 | 'patch_size', 'cross_attn_norm', 'qk_norm', 'text_dim', 'window_size' |
| 439 | ] |
| 440 | _no_split_modules = ['WanAttentionBlock'] |
| 441 | |
| 442 | @register_to_config |
| 443 | def __init__(self, |
| 444 | model_type='i2v', |
| 445 | patch_size=(1, 2, 2), |
| 446 | text_len=512, |
| 447 | in_dim=16, |
| 448 | dim=2048, |
| 449 | ffn_dim=8192, |
| 450 | freq_dim=256, |
| 451 | text_dim=4096, |
| 452 | out_dim=16, |
| 453 | num_heads=16, |
| 454 | num_layers=32, |
| 455 | window_size=(-1, -1), |
| 456 | qk_norm=True, |
| 457 | cross_attn_norm=True, |
| 458 | eps=1e-6, |
| 459 | # audio params |
| 460 | audio_window=5, |
| 461 | intermediate_dim=512, |
| 462 | output_dim=768, |
| 463 | context_tokens=32, |
| 464 | vae_scale=4, # vae timedownsample scale |
| 465 | |
| 466 | norm_input_visual=True, |
| 467 | norm_output_audio=True, |
| 468 | weight_init=True): |
| 469 | super().__init__() |
| 470 | |
| 471 | assert model_type == 'i2v', 'MultiTalk model requires your model_type is i2v.' |
| 472 | self.model_type = model_type |
| 473 | |
| 474 | self.patch_size = patch_size |
| 475 | self.text_len = text_len |
| 476 | self.in_dim = in_dim |
| 477 | self.dim = dim |
| 478 | self.ffn_dim = ffn_dim |
| 479 | self.freq_dim = freq_dim |
| 480 | self.text_dim = text_dim |
| 481 | self.out_dim = out_dim |
| 482 | self.num_heads = num_heads |
| 483 | self.num_layers = num_layers |
| 484 | self.window_size = window_size |
| 485 | self.qk_norm = qk_norm |
| 486 | self.cross_attn_norm = cross_attn_norm |
| 487 | self.eps = eps |
| 488 | |
| 489 |
nothing calls this directly
no outgoing calls
no test coverage detected