diffsynth-engine 0.6.1.dev26__py3-none-any.whl → 0.6.1.dev27__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -656,6 +656,8 @@ class WanSpeech2VideoPipeline(WanVideoPipeline):
656
656
  )
657
657
 
658
658
  with LoRAContext():
659
+ cls._auto_enable_vsa(state_dicts.model, config)
660
+
659
661
  dit = WanS2VDiT.from_state_dict(
660
662
  state_dicts.model,
661
663
  config=model_config,
@@ -4,7 +4,7 @@ from typing import Callable, List, Dict, Tuple, Optional
4
4
  from tqdm import tqdm
5
5
  from PIL import Image
6
6
 
7
- from diffsynth_engine.configs import WanPipelineConfig, WanStateDicts
7
+ from diffsynth_engine.configs import WanPipelineConfig, WanStateDicts, AttnImpl, VideoSparseAttentionParams
8
8
  from diffsynth_engine.algorithm.noise_scheduler.flow_match import RecifitedFlowScheduler
9
9
  from diffsynth_engine.algorithm.sampler import FlowMatchEulerSampler
10
10
  from diffsynth_engine.models.wan.wan_dit import WanDiT
@@ -584,6 +584,8 @@ class WanVideoPipeline(BasePipeline):
584
584
  dit_state_dict = state_dicts.model
585
585
 
586
586
  with LoRAContext():
587
+ cls._auto_enable_vsa(dit_state_dict, config)
588
+
587
589
  dit = WanDiT.from_state_dict(
588
590
  dit_state_dict,
589
591
  config=dit_config,
@@ -668,6 +670,16 @@ class WanVideoPipeline(BasePipeline):
668
670
  vae_type = "wan2.2-vae"
669
671
  return vae_type
670
672
 
673
+ @staticmethod
674
+ def _auto_enable_vsa(state_dict: Dict[str, torch.Tensor], config: WanPipelineConfig):
675
+ def has_any_key(*xs):
676
+ return any(x in state_dict for x in xs)
677
+
678
+ if has_any_key("blocks.0.to_gate_compress.weight", "blocks.0.self_attn.gate_compress.weight"):
679
+ config.dit_attn_impl = AttnImpl.VSA
680
+ if config.attn_params is None:
681
+ config.attn_params = VideoSparseAttentionParams(sparsity=0.9)
682
+
671
683
  def compile(self):
672
684
  self.dit.compile_repeated_blocks()
673
685
  if self.dit2 is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsynth_engine
3
- Version: 0.6.1.dev26
3
+ Version: 0.6.1.dev27
4
4
  Author: MuseAI x ModelScope
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Operating System :: OS Independent
@@ -148,8 +148,8 @@ diffsynth_engine/pipelines/qwen_image.py,sha256=n6Nnin8OyC9Mfp8O-3N4GNq12Mws8_hH
148
148
  diffsynth_engine/pipelines/sd_image.py,sha256=nr-Nhsnomq8CsUqhTM3i2l2zG01YjwXdfRXgr_bC3F0,17891
149
149
  diffsynth_engine/pipelines/sdxl_image.py,sha256=v7ZACGPb6EcBunL6e5E9jynSQjE7GQx8etEV-ZLP91g,21704
150
150
  diffsynth_engine/pipelines/utils.py,sha256=HZbJHErNJS1DhlwJKvZ9dY7Kh8Zdlsw3zE2e88TYGRY,2277
151
- diffsynth_engine/pipelines/wan_s2v.py,sha256=AUVLhLP5F0gnOV7nqWQUSZbye5ov-m44151B3zWBrAk,29323
152
- diffsynth_engine/pipelines/wan_video.py,sha256=Hs1iVacfrwi_0X4VNgflVUlJP5vHp0x7CF6wegidP2c,29108
151
+ diffsynth_engine/pipelines/wan_s2v.py,sha256=QHlCLMqlmnp55iYm2mzg4qCq4jceRAP3Zt5Mubz3mAM,29384
152
+ diffsynth_engine/pipelines/wan_video.py,sha256=rJq60LiaCoLq1PkqUzzrdvFkp6h73fc-ZUu0MiMQC-c,29668
153
153
  diffsynth_engine/processor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
154
  diffsynth_engine/processor/canny_processor.py,sha256=hV30NlblTkEFUAmF_O-LJrNlGVM2SFrqq6okfF8VpOo,602
155
155
  diffsynth_engine/processor/depth_processor.py,sha256=dQvs3JsnyMbz4dyI9QoR8oO-mMFBFAgNvgqeCoaU5jk,1532
@@ -187,8 +187,8 @@ diffsynth_engine/utils/video.py,sha256=8FCaeqIdUsWMgWI_6SO9SPynsToGcLCQAVYFTc4CD
187
187
  diffsynth_engine/utils/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
188
188
  diffsynth_engine/utils/memory/linear_regression.py,sha256=oW_EQEw13oPoyUrxiL8A7Ksa5AuJ2ynI2qhCbfAuZbg,3930
189
189
  diffsynth_engine/utils/memory/memory_predcit_model.py,sha256=EXprSl_zlVjgfMWNXP-iw83Ot3hyMcgYaRPv-dvyL84,3943
190
- diffsynth_engine-0.6.1.dev26.dist-info/licenses/LICENSE,sha256=x7aBqQuVI0IYnftgoTPI_A0I_rjdjPPQkjnU6N2nikM,11346
191
- diffsynth_engine-0.6.1.dev26.dist-info/METADATA,sha256=z6sjXpooZoFJJGqqdE_DFtsi2f3aqhjLBbyXPX0RdgE,1164
192
- diffsynth_engine-0.6.1.dev26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
193
- diffsynth_engine-0.6.1.dev26.dist-info/top_level.txt,sha256=6zgbiIzEHLbhgDKRyX0uBJOV3F6VnGGBRIQvSiYYn6w,17
194
- diffsynth_engine-0.6.1.dev26.dist-info/RECORD,,
190
+ diffsynth_engine-0.6.1.dev27.dist-info/licenses/LICENSE,sha256=x7aBqQuVI0IYnftgoTPI_A0I_rjdjPPQkjnU6N2nikM,11346
191
+ diffsynth_engine-0.6.1.dev27.dist-info/METADATA,sha256=w8FRm_Fr7AZp3TPFh1TUHk93eWxm9CFAZcU8S4qwKj0,1164
192
+ diffsynth_engine-0.6.1.dev27.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
193
+ diffsynth_engine-0.6.1.dev27.dist-info/top_level.txt,sha256=6zgbiIzEHLbhgDKRyX0uBJOV3F6VnGGBRIQvSiYYn6w,17
194
+ diffsynth_engine-0.6.1.dev27.dist-info/RECORD,,