Skip to content

Commit 0ab2e4f

Browse files
committed
refactor out reearrange
1 parent 5709f7e commit 0ab2e4f

File tree

5 files changed

+221
-178
lines changed

5 files changed

+221
-178
lines changed

scripts/convert_wan_to_diffusers.py

Lines changed: 109 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def get_transformer_config(model_type: str) -> Tuple[Dict[str, Any], ...]:
344344
return config, RENAME_DICT, SPECIAL_KEYS_REMAP
345345

346346

347-
def convert_transformer(model_type: str, stage: str=None):
347+
def convert_transformer(model_type: str, stage: str = None):
348348
config, RENAME_DICT, SPECIAL_KEYS_REMAP = get_transformer_config(model_type)
349349

350350
diffusers_config = config["diffusers_config"]
@@ -580,115 +580,116 @@ def convert_vae():
580580
vae.load_state_dict(new_state_dict, strict=True, assign=True)
581581
return vae
582582

583+
583584
vae22_diffusers_config = {
584-
"base_dim": 160,
585-
"z_dim": 48,
586-
"is_residual": True,
587-
"in_channels": 12,
588-
"out_channels": 12,
589-
"decoder_base_dim": 256,
590-
"scale_factor_temporal": 4,
591-
"scale_factor_spatial": 16,
592-
"patch_size": 2,
593-
"latents_mean":[
594-
-0.2289,
595-
-0.0052,
596-
-0.1323,
597-
-0.2339,
598-
-0.2799,
599-
0.0174,
600-
0.1838,
601-
0.1557,
602-
-0.1382,
603-
0.0542,
604-
0.2813,
605-
0.0891,
606-
0.1570,
607-
-0.0098,
608-
0.0375,
609-
-0.1825,
610-
-0.2246,
611-
-0.1207,
612-
-0.0698,
613-
0.5109,
614-
0.2665,
615-
-0.2108,
616-
-0.2158,
617-
0.2502,
618-
-0.2055,
619-
-0.0322,
620-
0.1109,
621-
0.1567,
622-
-0.0729,
623-
0.0899,
624-
-0.2799,
625-
-0.1230,
626-
-0.0313,
627-
-0.1649,
628-
0.0117,
629-
0.0723,
630-
-0.2839,
631-
-0.2083,
632-
-0.0520,
633-
0.3748,
634-
0.0152,
635-
0.1957,
636-
0.1433,
637-
-0.2944,
638-
0.3573,
639-
-0.0548,
640-
-0.1681,
641-
-0.0667,
585+
"base_dim": 160,
586+
"z_dim": 48,
587+
"is_residual": True,
588+
"in_channels": 12,
589+
"out_channels": 12,
590+
"decoder_base_dim": 256,
591+
"scale_factor_temporal": 4,
592+
"scale_factor_spatial": 16,
593+
"patch_size": 2,
594+
"latents_mean": [
595+
-0.2289,
596+
-0.0052,
597+
-0.1323,
598+
-0.2339,
599+
-0.2799,
600+
0.0174,
601+
0.1838,
602+
0.1557,
603+
-0.1382,
604+
0.0542,
605+
0.2813,
606+
0.0891,
607+
0.1570,
608+
-0.0098,
609+
0.0375,
610+
-0.1825,
611+
-0.2246,
612+
-0.1207,
613+
-0.0698,
614+
0.5109,
615+
0.2665,
616+
-0.2108,
617+
-0.2158,
618+
0.2502,
619+
-0.2055,
620+
-0.0322,
621+
0.1109,
622+
0.1567,
623+
-0.0729,
624+
0.0899,
625+
-0.2799,
626+
-0.1230,
627+
-0.0313,
628+
-0.1649,
629+
0.0117,
630+
0.0723,
631+
-0.2839,
632+
-0.2083,
633+
-0.0520,
634+
0.3748,
635+
0.0152,
636+
0.1957,
637+
0.1433,
638+
-0.2944,
639+
0.3573,
640+
-0.0548,
641+
-0.1681,
642+
-0.0667,
642643
],
643-
"latents_std": [
644-
0.4765,
645-
1.0364,
646-
0.4514,
647-
1.1677,
648-
0.5313,
649-
0.4990,
650-
0.4818,
651-
0.5013,
652-
0.8158,
653-
1.0344,
654-
0.5894,
655-
1.0901,
656-
0.6885,
657-
0.6165,
658-
0.8454,
659-
0.4978,
660-
0.5759,
661-
0.3523,
662-
0.7135,
663-
0.6804,
664-
0.5833,
665-
1.4146,
666-
0.8986,
667-
0.5659,
668-
0.7069,
669-
0.5338,
670-
0.4889,
671-
0.4917,
672-
0.4069,
673-
0.4999,
674-
0.6866,
675-
0.4093,
676-
0.5709,
677-
0.6065,
678-
0.6415,
679-
0.4944,
680-
0.5726,
681-
1.2042,
682-
0.5458,
683-
1.6887,
684-
0.3971,
685-
1.0600,
686-
0.3943,
687-
0.5537,
688-
0.5444,
689-
0.4089,
690-
0.7468,
691-
0.7744,
644+
"latents_std": [
645+
0.4765,
646+
1.0364,
647+
0.4514,
648+
1.1677,
649+
0.5313,
650+
0.4990,
651+
0.4818,
652+
0.5013,
653+
0.8158,
654+
1.0344,
655+
0.5894,
656+
1.0901,
657+
0.6885,
658+
0.6165,
659+
0.8454,
660+
0.4978,
661+
0.5759,
662+
0.3523,
663+
0.7135,
664+
0.6804,
665+
0.5833,
666+
1.4146,
667+
0.8986,
668+
0.5659,
669+
0.7069,
670+
0.5338,
671+
0.4889,
672+
0.4917,
673+
0.4069,
674+
0.4999,
675+
0.6866,
676+
0.4093,
677+
0.5709,
678+
0.6065,
679+
0.6415,
680+
0.4944,
681+
0.5726,
682+
1.2042,
683+
0.5458,
684+
1.6887,
685+
0.3971,
686+
1.0600,
687+
0.3943,
688+
0.5537,
689+
0.5444,
690+
0.4089,
691+
0.7468,
692+
0.7744,
692693
],
693694
"clip_output": False,
694695
}

0 commit comments

Comments
 (0)