diffsynth 2.1.12__tar.gz → 2.2.1__tar.gz

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.
Files changed (326) hide show
  1. {diffsynth-2.1.12 → diffsynth-2.2.1}/PKG-INFO +7 -3
  2. {diffsynth-2.1.12 → diffsynth-2.2.1}/README.md +5 -0
  3. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/configs/model_configs.py +24 -1
  4. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/configs/vram_management_module_maps.py +22 -0
  5. diffsynth-2.2.1/diffsynth/core/attention/__init__.py +2 -0
  6. diffsynth-2.2.1/diffsynth/core/attention/attention.py +51 -0
  7. diffsynth-2.2.1/diffsynth/core/attention/common.py +27 -0
  8. diffsynth-2.2.1/diffsynth/core/attention/flash_attention.py +118 -0
  9. diffsynth-2.2.1/diffsynth/core/attention/flex_attention.py +28 -0
  10. diffsynth-2.2.1/diffsynth/core/attention/registry.py +48 -0
  11. diffsynth-2.2.1/diffsynth/core/attention/sage_attention.py +20 -0
  12. diffsynth-2.2.1/diffsynth/core/attention/torch_attention.py +82 -0
  13. diffsynth-2.2.1/diffsynth/core/attention/xformers_attention.py +22 -0
  14. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/data/operators.py +11 -5
  15. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/data/unified_dataset.py +2 -1
  16. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/gradient/gradient_checkpoint.py +5 -6
  17. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/loader/config.py +2 -2
  18. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/loader/model.py +12 -4
  19. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/backends/__init__.py +2 -0
  20. diffsynth-2.2.1/diffsynth/core/quant/backends/deep_gemm.py +618 -0
  21. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/backends/entropack.py +2 -2
  22. diffsynth-2.2.1/diffsynth/diffusion/dmd2.py +355 -0
  23. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/flow_match.py +16 -1
  24. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/parsers.py +16 -18
  25. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/runner.py +7 -4
  26. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/diffsynth_music_dit.py +4 -2
  27. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ernie_image_dit.py +0 -1
  28. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/hidream_o1_image_dit.py +1 -1
  29. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/krea2_dit.py +10 -5
  30. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_controlnet.py +1 -1
  31. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_dit_vdn.py +1 -1
  32. diffsynth-2.2.1/diffsynth/models/minimax_h3_image_dit.py +336 -0
  33. diffsynth-2.2.1/diffsynth/models/minimax_h3_image_vae.py +375 -0
  34. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/sensenova_u1_dit.py +1 -1
  35. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/yue2_mot.py +2 -2
  36. diffsynth-2.2.1/diffsynth/pipelines/minimax_h3_image.py +560 -0
  37. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/sensenova_u1_image.py +1 -1
  38. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/stable_diffusion_xl.py +7 -4
  39. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/general.py +11 -3
  40. diffsynth-2.2.1/diffsynth/utils/state_dict_converters/minimax_h3_image_vae.py +16 -0
  41. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/version.py +1 -1
  42. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth.egg-info/PKG-INFO +7 -3
  43. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth.egg-info/SOURCES.txt +12 -0
  44. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth.egg-info/requires.txt +1 -2
  45. {diffsynth-2.1.12 → diffsynth-2.2.1}/pyproject.toml +1 -2
  46. diffsynth-2.1.12/diffsynth/core/attention/__init__.py +0 -1
  47. diffsynth-2.1.12/diffsynth/core/attention/attention.py +0 -255
  48. diffsynth-2.1.12/diffsynth/diffusion/dmd2.py +0 -601
  49. {diffsynth-2.1.12 → diffsynth-2.2.1}/LICENSE +0 -0
  50. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/__init__.py +0 -0
  51. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/configs/__init__.py +0 -0
  52. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/__init__.py +0 -0
  53. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/data/__init__.py +0 -0
  54. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/device/__init__.py +0 -0
  55. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/device/npu_compatible_device.py +0 -0
  56. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/gradient/__init__.py +0 -0
  57. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/loader/__init__.py +0 -0
  58. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/loader/file.py +0 -0
  59. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/npu_patch/npu_fused_operator.py +0 -0
  60. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/offload_training/__init__.py +0 -0
  61. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/offload_training/manager.py +0 -0
  62. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/offload_training/memory_buffer.py +0 -0
  63. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/offload_training/offloader.py +0 -0
  64. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/__init__.py +0 -0
  65. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/backends/bitsandbytes.py +0 -0
  66. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/backends/comfy_kitchen.py +0 -0
  67. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/backends/torchao.py +0 -0
  68. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/base.py +0 -0
  69. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/quant/config.py +0 -0
  70. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/vram/__init__.py +0 -0
  71. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/vram/disk_map.py +0 -0
  72. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/vram/initialization.py +0 -0
  73. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/core/vram/layers.py +0 -0
  74. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/__init__.py +0 -0
  75. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/base_pipeline.py +0 -0
  76. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/ddim_scheduler.py +0 -0
  77. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/logger.py +0 -0
  78. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/loss.py +0 -0
  79. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/template.py +0 -0
  80. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/diffusion/training_module.py +0 -0
  81. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/__init__.py +0 -0
  82. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/aesthetic.py +0 -0
  83. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/base.py +0 -0
  84. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/bioclip.py +0 -0
  85. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/clip.py +0 -0
  86. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/fid.py +0 -0
  87. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/hpsv2.py +0 -0
  88. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/hpsv3.py +0 -0
  89. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/image_reward.py +0 -0
  90. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/lpips.py +0 -0
  91. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/pickscore.py +0 -0
  92. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/qwen_image_bench.py +0 -0
  93. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/unified_reward_2.py +0 -0
  94. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/metrics/unified_reward_edit.py +0 -0
  95. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_conditioner.py +0 -0
  96. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_dit.py +0 -0
  97. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_residual_fsq.py +0 -0
  98. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_text_encoder.py +0 -0
  99. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_tokenizer.py +0 -0
  100. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ace_step_vae.py +0 -0
  101. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/aesthetic.py +0 -0
  102. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/anima_dit.py +0 -0
  103. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/bioclip.py +0 -0
  104. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/boogu_image_dit.py +0 -0
  105. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/clip.py +0 -0
  106. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/demucs.py +0 -0
  107. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/dinov3_image_encoder.py +0 -0
  108. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ernie_image_text_encoder.py +0 -0
  109. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/fibo_dit.py +0 -0
  110. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/fid.py +0 -0
  111. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux2_dit.py +0 -0
  112. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux2_text_encoder.py +0 -0
  113. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux2_vae.py +0 -0
  114. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux3_dit.py +0 -0
  115. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_controlnet.py +0 -0
  116. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_dit.py +0 -0
  117. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_infiniteyou.py +0 -0
  118. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_ipadapter.py +0 -0
  119. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_lora_encoder.py +0 -0
  120. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_lora_patcher.py +0 -0
  121. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_redux.py +0 -0
  122. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_text_encoder_clip.py +0 -0
  123. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_text_encoder_t5.py +0 -0
  124. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_vae.py +0 -0
  125. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/flux_value_control.py +0 -0
  126. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/general_modules.py +0 -0
  127. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/hidream_common.py +0 -0
  128. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/hpsv2.py +0 -0
  129. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/hpsv3.py +0 -0
  130. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ideogram4_dit.py +0 -0
  131. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ideogram4_text_encoder.py +0 -0
  132. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ideogram4_vae.py +0 -0
  133. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/image_reward.py +0 -0
  134. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/joyai_image_dit.py +0 -0
  135. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/krea2_text_encoder.py +0 -0
  136. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/lingbot_video_dit.py +0 -0
  137. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/longcat_video_dit.py +0 -0
  138. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/lpips.py +0 -0
  139. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx25_diffusion_video_vae.py +0 -0
  140. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx25_duration_head.py +0 -0
  141. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx25_text_encoder.py +0 -0
  142. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_audio_vae.py +0 -0
  143. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_common.py +0 -0
  144. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_dit.py +0 -0
  145. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_text_encoder.py +0 -0
  146. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_upsampler.py +0 -0
  147. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/ltx2_video_vae.py +0 -0
  148. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_audio_vae.py +0 -0
  149. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_dit.py +0 -0
  150. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_dit_comfy.py +0 -0
  151. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_dit_vdn_fp8.py +0 -0
  152. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_text_encoder.py +0 -0
  153. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_h3_video_vae.py +0 -0
  154. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_music3_condition_encoder.py +0 -0
  155. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_music3_dit.py +0 -0
  156. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_music3_rvq_depth_decoder.py +0 -0
  157. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_music3_text_encoder.py +0 -0
  158. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/minimax_music3_vocoder.py +0 -0
  159. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/model_loader.py +0 -0
  160. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/moss_image_dit.py +0 -0
  161. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/moss_image_text_encoder.py +0 -0
  162. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/mova_audio_dit.py +0 -0
  163. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/mova_audio_vae.py +0 -0
  164. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/mova_dual_tower_bridge.py +0 -0
  165. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/nexus_gen.py +0 -0
  166. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/nexus_gen_ar_model.py +0 -0
  167. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/nexus_gen_projector.py +0 -0
  168. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/pickscore.py +0 -0
  169. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_21_controlnet.py +0 -0
  170. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_21_dit.py +0 -0
  171. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_21_text_encoder.py +0 -0
  172. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_21_vae.py +0 -0
  173. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_bench.py +0 -0
  174. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_controlnet.py +0 -0
  175. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_dit.py +0 -0
  176. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_image2lora.py +0 -0
  177. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_text_encoder.py +0 -0
  178. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_image_vae.py +0 -0
  179. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/qwen_video_edit_dit.py +0 -0
  180. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/sd_text_encoder.py +0 -0
  181. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/sensenova_u1_common.py +0 -0
  182. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/siglip2_image_encoder.py +0 -0
  183. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/stable_diffusion_text_encoder.py +0 -0
  184. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/stable_diffusion_unet.py +0 -0
  185. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/stable_diffusion_vae.py +0 -0
  186. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/stable_diffusion_xl_text_encoder.py +0 -0
  187. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/stable_diffusion_xl_unet.py +0 -0
  188. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/step1x_connector.py +0 -0
  189. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/step1x_text_encoder.py +0 -0
  190. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/unified_reward_2.py +0 -0
  191. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/unified_reward_edit.py +0 -0
  192. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_animate_2_dit.py +0 -0
  193. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_animate_adapter.py +0 -0
  194. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_camera_controller.py +0 -0
  195. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_dit.py +0 -0
  196. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_dit_s2v.py +0 -0
  197. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_image_encoder.py +0 -0
  198. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_mot.py +0 -0
  199. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_motion_controller.py +0 -0
  200. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_text_encoder.py +0 -0
  201. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_vace.py +0 -0
  202. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wan_video_vae.py +0 -0
  203. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wantodance.py +0 -0
  204. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/wav2vec.py +0 -0
  205. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/yue2_tokenizer.py +0 -0
  206. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/yue2_vae.py +0 -0
  207. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/z_image_controlnet.py +0 -0
  208. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/z_image_dit.py +0 -0
  209. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/z_image_image2lora.py +0 -0
  210. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/models/z_image_text_encoder.py +0 -0
  211. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/ace_step.py +0 -0
  212. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/anima_image.py +0 -0
  213. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/boogu_image.py +0 -0
  214. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/diffsynth_music.py +0 -0
  215. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/ernie_image.py +0 -0
  216. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/fibo.py +0 -0
  217. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/flux2_image.py +0 -0
  218. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/flux3_image.py +0 -0
  219. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/flux_image.py +0 -0
  220. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/hidream_o1_image.py +0 -0
  221. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/ideogram4.py +0 -0
  222. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/joyai_image.py +0 -0
  223. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/krea2.py +0 -0
  224. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/lingbot_video.py +0 -0
  225. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/ltx2_audio_video.py +0 -0
  226. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/minimax_h3_audio_video.py +0 -0
  227. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/minimax_music3.py +0 -0
  228. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/moss_image.py +0 -0
  229. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/mova_audio_video.py +0 -0
  230. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/qwen_image.py +0 -0
  231. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/qwen_image_21.py +0 -0
  232. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/qwen_video_edit.py +0 -0
  233. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/stable_diffusion.py +0 -0
  234. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/wan_video.py +0 -0
  235. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/yue2.py +0 -0
  236. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/pipelines/z_image.py +0 -0
  237. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/controlnet/__init__.py +0 -0
  238. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/controlnet/annotator.py +0 -0
  239. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/controlnet/controlnet_input.py +0 -0
  240. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/data/__init__.py +0 -0
  241. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/data/audio.py +0 -0
  242. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/data/audio_video.py +0 -0
  243. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/data/media_io_ltx2.py +0 -0
  244. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/data/minimax_h3.py +0 -0
  245. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/demucs/__init__.py +0 -0
  246. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/dequantizer/__init__.py +0 -0
  247. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/__init__.py +0 -0
  248. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/flux.py +0 -0
  249. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/flux_timestep.py +0 -0
  250. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/krea2.py +0 -0
  251. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/merge.py +0 -0
  252. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/minimax_h3.py +0 -0
  253. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/reset_rank.py +0 -0
  254. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/lora/sdxl.py +0 -0
  255. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/music_tools/__init__.py +0 -0
  256. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/music_tools/click.py +0 -0
  257. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/music_tools/prosody.py +0 -0
  258. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/quant/serialization.py +0 -0
  259. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/ses/__init__.py +0 -0
  260. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/ses/ses.py +0 -0
  261. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/__init__.py +0 -0
  262. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ace_step_conditioner.py +0 -0
  263. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ace_step_dit.py +0 -0
  264. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ace_step_text_encoder.py +0 -0
  265. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ace_step_tokenizer.py +0 -0
  266. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/anima_dit.py +0 -0
  267. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/dino_v3.py +0 -0
  268. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ernie_image_text_encoder.py +0 -0
  269. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux2_text_encoder.py +0 -0
  270. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux3_dit.py +0 -0
  271. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_controlnet.py +0 -0
  272. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_dit.py +0 -0
  273. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_infiniteyou.py +0 -0
  274. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_ipadapter.py +0 -0
  275. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_text_encoder_clip.py +0 -0
  276. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_text_encoder_t5.py +0 -0
  277. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/flux_vae.py +0 -0
  278. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ideogram4_text_encoder.py +0 -0
  279. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/image_metrics.py +0 -0
  280. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/krea2_dit.py +0 -0
  281. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/krea2_text_encoder.py +0 -0
  282. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/lingbot_video_dit.py +0 -0
  283. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx25_diffusion_video_vae.py +0 -0
  284. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx25_duration_head.py +0 -0
  285. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx25_text_encoder.py +0 -0
  286. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx2_audio_vae.py +0 -0
  287. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx2_dit.py +0 -0
  288. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx2_text_encoder.py +0 -0
  289. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/ltx2_video_vae.py +0 -0
  290. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_audio_vae.py +0 -0
  291. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_controlnet.py +0 -0
  292. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_dit.py +0 -0
  293. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_dit_vdn.py +0 -0
  294. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_text_encoder.py +0 -0
  295. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_h3_video_vae.py +0 -0
  296. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/minimax_music3_text_encoder.py +0 -0
  297. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/moss_image_text_encoder.py +0 -0
  298. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/nexus_gen.py +0 -0
  299. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/nexus_gen_projector.py +0 -0
  300. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/qwen_image_21_text_encoder.py +0 -0
  301. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/qwen_image_text_encoder.py +0 -0
  302. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/qwen_video_edit.py +0 -0
  303. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/sdxl.py +0 -0
  304. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/sdxl_text_encoder.py +0 -0
  305. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/sdxl_text_encoder_2.py +0 -0
  306. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/sdxl_vae.py +0 -0
  307. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/stable_diffusion_text_encoder.py +0 -0
  308. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/stable_diffusion_vae.py +0 -0
  309. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/stable_diffusion_xl_text_encoder.py +0 -0
  310. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/step1x_connector.py +0 -0
  311. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_animate_adapter.py +0 -0
  312. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_dit.py +0 -0
  313. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_image_encoder.py +0 -0
  314. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_mot.py +0 -0
  315. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_vace.py +0 -0
  316. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wan_video_vae.py +0 -0
  317. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/wans2v_audio_encoder.py +0 -0
  318. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/z_image_dit.py +0 -0
  319. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/state_dict_converters/z_image_text_encoder.py +0 -0
  320. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/tile/__init__.py +0 -0
  321. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/tile/tile_worker.py +0 -0
  322. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/xfuser/__init__.py +0 -0
  323. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth/utils/xfuser/xdit_context_parallel.py +0 -0
  324. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth.egg-info/dependency_links.txt +0 -0
  325. {diffsynth-2.1.12 → diffsynth-2.2.1}/diffsynth.egg-info/top_level.txt +0 -0
  326. {diffsynth-2.1.12 → diffsynth-2.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsynth
3
- Version: 2.1.12
3
+ Version: 2.2.1
4
4
  Summary: Enjoy the magic of Diffusion models!
5
5
  Author: ModelScope Team
6
6
  License-Expression: Apache-2.0
@@ -20,6 +20,7 @@ Requires-Dist: ftfy
20
20
  Requires-Dist: pandas
21
21
  Requires-Dist: accelerate
22
22
  Requires-Dist: peft
23
+ Requires-Dist: entropack>=0.1.7
23
24
  Provides-Extra: audio
24
25
  Requires-Dist: av; extra == "audio"
25
26
  Requires-Dist: torchaudio; extra == "audio"
@@ -28,7 +29,6 @@ Requires-Dist: librosa; extra == "audio"
28
29
  Provides-Extra: quant
29
30
  Requires-Dist: bitsandbytes; extra == "quant"
30
31
  Requires-Dist: comfy-kitchen; extra == "quant"
31
- Requires-Dist: entropack[cuda13]; extra == "quant"
32
32
  Requires-Dist: torchao>=0.16; extra == "quant"
33
33
  Provides-Extra: training
34
34
  Requires-Dist: deepspeed; extra == "training"
@@ -63,7 +63,6 @@ Requires-Dist: torchcodec; extra == "all"
63
63
  Requires-Dist: librosa; extra == "all"
64
64
  Requires-Dist: bitsandbytes; extra == "all"
65
65
  Requires-Dist: comfy-kitchen; extra == "all"
66
- Requires-Dist: entropack[cuda13]; extra == "all"
67
66
  Requires-Dist: torchao>=0.16; extra == "all"
68
67
  Requires-Dist: deepspeed; extra == "all"
69
68
  Requires-Dist: tensorboard; extra == "all"
@@ -114,6 +113,8 @@ See also:
114
113
 
115
114
  > Currently, the development personnel of this project are limited, with most of the work handled by [Artiprocher](https://github.com/Artiprocher) and [mi804](https://github.com/mi804). Therefore, the progress of new feature development will be relatively slow, and the speed of responding to and resolving issues is limited. We apologize for this and ask developers to understand.
116
115
 
116
+ - **November 10, 2026** We now support MiniMax-H3-Image, the image model of the MiniMax-H3 family, including unified text-to-image and reference-image editing inference, low VRAM inference, and full/LoRA training. The checkpoint is distilled to six sampling steps with one transformer output head per step, and it generates about 16-megapixel images without an upscaler. See the [documentation](/docs/en/Model_Details/MiniMax-H3-Image.md) and [example code](/examples/minimax_h3_image/).
117
+
117
118
  - **October 21, 2026** We now support Fibo 2.0, including unified text-to-image and image editing inference, masked and multi-reference editing, text rendering, low VRAM inference, and full/LoRA training for both text-to-image and image editing on [Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev). See the [documentation](/docs/en/Model_Details/Fibo.md) and [example code](/examples/fibo/).
118
119
 
119
120
  - **October 20, 2026** We now support MOSS-Image, including inference and training for [MOSS-Image-Base](https://modelscope.cn/models/openmoss/MOSS-Image-Base) and [MOSS-Image-SFT](https://modelscope.cn/models/openmoss/MOSS-Image-SFT). In addition, we provide an [EntroPack low-bit quantized model](https://www.modelscope.cn/models/DiffSynth-Studio/MOSS-Image-EntroPack), which can run the 3.5-bit quantized model with as little as 4 GB of VRAM; and an [accelerated model](https://modelscope.cn/models/DiffSynth-Studio/MOSS-Image-SFT-TurboLoRA) distillation-accelerated via [OPD training](https://diffsynth-studio-doc.readthedocs.io/en/latest/Training/Distillation.html), supporting 8-step ultra-fast inference.
@@ -404,6 +405,7 @@ Quick start: experience popular and the latest models:
404
405
 
405
406
  | Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
406
407
  |-|-|-|-|-|-|-|-|
408
+ | MiniMax-H3-Image | [MiniMax/MiniMax-H3-Image](https://www.modelscope.cn/models/MiniMax/MiniMax-H3-Image) | [code](/examples/minimax_h3_image/model_inference/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_inference_low_vram/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/full/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_full/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/lora/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_lora/MiniMax-H3-Image.py) |
407
409
  | Fibo 2.0 | [briaai/Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev) | [code](/examples/fibo/model_inference/Fibo-2.0-dev.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-dev.py) | [code](/examples/fibo/model_training/full/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_full/Fibo-2.0-dev-T2I.py) | [code](/examples/fibo/model_training/lora/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_lora/Fibo-2.0-dev-T2I.py) |
408
410
  | Fibo 2.0 | [briaai/Fibo-2.0-edit-turbo](https://www.modelscope.cn/models/briaai/Fibo-2.0-edit-turbo) | [code](/examples/fibo/model_inference/Fibo-2.0-edit-turbo.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-edit-turbo.py) | - | - | - | - |
409
411
  | Qwen-Image-2.1 | [Qwen/Qwen-Image-2.1](https://www.modelscope.cn/models/Qwen/Qwen-Image-2.1) | [code](/examples/qwen_image_21/model_inference/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_inference_low_vram/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_training/full/Qwen-Image-2.1.sh) | [code](/examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_training/lora/Qwen-Image-2.1.sh) | [code](/examples/qwen_image_21/model_training/validate_lora/Qwen-Image-2.1.py) |
@@ -418,6 +420,7 @@ Quick start: experience popular and the latest models:
418
420
  Model overview:
419
421
 
420
422
  - Image generation
423
+ - MiniMax-H3-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MiniMax-H3-Image.html), [Example code](/examples/minimax_h3_image/)
421
424
  - Fibo 2.0: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Fibo.html), [Example code](/examples/fibo/)
422
425
  - MOSS-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MOSS-Image.html), [Example code](/examples/moss_image/)
423
426
  - FLUX.3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/FLUX.3.html), [Example code](/examples/flux3/)
@@ -707,6 +710,7 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
707
710
 
708
711
  | Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
709
712
  |-|-|-|-|-|-|-|-|
713
+ | MiniMax-H3-Image | [MiniMax/MiniMax-H3-Image](https://www.modelscope.cn/models/MiniMax/MiniMax-H3-Image) | [code](/examples/minimax_h3_image/model_inference/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_inference_low_vram/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/full/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_full/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/lora/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_lora/MiniMax-H3-Image.py) |
710
714
  | Fibo 2.0 | [briaai/Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev) | [code](/examples/fibo/model_inference/Fibo-2.0-dev.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-dev.py) | [code](/examples/fibo/model_training/full/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_full/Fibo-2.0-dev-T2I.py) | [code](/examples/fibo/model_training/lora/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_lora/Fibo-2.0-dev-T2I.py) |
711
715
  | Fibo 2.0 | [briaai/Fibo-2.0-edit-turbo](https://www.modelscope.cn/models/briaai/Fibo-2.0-edit-turbo) | [code](/examples/fibo/model_inference/Fibo-2.0-edit-turbo.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-edit-turbo.py) | - | - | - | - |
712
716
  | MOSS-Image | [openmoss/MOSS-Image-Base](https://www.modelscope.cn/models/openmoss/MOSS-Image-Base) | [code](/examples/moss_image/model_inference/MOSS-Image-Base.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-Base.py) | [code](/examples/moss_image/model_training/full/MOSS-Image-Base.sh) | [code](/examples/moss_image/model_training/validate_full/MOSS-Image-Base.py) | [code](/examples/moss_image/model_training/lora/MOSS-Image-Base.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-Base.py) |
@@ -41,6 +41,8 @@ See also:
41
41
 
42
42
  > Currently, the development personnel of this project are limited, with most of the work handled by [Artiprocher](https://github.com/Artiprocher) and [mi804](https://github.com/mi804). Therefore, the progress of new feature development will be relatively slow, and the speed of responding to and resolving issues is limited. We apologize for this and ask developers to understand.
43
43
 
44
+ - **November 10, 2026** We now support MiniMax-H3-Image, the image model of the MiniMax-H3 family, including unified text-to-image and reference-image editing inference, low VRAM inference, and full/LoRA training. The checkpoint is distilled to six sampling steps with one transformer output head per step, and it generates about 16-megapixel images without an upscaler. See the [documentation](/docs/en/Model_Details/MiniMax-H3-Image.md) and [example code](/examples/minimax_h3_image/).
45
+
44
46
  - **October 21, 2026** We now support Fibo 2.0, including unified text-to-image and image editing inference, masked and multi-reference editing, text rendering, low VRAM inference, and full/LoRA training for both text-to-image and image editing on [Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev). See the [documentation](/docs/en/Model_Details/Fibo.md) and [example code](/examples/fibo/).
45
47
 
46
48
  - **October 20, 2026** We now support MOSS-Image, including inference and training for [MOSS-Image-Base](https://modelscope.cn/models/openmoss/MOSS-Image-Base) and [MOSS-Image-SFT](https://modelscope.cn/models/openmoss/MOSS-Image-SFT). In addition, we provide an [EntroPack low-bit quantized model](https://www.modelscope.cn/models/DiffSynth-Studio/MOSS-Image-EntroPack), which can run the 3.5-bit quantized model with as little as 4 GB of VRAM; and an [accelerated model](https://modelscope.cn/models/DiffSynth-Studio/MOSS-Image-SFT-TurboLoRA) distillation-accelerated via [OPD training](https://diffsynth-studio-doc.readthedocs.io/en/latest/Training/Distillation.html), supporting 8-step ultra-fast inference.
@@ -331,6 +333,7 @@ Quick start: experience popular and the latest models:
331
333
 
332
334
  | Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
333
335
  |-|-|-|-|-|-|-|-|
336
+ | MiniMax-H3-Image | [MiniMax/MiniMax-H3-Image](https://www.modelscope.cn/models/MiniMax/MiniMax-H3-Image) | [code](/examples/minimax_h3_image/model_inference/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_inference_low_vram/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/full/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_full/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/lora/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_lora/MiniMax-H3-Image.py) |
334
337
  | Fibo 2.0 | [briaai/Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev) | [code](/examples/fibo/model_inference/Fibo-2.0-dev.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-dev.py) | [code](/examples/fibo/model_training/full/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_full/Fibo-2.0-dev-T2I.py) | [code](/examples/fibo/model_training/lora/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_lora/Fibo-2.0-dev-T2I.py) |
335
338
  | Fibo 2.0 | [briaai/Fibo-2.0-edit-turbo](https://www.modelscope.cn/models/briaai/Fibo-2.0-edit-turbo) | [code](/examples/fibo/model_inference/Fibo-2.0-edit-turbo.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-edit-turbo.py) | - | - | - | - |
336
339
  | Qwen-Image-2.1 | [Qwen/Qwen-Image-2.1](https://www.modelscope.cn/models/Qwen/Qwen-Image-2.1) | [code](/examples/qwen_image_21/model_inference/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_inference_low_vram/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_training/full/Qwen-Image-2.1.sh) | [code](/examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1.py) | [code](/examples/qwen_image_21/model_training/lora/Qwen-Image-2.1.sh) | [code](/examples/qwen_image_21/model_training/validate_lora/Qwen-Image-2.1.py) |
@@ -345,6 +348,7 @@ Quick start: experience popular and the latest models:
345
348
  Model overview:
346
349
 
347
350
  - Image generation
351
+ - MiniMax-H3-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MiniMax-H3-Image.html), [Example code](/examples/minimax_h3_image/)
348
352
  - Fibo 2.0: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Fibo.html), [Example code](/examples/fibo/)
349
353
  - MOSS-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MOSS-Image.html), [Example code](/examples/moss_image/)
350
354
  - FLUX.3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/FLUX.3.html), [Example code](/examples/flux3/)
@@ -634,6 +638,7 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
634
638
 
635
639
  | Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
636
640
  |-|-|-|-|-|-|-|-|
641
+ | MiniMax-H3-Image | [MiniMax/MiniMax-H3-Image](https://www.modelscope.cn/models/MiniMax/MiniMax-H3-Image) | [code](/examples/minimax_h3_image/model_inference/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_inference_low_vram/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/full/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_full/MiniMax-H3-Image.py) | [code](/examples/minimax_h3_image/model_training/lora/MiniMax-H3-Image.sh) | [code](/examples/minimax_h3_image/model_training/validate_lora/MiniMax-H3-Image.py) |
637
642
  | Fibo 2.0 | [briaai/Fibo-2.0-dev](https://www.modelscope.cn/models/briaai/Fibo-2.0-dev) | [code](/examples/fibo/model_inference/Fibo-2.0-dev.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-dev.py) | [code](/examples/fibo/model_training/full/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_full/Fibo-2.0-dev-T2I.py) | [code](/examples/fibo/model_training/lora/Fibo-2.0-dev-T2I.sh) | [code](/examples/fibo/model_training/validate_lora/Fibo-2.0-dev-T2I.py) |
638
643
  | Fibo 2.0 | [briaai/Fibo-2.0-edit-turbo](https://www.modelscope.cn/models/briaai/Fibo-2.0-edit-turbo) | [code](/examples/fibo/model_inference/Fibo-2.0-edit-turbo.py) | [code](/examples/fibo/model_inference_low_vram/Fibo-2.0-edit-turbo.py) | - | - | - | - |
639
644
  | MOSS-Image | [openmoss/MOSS-Image-Base](https://www.modelscope.cn/models/openmoss/MOSS-Image-Base) | [code](/examples/moss_image/model_inference/MOSS-Image-Base.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-Base.py) | [code](/examples/moss_image/model_training/full/MOSS-Image-Base.sh) | [code](/examples/moss_image/model_training/validate_full/MOSS-Image-Base.py) | [code](/examples/moss_image/model_training/lora/MOSS-Image-Base.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-Base.py) |
@@ -1743,6 +1743,29 @@ minimax_music3_series = [
1743
1743
  },
1744
1744
  ]
1745
1745
 
1746
+ minimax_h3_image_series = [
1747
+ {
1748
+ # Example: ModelConfig(model_id="MiniMax/MiniMax-H3-Image", origin_file_pattern="transformer/model*.safetensors")
1749
+ # Example: ModelConfig(path="./models/train/MiniMax-H3-Image-full-split/epoch-4.safetensors")
1750
+ "model_hash": "cbc654a2ff91b53b57e2556904bdbc5e",
1751
+ "model_name": "minimax_h3_image_dit",
1752
+ "model_class": "diffsynth.models.minimax_h3_image_dit.MiniMaxH3ImageDiT",
1753
+ },
1754
+ {
1755
+ # Example: ModelConfig(model_id="MiniMax/MiniMax-H3-Image", origin_file_pattern="pdd_fused_heads.safetensors")
1756
+ "model_hash": "af836167abebf4a4701ab436f291a972",
1757
+ "model_name": "minimax_h3_image_pdd_heads",
1758
+ "model_class": "diffsynth.models.minimax_h3_image_dit.MiniMaxH3ImagePDDHeads",
1759
+ },
1760
+ {
1761
+ # Example: ModelConfig(model_id="MiniMax/MiniMax-H3-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors")
1762
+ "model_hash": "e16b57e3180a14235ffcaad014ce2772",
1763
+ "model_name": "minimax_h3_image_vae",
1764
+ "model_class": "diffsynth.models.minimax_h3_image_vae.MiniMaxH3ImageVAE",
1765
+ "state_dict_converter": "diffsynth.utils.state_dict_converters.minimax_h3_image_vae.MiniMaxH3ImageVAEStateDictConverter",
1766
+ },
1767
+ ]
1768
+
1746
1769
  sensenova_u1_series = [
1747
1770
  {
1748
1771
  # Example: ModelConfig(model_id="SenseNova/SenseNova-U1.5-8B-MoT", origin_file_pattern="model*.safetensors")
@@ -1857,5 +1880,5 @@ MODEL_CONFIGS = (
1857
1880
  stable_diffusion_xl_series + stable_diffusion_series + qwen_image_series + qwen_video_edit_series + wan_series + flux_series + flux2_series + ernie_image_series
1858
1881
  + z_image_series + ltx2_series + anima_series + mova_series + joyai_image_series + boogu_image_series + ace_step_series + hidream_o1_image_series
1859
1882
  + image_metrics_series + ideogram4_series + krea2_series + lingbot_video_series + minimax_h3_series + minimax_music3_series + sensenova_u1_series
1860
- + yue2_series + qwen_image_21_series + flux3_series + moss_image_series + fibo_series
1883
+ + yue2_series + qwen_image_21_series + flux3_series + moss_image_series + fibo_series + minimax_h3_image_series
1861
1884
  )
@@ -10,6 +10,24 @@ flux_general_vram_config = {
10
10
  }
11
11
 
12
12
  VRAM_MANAGEMENT_MODULE_MAPS = {
13
+ "diffsynth.models.minimax_h3_image_dit.MiniMaxH3ImageDiT": {
14
+ "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
15
+ "torch.nn.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
16
+ },
17
+ "diffsynth.models.minimax_h3_image_dit.MiniMaxH3ImagePDDHeads": {
18
+ "diffsynth.models.minimax_h3_image_dit._MiniMaxH3ImagePDDHeadParameters": "diffsynth.core.vram.layers.AutoWrappedModule",
19
+ },
20
+ "diffsynth.models.minimax_h3_image_vae.MiniMaxH3ImageVAE": {
21
+ "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
22
+ "torch.nn.LayerNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
23
+ "torch.nn.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
24
+ "torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
25
+ "torch.nn.Conv3d": "diffsynth.core.vram.layers.AutoWrappedModule",
26
+ "torch.nn.GroupNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
27
+ "diffsynth.models.minimax_h3_video_vae.BaseConv3d": "diffsynth.core.vram.layers.AutoWrappedModule",
28
+ "diffsynth.models.minimax_h3_video_vae.WarpedTensor": "diffsynth.core.vram.layers.AutoWrappedModule",
29
+ "diffsynth.models.minimax_h3_video_vae.TemporalIsolatedSpatialGroupNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
30
+ },
13
31
  "diffsynth.models.minimax_h3_dit.MiniMaxH3DiT": {
14
32
  "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
15
33
  "torch.nn.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
@@ -115,6 +133,9 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
115
133
  "diffsynth.models.wan_video_animate_adapter.ConvLayer": "diffsynth.core.vram.layers.AutoWrappedModule",
116
134
  "diffsynth.models.wan_video_animate_adapter.FusedLeakyReLU": "diffsynth.core.vram.layers.AutoWrappedModule",
117
135
  "diffsynth.models.wan_video_animate_adapter.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
136
+ "diffsynth.models.wan_video_animate_adapter.Blur": "diffsynth.core.vram.layers.AutoWrappedModule",
137
+ "diffsynth.models.wan_video_animate_adapter.EqualConv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
138
+ "diffsynth.models.wan_video_animate_adapter.Direction": "diffsynth.core.vram.layers.AutoWrappedModule",
118
139
  "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
119
140
  "torch.nn.LayerNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
120
141
  "torch.nn.Conv1d": "diffsynth.core.vram.layers.AutoWrappedModule",
@@ -150,6 +171,7 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
150
171
  "torch.nn.LayerNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
151
172
  "diffsynth.models.wan_video_dit.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
152
173
  "torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
174
+ "torch.nn.MultiheadAttention": "diffsynth.core.vram.layers.AutoWrappedModule",
153
175
  },
154
176
  "diffsynth.models.wan_video_image_encoder.WanImageEncoder": {
155
177
  "diffsynth.models.wan_video_image_encoder.VisionTransformer": "diffsynth.core.vram.layers.AutoWrappedModule",
@@ -0,0 +1,2 @@
1
+ from .attention import attention_forward, list_attention_implementations
2
+ from .flex_attention import FLEX_ATTN_AVAILABLE
@@ -0,0 +1,51 @@
1
+ import os
2
+ from .registry import (
3
+ get_attention_implementation,
4
+ list_attention_implementations,
5
+ register_attention_implementation,
6
+ )
7
+ from .flash_attention import CUSTOMIZED_FA_KERNEL_AVAILABLE, FLASH_ATTN_4_AVAILABLE, FLASH_ATTN_3_AVAILABLE, FLASH_ATTN_2_AVAILABLE
8
+ from .sage_attention import SAGE_ATTN_AVAILABLE
9
+ from .xformers_attention import XFORMERS_AVAILABLE
10
+ from .torch_attention import torch_sdpa, torch_sdpa_sliding_window
11
+ from .flex_attention import flex_attention
12
+
13
+
14
+ def initialize_attention_priority():
15
+ if os.environ.get('DIFFSYNTH_ATTENTION_IMPLEMENTATION') is not None:
16
+ return os.environ.get('DIFFSYNTH_ATTENTION_IMPLEMENTATION').strip().lower()
17
+ else:
18
+ for name in ["customized_fa_kernel", "flash_attention_4", "flash_attention_3", "flash_attention_2", "xformers"]:
19
+ if name in list_attention_implementations():
20
+ return name
21
+ return "torch"
22
+
23
+
24
+ ATTENTION_IMPLEMENTATION = initialize_attention_priority()
25
+
26
+
27
+ def attention_forward(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, attn_mask=None, scale=None, is_causal=False, compatibility_mode=False, window_size=None, use_flex=False, score_mod=None):
28
+ if use_flex or score_mod is not None:
29
+ return flex_attention(q, k, v, q_pattern, k_pattern, v_pattern, out_pattern, dims, attn_mask=attn_mask, scale=scale, score_mod=score_mod)
30
+
31
+ if compatibility_mode:
32
+ return torch_sdpa(q, k, v, q_pattern, k_pattern, v_pattern, out_pattern, dims, attn_mask=attn_mask, scale=scale, is_causal=is_causal, window_size=window_size)
33
+
34
+ backend = get_attention_implementation(ATTENTION_IMPLEMENTATION)
35
+
36
+ if attn_mask is not None and not backend.supports_mask:
37
+ return torch_sdpa(q, k, v, q_pattern, k_pattern, v_pattern, out_pattern, dims, attn_mask=attn_mask, scale=scale, is_causal=is_causal)
38
+ if window_size is not None and not backend.supports_window:
39
+ assert is_causal == False and attn_mask is None
40
+ return torch_sdpa_sliding_window(q, k, v, window_size, q_pattern, k_pattern, v_pattern, out_pattern, dims, scale=scale)
41
+ if is_causal and not backend.supports_causal:
42
+ return torch_sdpa(q, k, v, q_pattern, k_pattern, v_pattern, out_pattern, dims, attn_mask=attn_mask, scale=scale, is_causal=is_causal)
43
+
44
+ kwargs = {"scale": scale}
45
+ if backend.supports_causal:
46
+ kwargs["is_causal"] = is_causal
47
+ if backend.supports_mask:
48
+ kwargs["attn_mask"] = attn_mask
49
+ if backend.supports_window:
50
+ kwargs["window_size"] = window_size
51
+ return backend.func(q, k, v, q_pattern, k_pattern, v_pattern, out_pattern, dims, **kwargs)
@@ -0,0 +1,27 @@
1
+ import inspect
2
+
3
+ import torch
4
+ from einops import rearrange
5
+
6
+ try:
7
+ TORCH_SUPPORT_GQA = "enable_gqa" in inspect.signature(torch.nn.functional.scaled_dot_product_attention).parameters
8
+ except Exception:
9
+ TORCH_SUPPORT_GQA = False
10
+
11
+
12
+ def rearrange_qkv(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", required_in_pattern="b n s d", dims=None):
13
+ dims = {} if dims is None else dims
14
+ if q_pattern != required_in_pattern:
15
+ q = rearrange(q, f"{q_pattern} -> {required_in_pattern}", **dims)
16
+ if k_pattern != required_in_pattern:
17
+ k = rearrange(k, f"{k_pattern} -> {required_in_pattern}", **dims)
18
+ if v_pattern != required_in_pattern:
19
+ v = rearrange(v, f"{v_pattern} -> {required_in_pattern}", **dims)
20
+ return q, k, v
21
+
22
+
23
+ def rearrange_out(out: torch.Tensor, out_pattern="b n s d", required_out_pattern="b n s d", dims=None):
24
+ dims = {} if dims is None else dims
25
+ if out_pattern != required_out_pattern:
26
+ out = rearrange(out, f"{required_out_pattern} -> {out_pattern}", **dims)
27
+ return out
@@ -0,0 +1,118 @@
1
+ import os
2
+
3
+ from .common import rearrange_qkv, rearrange_out
4
+ from .registry import register_attention_implementation
5
+
6
+ if os.environ.get("DIFFSYNTH_FLASH_ATTN_KERNEL_REPO_ID") is not None:
7
+ try:
8
+ from kernels import get_kernel
9
+ kernel_module = get_kernel(os.environ.get("DIFFSYNTH_FLASH_ATTN_KERNEL_REPO_ID"), version=int(os.environ.get("DIFFSYNTH_FLASH_ATTN_KERNEL_VERSION")))
10
+ customized_flash_attn_func = kernel_module.flash_attn_func
11
+ CUSTOMIZED_FA_KERNEL_AVAILABLE = True
12
+ except Exception:
13
+ CUSTOMIZED_FA_KERNEL_AVAILABLE = False
14
+ else:
15
+ CUSTOMIZED_FA_KERNEL_AVAILABLE = False
16
+
17
+ try:
18
+ from flash_attn.cute import flash_attn_func as flash_attn_func_cute
19
+ FLASH_ATTN_4_AVAILABLE = True
20
+ except Exception:
21
+ FLASH_ATTN_4_AVAILABLE = False
22
+
23
+ try:
24
+ from flash_attn_3 import flash_attn_interface
25
+ FLASH_ATTN_3_AVAILABLE = True
26
+ except Exception:
27
+ FLASH_ATTN_3_AVAILABLE = False
28
+
29
+ try:
30
+ import flash_attn
31
+ FLASH_ATTN_2_AVAILABLE = hasattr(flash_attn, "flash_attn_func")
32
+ except Exception:
33
+ FLASH_ATTN_2_AVAILABLE = False
34
+
35
+
36
+ def _require(flag, name):
37
+ if not flag:
38
+ raise RuntimeError(f"{name} is not available.")
39
+
40
+
41
+ def flash_attention_4(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None, is_causal=False, window_size=None):
42
+ _require(FLASH_ATTN_4_AVAILABLE, "FlashAttention-4")
43
+ required_in_pattern, required_out_pattern = "b s n d", "b s n d"
44
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
45
+ window_size = (window_size, window_size) if window_size is not None else (-1, -1)
46
+ out = flash_attn_func_cute(q, k, v, softmax_scale=scale, causal=is_causal, window_size=window_size)
47
+ if isinstance(out, tuple):
48
+ out = out[0]
49
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
50
+ return out
51
+
52
+
53
+ def flash_attention_3(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None, is_causal=False, window_size=None):
54
+ _require(FLASH_ATTN_3_AVAILABLE, "FlashAttention-3")
55
+ required_in_pattern, required_out_pattern = "b s n d", "b s n d"
56
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
57
+ window_size = (window_size, window_size) if window_size is not None else (-1, -1)
58
+ out = flash_attn_interface.flash_attn_func(q, k, v, softmax_scale=scale, causal=is_causal, window_size=window_size)
59
+ if isinstance(out, tuple):
60
+ out = out[0]
61
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
62
+ return out
63
+
64
+
65
+ def flash_attention_2(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None, is_causal=False, window_size=None):
66
+ _require(FLASH_ATTN_2_AVAILABLE, "FlashAttention-2")
67
+ required_in_pattern, required_out_pattern = "b s n d", "b s n d"
68
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
69
+ window_size = (window_size, window_size) if window_size is not None else (-1, -1)
70
+ out = flash_attn.flash_attn_func(q, k, v, softmax_scale=scale, causal=is_causal, window_size=window_size)
71
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
72
+ return out
73
+
74
+
75
+ def flash_attention_customized_kernel(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None, is_causal=False, window_size=None):
76
+ _require(CUSTOMIZED_FA_KERNEL_AVAILABLE, "customized FlashAttention kernel")
77
+ required_in_pattern, required_out_pattern = "b s n d", "b s n d"
78
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
79
+ window_size = (window_size, window_size) if window_size is not None else (-1, -1)
80
+ out = customized_flash_attn_func(q, k, v, softmax_scale=scale, causal=is_causal, window_size=window_size)
81
+ if isinstance(out, tuple):
82
+ out = out[0]
83
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
84
+ return out
85
+
86
+
87
+ if CUSTOMIZED_FA_KERNEL_AVAILABLE:
88
+ register_attention_implementation(
89
+ "customized_fa_kernel",
90
+ flash_attention_customized_kernel,
91
+ supports_causal=True,
92
+ supports_window=True,
93
+ supports_gqa=True,
94
+ )
95
+ if FLASH_ATTN_4_AVAILABLE:
96
+ register_attention_implementation(
97
+ "flash_attention_4",
98
+ flash_attention_4,
99
+ supports_causal=True,
100
+ supports_window=True,
101
+ supports_gqa=True,
102
+ )
103
+ if FLASH_ATTN_3_AVAILABLE:
104
+ register_attention_implementation(
105
+ "flash_attention_3",
106
+ flash_attention_3,
107
+ supports_causal=True,
108
+ supports_window=True,
109
+ supports_gqa=True,
110
+ )
111
+ if FLASH_ATTN_2_AVAILABLE:
112
+ register_attention_implementation(
113
+ "flash_attention_2",
114
+ flash_attention_2,
115
+ supports_causal=True,
116
+ supports_window=True,
117
+ supports_gqa=True,
118
+ )
@@ -0,0 +1,28 @@
1
+ import torch
2
+
3
+ from .common import rearrange_qkv, rearrange_out
4
+
5
+ try:
6
+ from torch.nn.attention.flex_attention import flex_attention as _flex_attention_func
7
+ FLEX_ATTN_AVAILABLE = True
8
+ except Exception:
9
+ FLEX_ATTN_AVAILABLE = False
10
+
11
+ # Compile flex attention lazily
12
+ _compiled_flex_attention_func = None
13
+
14
+
15
+ def get_flex_attention_func():
16
+ global _compiled_flex_attention_func
17
+ if _compiled_flex_attention_func is None:
18
+ _compiled_flex_attention_func = torch.compile(_flex_attention_func)
19
+ return _compiled_flex_attention_func
20
+
21
+
22
+ def flex_attention(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, attn_mask=None, scale=None, score_mod=None):
23
+ assert FLEX_ATTN_AVAILABLE, "Flex Attention is not available. Please upgrade torch to 2.5.0 or later."
24
+ required_in_pattern, required_out_pattern = "b n s d", "b n s d"
25
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
26
+ out = get_flex_attention_func()(query=q, key=k, value=v, block_mask=attn_mask, scale=scale, score_mod=score_mod)
27
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
28
+ return out
@@ -0,0 +1,48 @@
1
+ from dataclasses import dataclass
2
+ from typing import Callable, Optional
3
+
4
+
5
+ @dataclass(frozen=True)
6
+ class AttentionBackend:
7
+ func: Callable
8
+ supports_causal: bool = False
9
+ supports_window: bool = False
10
+ supports_mask: bool = False
11
+ supports_gqa: bool = False
12
+
13
+
14
+ _ATTENTION_BACKENDS = {}
15
+
16
+
17
+ def register_attention_implementation(
18
+ name: str,
19
+ func: Optional[Callable] = None,
20
+ supports_causal: bool = False,
21
+ supports_window: bool = False,
22
+ supports_mask: bool = False,
23
+ supports_gqa: bool = False,
24
+ ):
25
+ key = name.strip().lower()
26
+ _ATTENTION_BACKENDS[key] = AttentionBackend(
27
+ func=func,
28
+ supports_causal=supports_causal,
29
+ supports_window=supports_window,
30
+ supports_mask=supports_mask,
31
+ supports_gqa=supports_gqa,
32
+ )
33
+
34
+
35
+ def get_attention_implementation(name: str) -> AttentionBackend:
36
+ key = name.strip().lower()
37
+ if key not in _ATTENTION_BACKENDS:
38
+ available = ", ".join(list_attention_implementations()) or "none"
39
+ raise ValueError(
40
+ f"Unknown attention implementation: {name!r}. "
41
+ f"Available implementations: {available}. "
42
+ f"Please check the environment variable `DIFFSYNTH_ATTENTION_IMPLEMENTATION`."
43
+ )
44
+ return _ATTENTION_BACKENDS[key]
45
+
46
+
47
+ def list_attention_implementations():
48
+ return sorted(_ATTENTION_BACKENDS)
@@ -0,0 +1,20 @@
1
+ from .common import rearrange_qkv, rearrange_out
2
+ from .registry import register_attention_implementation
3
+
4
+ try:
5
+ from sageattention import sageattn
6
+ SAGE_ATTN_AVAILABLE = True
7
+ except Exception:
8
+ SAGE_ATTN_AVAILABLE = False
9
+
10
+ def sage_attention(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None):
11
+ if not SAGE_ATTN_AVAILABLE:
12
+ raise RuntimeError("SageAttention is not available.")
13
+ required_in_pattern, required_out_pattern = "b n s d", "b n s d"
14
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
15
+ out = sageattn(q, k, v, sm_scale=scale)
16
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
17
+ return out
18
+
19
+ if SAGE_ATTN_AVAILABLE:
20
+ register_attention_implementation("sage_attention", sage_attention)
@@ -0,0 +1,82 @@
1
+ import torch
2
+ from einops import repeat
3
+
4
+ from .common import TORCH_SUPPORT_GQA, rearrange_qkv, rearrange_out
5
+ from .registry import register_attention_implementation
6
+
7
+
8
+ def torch_sdpa(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, attn_mask=None, scale=None, is_causal=False, window_size=None):
9
+ if window_size is not None:
10
+ if is_causal or attn_mask is not None:
11
+ raise ValueError("Sliding window attention does not support `is_causal=True` or `attn_mask`.")
12
+ return torch_sdpa_sliding_window(q, k, v, window_size, q_pattern, k_pattern, v_pattern, out_pattern, dims, scale=scale)
13
+
14
+ required_in_pattern, required_out_pattern = "b n s d", "b n s d"
15
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
16
+ if q.shape[1] != k.shape[1] or q.shape[1] != v.shape[1]:
17
+ # Grouped Query Attention
18
+ if TORCH_SUPPORT_GQA:
19
+ out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask, scale=scale, is_causal=is_causal, enable_gqa=True)
20
+ else:
21
+ # In low-version torch, `enable_gqa` is not supported.
22
+ k = repeat(k, "b n s d -> b (n m) s d", m=q.shape[1]//k.shape[1])
23
+ v = repeat(v, "b n s d -> b (n m) s d", m=q.shape[1]//v.shape[1])
24
+ out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask, scale=scale, is_causal=is_causal)
25
+ else:
26
+ out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask, scale=scale, is_causal=is_causal)
27
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
28
+ return out
29
+
30
+
31
+ def torch_sdpa_sliding_window(q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, sliding_window: int, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None):
32
+ required_in_pattern, required_out_pattern = "b n s d", "b n s d"
33
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
34
+
35
+ B, N, S, D = q.shape
36
+ W = sliding_window
37
+ chunk_size = W
38
+ num_chunks = (S + chunk_size - 1) // chunk_size
39
+
40
+ output = torch.empty_like(q)
41
+ dtype = q.dtype
42
+ device = q.device
43
+ min_val = torch.finfo(dtype).min
44
+
45
+ for i in range(num_chunks):
46
+ q_start = i * chunk_size
47
+ q_end = min(q_start + chunk_size, S)
48
+ actual_chunk_size = q_end - q_start
49
+
50
+ kv_start = max(0, q_start - W)
51
+ kv_end = min(S, q_end + W)
52
+
53
+ q_chunk = q[:, :, q_start:q_end, :]
54
+ k_chunk = k[:, :, kv_start:kv_end, :]
55
+ v_chunk = v[:, :, kv_start:kv_end, :]
56
+
57
+ q_indices = torch.arange(q_start, q_end, device=device)
58
+ k_indices = torch.arange(kv_start, kv_end, device=device)
59
+ diff = q_indices.unsqueeze(1) - k_indices.unsqueeze(0)
60
+ valid = diff.abs() <= W
61
+
62
+ local_mask = torch.zeros(actual_chunk_size, kv_end - kv_start, dtype=dtype, device=device)
63
+ local_mask.masked_fill_(~valid, min_val)
64
+ local_mask = local_mask.unsqueeze(0).unsqueeze(0)
65
+
66
+ out_chunk = torch_sdpa(
67
+ q_chunk, k_chunk, v_chunk, attn_mask=local_mask, scale=scale
68
+ )
69
+ output[:, :, q_start:q_end, :] = out_chunk
70
+
71
+ output = rearrange_out(output, out_pattern, required_out_pattern, dims)
72
+ return output
73
+
74
+
75
+ register_attention_implementation(
76
+ "torch",
77
+ torch_sdpa,
78
+ supports_window=True,
79
+ supports_causal=True,
80
+ supports_mask=True,
81
+ supports_gqa=True,
82
+ )
@@ -0,0 +1,22 @@
1
+ from .common import rearrange_qkv, rearrange_out
2
+ from .registry import register_attention_implementation
3
+
4
+ try:
5
+ import xformers.ops as xops
6
+ XFORMERS_AVAILABLE = True
7
+ except Exception:
8
+ XFORMERS_AVAILABLE = False
9
+
10
+
11
+ def xformers_attention(q, k, v, q_pattern="b n s d", k_pattern="b n s d", v_pattern="b n s d", out_pattern="b n s d", dims=None, scale=None):
12
+ if not XFORMERS_AVAILABLE:
13
+ raise RuntimeError("xformers is not available.")
14
+ required_in_pattern, required_out_pattern = "b s n d", "b s n d"
15
+ q, k, v = rearrange_qkv(q, k, v, q_pattern, k_pattern, v_pattern, required_in_pattern, dims)
16
+ out = xops.memory_efficient_attention(q, k, v, scale=scale)
17
+ out = rearrange_out(out, out_pattern, required_out_pattern, dims)
18
+ return out
19
+
20
+
21
+ if XFORMERS_AVAILABLE:
22
+ register_attention_implementation("xformers", xformers_attention)