diffsynth 2.1.6__tar.gz → 2.1.7__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 (284) hide show
  1. {diffsynth-2.1.6 → diffsynth-2.1.7}/PKG-INFO +5 -1
  2. {diffsynth-2.1.6 → diffsynth-2.1.7}/README.md +2 -0
  3. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/configs/model_configs.py +14 -1
  4. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/configs/vram_management_module_maps.py +23 -2
  5. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/data/operators.py +45 -0
  6. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/flow_match.py +1 -0
  7. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/runner.py +22 -0
  8. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/template.py +4 -3
  9. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_conditioner.py +6 -0
  10. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_vae.py +7 -7
  11. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/demucs.py +3 -1
  12. diffsynth-2.1.7/diffsynth/models/diffsynth_music_dit.py +237 -0
  13. diffsynth-2.1.7/diffsynth/pipelines/diffsynth_music.py +353 -0
  14. diffsynth-2.1.7/diffsynth/utils/controlnet/annotator.py +71 -0
  15. diffsynth-2.1.7/diffsynth/utils/music_tools/__init__.py +2 -0
  16. diffsynth-2.1.7/diffsynth/utils/music_tools/click.py +17 -0
  17. diffsynth-2.1.7/diffsynth/utils/music_tools/prosody.py +60 -0
  18. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/version.py +1 -1
  19. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth.egg-info/PKG-INFO +5 -1
  20. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth.egg-info/SOURCES.txt +5 -0
  21. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth.egg-info/requires.txt +3 -0
  22. {diffsynth-2.1.6 → diffsynth-2.1.7}/pyproject.toml +3 -0
  23. diffsynth-2.1.6/diffsynth/utils/controlnet/annotator.py +0 -63
  24. {diffsynth-2.1.6 → diffsynth-2.1.7}/LICENSE +0 -0
  25. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/__init__.py +0 -0
  26. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/configs/__init__.py +0 -0
  27. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/__init__.py +0 -0
  28. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/attention/__init__.py +0 -0
  29. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/attention/attention.py +0 -0
  30. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/data/__init__.py +0 -0
  31. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/data/unified_dataset.py +0 -0
  32. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/device/__init__.py +0 -0
  33. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/device/npu_compatible_device.py +0 -0
  34. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/gradient/__init__.py +0 -0
  35. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/gradient/gradient_checkpoint.py +0 -0
  36. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/loader/__init__.py +0 -0
  37. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/loader/config.py +0 -0
  38. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/loader/file.py +0 -0
  39. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/loader/model.py +0 -0
  40. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/npu_patch/npu_fused_operator.py +0 -0
  41. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/offload_training/__init__.py +0 -0
  42. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/offload_training/manager.py +0 -0
  43. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/offload_training/memory_buffer.py +0 -0
  44. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/offload_training/offloader.py +0 -0
  45. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/__init__.py +0 -0
  46. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/backends/__init__.py +0 -0
  47. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/backends/bitsandbytes.py +0 -0
  48. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/backends/comfy_kitchen.py +0 -0
  49. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/backends/torchao.py +0 -0
  50. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/base.py +0 -0
  51. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/quant/config.py +0 -0
  52. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/vram/__init__.py +0 -0
  53. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/vram/disk_map.py +0 -0
  54. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/vram/initialization.py +0 -0
  55. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/core/vram/layers.py +0 -0
  56. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/__init__.py +0 -0
  57. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/base_pipeline.py +0 -0
  58. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/ddim_scheduler.py +0 -0
  59. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/dmd2.py +0 -0
  60. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/logger.py +0 -0
  61. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/loss.py +0 -0
  62. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/parsers.py +0 -0
  63. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/diffusion/training_module.py +0 -0
  64. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/__init__.py +0 -0
  65. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/aesthetic.py +0 -0
  66. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/base.py +0 -0
  67. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/bioclip.py +0 -0
  68. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/clip.py +0 -0
  69. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/fid.py +0 -0
  70. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/hpsv2.py +0 -0
  71. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/hpsv3.py +0 -0
  72. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/image_reward.py +0 -0
  73. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/lpips.py +0 -0
  74. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/pickscore.py +0 -0
  75. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/qwen_image_bench.py +0 -0
  76. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/unified_reward_2.py +0 -0
  77. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/metrics/unified_reward_edit.py +0 -0
  78. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_dit.py +0 -0
  79. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_residual_fsq.py +0 -0
  80. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_text_encoder.py +0 -0
  81. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ace_step_tokenizer.py +0 -0
  82. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/aesthetic.py +0 -0
  83. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/anima_dit.py +0 -0
  84. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/bioclip.py +0 -0
  85. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/boogu_image_dit.py +0 -0
  86. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/clip.py +0 -0
  87. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/dinov3_image_encoder.py +0 -0
  88. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ernie_image_dit.py +0 -0
  89. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ernie_image_text_encoder.py +0 -0
  90. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/fid.py +0 -0
  91. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux2_dit.py +0 -0
  92. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux2_text_encoder.py +0 -0
  93. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux2_vae.py +0 -0
  94. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_controlnet.py +0 -0
  95. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_dit.py +0 -0
  96. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_infiniteyou.py +0 -0
  97. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_ipadapter.py +0 -0
  98. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_lora_encoder.py +0 -0
  99. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_lora_patcher.py +0 -0
  100. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_redux.py +0 -0
  101. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_text_encoder_clip.py +0 -0
  102. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_text_encoder_t5.py +0 -0
  103. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_vae.py +0 -0
  104. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/flux_value_control.py +0 -0
  105. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/general_modules.py +0 -0
  106. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/hidream_common.py +0 -0
  107. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/hidream_o1_image_dit.py +0 -0
  108. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/hpsv2.py +0 -0
  109. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/hpsv3.py +0 -0
  110. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ideogram4_dit.py +0 -0
  111. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ideogram4_text_encoder.py +0 -0
  112. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ideogram4_vae.py +0 -0
  113. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/image_reward.py +0 -0
  114. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/joyai_image_dit.py +0 -0
  115. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/joyai_image_text_encoder.py +0 -0
  116. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/krea2_dit.py +0 -0
  117. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/krea2_text_encoder.py +0 -0
  118. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/lingbot_video_dit.py +0 -0
  119. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/longcat_video_dit.py +0 -0
  120. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/lpips.py +0 -0
  121. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_audio_vae.py +0 -0
  122. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_common.py +0 -0
  123. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_dit.py +0 -0
  124. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_text_encoder.py +0 -0
  125. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_upsampler.py +0 -0
  126. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/ltx2_video_vae.py +0 -0
  127. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_audio_vae.py +0 -0
  128. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_controlnet.py +0 -0
  129. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_dit.py +0 -0
  130. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_dit_comfy.py +0 -0
  131. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_text_encoder.py +0 -0
  132. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_h3_video_vae.py +0 -0
  133. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_music3_condition_encoder.py +0 -0
  134. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_music3_dit.py +0 -0
  135. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_music3_rvq_depth_decoder.py +0 -0
  136. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_music3_text_encoder.py +0 -0
  137. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/minimax_music3_vocoder.py +0 -0
  138. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/model_loader.py +0 -0
  139. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/mova_audio_dit.py +0 -0
  140. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/mova_audio_vae.py +0 -0
  141. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/mova_dual_tower_bridge.py +0 -0
  142. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/nexus_gen.py +0 -0
  143. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/nexus_gen_ar_model.py +0 -0
  144. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/nexus_gen_projector.py +0 -0
  145. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/pickscore.py +0 -0
  146. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_bench.py +0 -0
  147. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_controlnet.py +0 -0
  148. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_dit.py +0 -0
  149. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_image2lora.py +0 -0
  150. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_text_encoder.py +0 -0
  151. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_image_vae.py +0 -0
  152. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/qwen_video_edit_dit.py +0 -0
  153. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/sd_text_encoder.py +0 -0
  154. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/sensenova_u1_common.py +0 -0
  155. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/sensenova_u1_dit.py +0 -0
  156. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/siglip2_image_encoder.py +0 -0
  157. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/stable_diffusion_text_encoder.py +0 -0
  158. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/stable_diffusion_unet.py +0 -0
  159. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/stable_diffusion_vae.py +0 -0
  160. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/stable_diffusion_xl_text_encoder.py +0 -0
  161. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/stable_diffusion_xl_unet.py +0 -0
  162. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/step1x_connector.py +0 -0
  163. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/step1x_text_encoder.py +0 -0
  164. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/unified_reward_2.py +0 -0
  165. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/unified_reward_edit.py +0 -0
  166. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_animate_2_dit.py +0 -0
  167. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_animate_adapter.py +0 -0
  168. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_camera_controller.py +0 -0
  169. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_dit.py +0 -0
  170. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_dit_s2v.py +0 -0
  171. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_image_encoder.py +0 -0
  172. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_mot.py +0 -0
  173. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_motion_controller.py +0 -0
  174. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_text_encoder.py +0 -0
  175. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_vace.py +0 -0
  176. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wan_video_vae.py +0 -0
  177. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wantodance.py +0 -0
  178. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/wav2vec.py +0 -0
  179. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/z_image_controlnet.py +0 -0
  180. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/z_image_dit.py +0 -0
  181. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/z_image_image2lora.py +0 -0
  182. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/models/z_image_text_encoder.py +0 -0
  183. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/ace_step.py +0 -0
  184. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/anima_image.py +0 -0
  185. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/boogu_image.py +0 -0
  186. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/ernie_image.py +0 -0
  187. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/flux2_image.py +0 -0
  188. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/flux_image.py +0 -0
  189. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/hidream_o1_image.py +0 -0
  190. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/ideogram4.py +0 -0
  191. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/joyai_image.py +0 -0
  192. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/krea2.py +0 -0
  193. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/lingbot_video.py +0 -0
  194. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/ltx2_audio_video.py +0 -0
  195. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/minimax_h3_audio_video.py +0 -0
  196. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/minimax_music3.py +0 -0
  197. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/mova_audio_video.py +0 -0
  198. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/qwen_image.py +0 -0
  199. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/qwen_video_edit.py +0 -0
  200. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/sensenova_u1_image.py +0 -0
  201. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/stable_diffusion.py +0 -0
  202. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/stable_diffusion_xl.py +0 -0
  203. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/wan_video.py +0 -0
  204. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/pipelines/z_image.py +0 -0
  205. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/controlnet/__init__.py +0 -0
  206. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/controlnet/controlnet_input.py +0 -0
  207. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/data/__init__.py +0 -0
  208. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/data/audio.py +0 -0
  209. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/data/audio_video.py +0 -0
  210. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/data/media_io_ltx2.py +0 -0
  211. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/data/minimax_h3.py +0 -0
  212. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/demucs/__init__.py +0 -0
  213. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/dequantizer/__init__.py +0 -0
  214. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/__init__.py +0 -0
  215. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/flux.py +0 -0
  216. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/flux_timestep.py +0 -0
  217. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/general.py +0 -0
  218. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/krea2.py +0 -0
  219. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/merge.py +0 -0
  220. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/minimax_h3.py +0 -0
  221. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/reset_rank.py +0 -0
  222. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/lora/sdxl.py +0 -0
  223. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/quant/serialization.py +0 -0
  224. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/ses/__init__.py +0 -0
  225. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/ses/ses.py +0 -0
  226. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/__init__.py +0 -0
  227. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ace_step_conditioner.py +0 -0
  228. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ace_step_dit.py +0 -0
  229. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ace_step_text_encoder.py +0 -0
  230. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ace_step_tokenizer.py +0 -0
  231. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/anima_dit.py +0 -0
  232. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/dino_v3.py +0 -0
  233. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ernie_image_text_encoder.py +0 -0
  234. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux2_text_encoder.py +0 -0
  235. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_controlnet.py +0 -0
  236. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_dit.py +0 -0
  237. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_infiniteyou.py +0 -0
  238. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_ipadapter.py +0 -0
  239. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_text_encoder_clip.py +0 -0
  240. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_text_encoder_t5.py +0 -0
  241. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/flux_vae.py +0 -0
  242. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ideogram4_text_encoder.py +0 -0
  243. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/image_metrics.py +0 -0
  244. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/joyai_image_text_encoder.py +0 -0
  245. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/krea2_dit.py +0 -0
  246. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/krea2_text_encoder.py +0 -0
  247. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/lingbot_video_dit.py +0 -0
  248. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ltx2_audio_vae.py +0 -0
  249. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ltx2_dit.py +0 -0
  250. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ltx2_text_encoder.py +0 -0
  251. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/ltx2_video_vae.py +0 -0
  252. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/minimax_h3_audio_vae.py +0 -0
  253. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/minimax_h3_controlnet.py +0 -0
  254. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/minimax_h3_text_encoder.py +0 -0
  255. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/minimax_h3_video_vae.py +0 -0
  256. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/minimax_music3_text_encoder.py +0 -0
  257. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/nexus_gen.py +0 -0
  258. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/nexus_gen_projector.py +0 -0
  259. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/qwen_image_text_encoder.py +0 -0
  260. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/qwen_video_edit.py +0 -0
  261. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/sdxl.py +0 -0
  262. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/sdxl_text_encoder.py +0 -0
  263. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/sdxl_text_encoder_2.py +0 -0
  264. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/sdxl_vae.py +0 -0
  265. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/stable_diffusion_text_encoder.py +0 -0
  266. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/stable_diffusion_vae.py +0 -0
  267. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/stable_diffusion_xl_text_encoder.py +0 -0
  268. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/step1x_connector.py +0 -0
  269. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_animate_adapter.py +0 -0
  270. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_dit.py +0 -0
  271. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_image_encoder.py +0 -0
  272. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_mot.py +0 -0
  273. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_vace.py +0 -0
  274. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wan_video_vae.py +0 -0
  275. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/wans2v_audio_encoder.py +0 -0
  276. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/z_image_dit.py +0 -0
  277. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/state_dict_converters/z_image_text_encoder.py +0 -0
  278. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/tile/__init__.py +0 -0
  279. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/tile/tile_worker.py +0 -0
  280. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/xfuser/__init__.py +0 -0
  281. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth/utils/xfuser/xdit_context_parallel.py +0 -0
  282. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth.egg-info/dependency_links.txt +0 -0
  283. {diffsynth-2.1.6 → diffsynth-2.1.7}/diffsynth.egg-info/top_level.txt +0 -0
  284. {diffsynth-2.1.6 → diffsynth-2.1.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diffsynth
3
- Version: 2.1.6
3
+ Version: 2.1.7
4
4
  Summary: Enjoy the magic of Diffusion models!
5
5
  Author: ModelScope Team
6
6
  License-Expression: Apache-2.0
@@ -43,6 +43,8 @@ Provides-Extra: npu-aarch64
43
43
  Requires-Dist: torch==2.7.1; extra == "npu-aarch64"
44
44
  Requires-Dist: torch-npu==2.7.1; extra == "npu-aarch64"
45
45
  Requires-Dist: torchvision==0.22.1; extra == "npu-aarch64"
46
+ Provides-Extra: controlnet
47
+ Requires-Dist: controlnet_aux; extra == "controlnet"
46
48
  Provides-Extra: infiniteyou
47
49
  Requires-Dist: insightface; extra == "infiniteyou"
48
50
  Requires-Dist: facexlib; extra == "infiniteyou"
@@ -397,6 +399,7 @@ Model overview:
397
399
  - LTX-2: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/LTX-2.html), [Example code](/examples/ltx2/)
398
400
  - Wan: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Wan.html), [Example code](/examples/wanvideo/)
399
401
  - Audio generation
402
+ - DiffSynth-Music: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/DiffSynth-Music.html), [Example code](/examples/diffsynth_music/)
400
403
  - MiniMax-Music3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MiniMax-Music3.html), [Example code](/examples/minimax_music3/)
401
404
  - ACE-Step: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/ACE-Step.html), [Example code](/examples/ace_step/)
402
405
  - Evaluation models: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Image-Quality-Metrics.html), [Example code](/examples/image_quality_metric/)
@@ -651,6 +654,7 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
651
654
  | SenseNova-U1 | [SenseNova/SenseNova-U1.5-8B-MoT-SFT: T2I](https://www.modelscope.cn/models/SenseNova/SenseNova-U1.5-8B-MoT-SFT) | [code](/examples/sensenova_u1/model_inference/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_inference_low_vram/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_training/full/SenseNova-U1.5-8B-MoT-SFT.sh) | [code](/examples/sensenova_u1/model_training/validate_full/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_training/lora/SenseNova-U1.5-8B-MoT-SFT.sh) | [code](/examples/sensenova_u1/model_training/validate_lora/SenseNova-U1.5-8B-MoT-SFT.py) |
652
655
  | SenseNova-U1 | [SenseNova/SenseNova-U1.5-8B-MoT-SFT: Edit](https://www.modelscope.cn/models/SenseNova/SenseNova-U1.5-8B-MoT-SFT) | [code](/examples/sensenova_u1/model_inference/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_inference_low_vram/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_training/full/SenseNova-U1.5-8B-MoT-SFT-Edit.sh) | [code](/examples/sensenova_u1/model_training/validate_full/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_training/lora/SenseNova-U1.5-8B-MoT-SFT-Edit.sh) | [code](/examples/sensenova_u1/model_training/validate_lora/SenseNova-U1.5-8B-MoT-SFT-Edit.py) |
653
656
  | MiniMax-Music3 | [MiniMax/MiniMax-Music3](https://www.modelscope.cn/models/MiniMax/MiniMax-Music3) | [code](/examples/minimax_music3/model_inference/MiniMax-Music3.py) | [code](/examples/minimax_music3/model_inference_low_vram/MiniMax-Music3.py) | — | — | — | — |
657
+ | DiffSynth-Music | [DiffSynth-Studio/DiffSynth-Music](https://www.modelscope.cn/models/DiffSynth-Studio/DiffSynth-Music) | [code](/examples/diffsynth_music/model_inference/DiffSynth-Music.py) | [code](/examples/diffsynth_music/model_inference_low_vram/DiffSynth-Music.py) | [code](/examples/diffsynth_music/model_training/full/DiffSynth-Music.sh) | [code](/examples/diffsynth_music/model_training/validate_full/DiffSynth-Music.py) | - | - |
654
658
  | MiniMax-H3 | [MiniMax/MiniMax-H3: FL2VA](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_training/full/MiniMax-H3-FL2VA.sh) | [code](/examples/minimax_h3/model_training/validate_full/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_training/lora/MiniMax-H3-FL2VA.sh) | [code](/examples/minimax_h3/model_training/validate_lora/MiniMax-H3-FL2VA.py) |
655
659
  | MiniMax-H3 | [MiniMax/MiniMax-H3: Ref2VA](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_training/full/MiniMax-H3-Ref2VA.sh) | [code](/examples/minimax_h3/model_training/validate_full/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_training/lora/MiniMax-H3-Ref2VA.sh) | [code](/examples/minimax_h3/model_training/validate_lora/MiniMax-H3-Ref2VA.py) |
656
660
  | MiniMax-H3 | [MiniMax/MiniMax-H3: Retake](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-Retake.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-Retake.py) | - | - | - | - |
@@ -330,6 +330,7 @@ Model overview:
330
330
  - LTX-2: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/LTX-2.html), [Example code](/examples/ltx2/)
331
331
  - Wan: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Wan.html), [Example code](/examples/wanvideo/)
332
332
  - Audio generation
333
+ - DiffSynth-Music: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/DiffSynth-Music.html), [Example code](/examples/diffsynth_music/)
333
334
  - MiniMax-Music3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MiniMax-Music3.html), [Example code](/examples/minimax_music3/)
334
335
  - ACE-Step: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/ACE-Step.html), [Example code](/examples/ace_step/)
335
336
  - Evaluation models: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Image-Quality-Metrics.html), [Example code](/examples/image_quality_metric/)
@@ -584,6 +585,7 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
584
585
  | SenseNova-U1 | [SenseNova/SenseNova-U1.5-8B-MoT-SFT: T2I](https://www.modelscope.cn/models/SenseNova/SenseNova-U1.5-8B-MoT-SFT) | [code](/examples/sensenova_u1/model_inference/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_inference_low_vram/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_training/full/SenseNova-U1.5-8B-MoT-SFT.sh) | [code](/examples/sensenova_u1/model_training/validate_full/SenseNova-U1.5-8B-MoT-SFT.py) | [code](/examples/sensenova_u1/model_training/lora/SenseNova-U1.5-8B-MoT-SFT.sh) | [code](/examples/sensenova_u1/model_training/validate_lora/SenseNova-U1.5-8B-MoT-SFT.py) |
585
586
  | SenseNova-U1 | [SenseNova/SenseNova-U1.5-8B-MoT-SFT: Edit](https://www.modelscope.cn/models/SenseNova/SenseNova-U1.5-8B-MoT-SFT) | [code](/examples/sensenova_u1/model_inference/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_inference_low_vram/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_training/full/SenseNova-U1.5-8B-MoT-SFT-Edit.sh) | [code](/examples/sensenova_u1/model_training/validate_full/SenseNova-U1.5-8B-MoT-SFT-Edit.py) | [code](/examples/sensenova_u1/model_training/lora/SenseNova-U1.5-8B-MoT-SFT-Edit.sh) | [code](/examples/sensenova_u1/model_training/validate_lora/SenseNova-U1.5-8B-MoT-SFT-Edit.py) |
586
587
  | MiniMax-Music3 | [MiniMax/MiniMax-Music3](https://www.modelscope.cn/models/MiniMax/MiniMax-Music3) | [code](/examples/minimax_music3/model_inference/MiniMax-Music3.py) | [code](/examples/minimax_music3/model_inference_low_vram/MiniMax-Music3.py) | — | — | — | — |
588
+ | DiffSynth-Music | [DiffSynth-Studio/DiffSynth-Music](https://www.modelscope.cn/models/DiffSynth-Studio/DiffSynth-Music) | [code](/examples/diffsynth_music/model_inference/DiffSynth-Music.py) | [code](/examples/diffsynth_music/model_inference_low_vram/DiffSynth-Music.py) | [code](/examples/diffsynth_music/model_training/full/DiffSynth-Music.sh) | [code](/examples/diffsynth_music/model_training/validate_full/DiffSynth-Music.py) | - | - |
587
589
  | MiniMax-H3 | [MiniMax/MiniMax-H3: FL2VA](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_training/full/MiniMax-H3-FL2VA.sh) | [code](/examples/minimax_h3/model_training/validate_full/MiniMax-H3-FL2VA.py) | [code](/examples/minimax_h3/model_training/lora/MiniMax-H3-FL2VA.sh) | [code](/examples/minimax_h3/model_training/validate_lora/MiniMax-H3-FL2VA.py) |
588
590
  | MiniMax-H3 | [MiniMax/MiniMax-H3: Ref2VA](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_training/full/MiniMax-H3-Ref2VA.sh) | [code](/examples/minimax_h3/model_training/validate_full/MiniMax-H3-Ref2VA.py) | [code](/examples/minimax_h3/model_training/lora/MiniMax-H3-Ref2VA.sh) | [code](/examples/minimax_h3/model_training/validate_lora/MiniMax-H3-Ref2VA.py) |
589
591
  | MiniMax-H3 | [MiniMax/MiniMax-H3: Retake](https://www.modelscope.cn/models/MiniMax/MiniMax-H3) | [code](/examples/minimax_h3/model_inference/MiniMax-H3-Retake.py) | [code](/examples/minimax_h3/model_inference_low_vram/MiniMax-H3-Retake.py) | - | - | - | - |
@@ -1202,11 +1202,24 @@ ace_step_series = [
1202
1202
  "state_dict_converter": "diffsynth.utils.state_dict_converters.ace_step_tokenizer.AceStepTokenizerStateDictConverter",
1203
1203
  },
1204
1204
  {
1205
- # Example: ???
1205
+ # Example: ModelConfig(model_id="DiffSynth-Studio/DiffSynth-Music-Tools", origin_file_pattern="track_separator/model.safetensors")
1206
1206
  "model_hash": "ff74b1806e6a0b52e7bbd1d3df2d26d1",
1207
1207
  "model_name": "demucs",
1208
1208
  "model_class": "diffsynth.models.demucs.HTDemucs",
1209
1209
  },
1210
+ {
1211
+ # Example: ModelConfig(model_id="DiffSynth-Studio/DiffSynth-Music-Tools", origin_file_pattern="transformer/model.safetensors")
1212
+ "model_hash": "167b8d453605e3d72076f88790528f8e",
1213
+ "model_name": "diffsynth_music_dit",
1214
+ "model_class": "diffsynth.models.diffsynth_music_dit.DiffSynthMusicDiTModel",
1215
+ },
1216
+ {
1217
+ # Example: ModelConfig(model_id="DiffSynth-Studio/DiffSynth-Music-Tools", origin_file_pattern="conditioner/model.safetensors")
1218
+ "model_hash": "d6c90aec3f282bde16298e0221413098",
1219
+ "model_name": "ace_step_conditioner",
1220
+ "model_class": "diffsynth.models.ace_step_conditioner.AceStepConditionEncoder",
1221
+ "extra_kwargs": {"placeholder_shape": (1, 15000, 64)},
1222
+ },
1210
1223
  ]
1211
1224
 
1212
1225
  image_metrics_series = [
@@ -80,7 +80,7 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
80
80
  "torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
81
81
  "diffsynth.models.qwen_image_vae.QwenImageRMS_norm": "diffsynth.core.vram.layers.AutoWrappedModule",
82
82
  },
83
- "diffsynth.models.qwen_image_controlnet.BlockWiseControlBlock": {
83
+ "diffsynth.models.qwen_image_controlnet.QwenImageBlockWiseControlNet": {
84
84
  "diffsynth.models.qwen_image_dit.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
85
85
  "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
86
86
  },
@@ -339,7 +339,7 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
339
339
  "torch.nn.Embedding": "diffsynth.core.vram.layers.AutoWrappedModule",
340
340
  "transformers.models.ministral3.modeling_ministral3.Ministral3RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
341
341
  },
342
- "diffsynth.models.joyai_image_dit.Transformer3DModel": {
342
+ "diffsynth.models.joyai_image_dit.JoyAIImageDiT": {
343
343
  "diffsynth.models.joyai_image_dit.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
344
344
  "diffsynth.models.joyai_image_dit.ModulateWan": "diffsynth.core.vram.layers.AutoWrappedModule",
345
345
  "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
@@ -512,6 +512,27 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
512
512
  "torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
513
513
  "diffsynth.models.sensenova_u1_dit.SenseNovaU1RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
514
514
  },
515
+ "diffsynth.models.diffsynth_music_dit.DiffSynthMusicDiTModel": {
516
+ "diffsynth.models.diffsynth_music_dit.DiffSynthMusicDiTLayer": "diffsynth.core.vram.layers.AutoWrappedNonRecurseModule",
517
+ "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
518
+ "torch.nn.Conv1d": "diffsynth.core.vram.layers.AutoWrappedModule",
519
+ "torch.nn.ConvTranspose1d": "diffsynth.core.vram.layers.AutoWrappedModule",
520
+ "torch.nn.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
521
+ "transformers.models.qwen3.modeling_qwen3.Qwen3RotaryEmbedding": "diffsynth.core.vram.layers.AutoWrappedModule",
522
+ },
523
+ "diffsynth.models.demucs.HTDemucs": {
524
+ "torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
525
+ "torch.nn.Conv1d": "diffsynth.core.vram.layers.AutoWrappedModule",
526
+ "torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
527
+ "torch.nn.ConvTranspose1d": "diffsynth.core.vram.layers.AutoWrappedModule",
528
+ "torch.nn.ConvTranspose2d": "diffsynth.core.vram.layers.AutoWrappedModule",
529
+ "torch.nn.GroupNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
530
+ "torch.nn.LayerNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
531
+ "torch.nn.TransformerEncoderLayer": "diffsynth.core.vram.layers.AutoWrappedModule",
532
+ "diffsynth.models.demucs.ScaledEmbedding": "diffsynth.core.vram.layers.AutoWrappedModule",
533
+ "diffsynth.models.demucs.LayerScale": "diffsynth.core.vram.layers.AutoWrappedModule",
534
+ "torch.nn.MultiheadAttention": "diffsynth.core.vram.layers.AutoWrappedModule",
535
+ },
515
536
  }
516
537
 
517
538
  def QwenImageTextEncoder_Module_Map_Updater():
@@ -339,3 +339,48 @@ class LoadPureAudioWithTorchaudio(DataProcessingOperator):
339
339
  except Exception as e:
340
340
  print(f"Cannot load audio in {data} due to {e}. The audio will be `None`.")
341
341
  return None
342
+
343
+
344
+ class LoadMultiTrackAudio(DataProcessingOperator):
345
+ def __init__(self, target_sample_rate=48000, max_audio_duration=None, division_factor=1):
346
+ self.target_sample_rate = target_sample_rate
347
+ self.max_audio_duration = max_audio_duration
348
+ self.division_factor = division_factor
349
+ import torchaudio
350
+ self.audio_loader = torchaudio.load
351
+ self.audio_resampler = torchaudio.functional.resample
352
+
353
+ def load_audio(self, path):
354
+ waveform, sample_rate = self.audio_loader(path)
355
+ if len(waveform.shape) == 2 and waveform.shape[0] == 1:
356
+ waveform = repeat(waveform, "c l -> (n c) l", n=2)
357
+ if self.target_sample_rate is not None and sample_rate != self.target_sample_rate:
358
+ waveform = self.audio_resampler(waveform, sample_rate, self.target_sample_rate)
359
+ sample_rate = self.target_sample_rate
360
+ if self.max_audio_duration is not None and waveform.shape[1] > sample_rate * self.max_audio_duration:
361
+ waveform = waveform[:, :int(sample_rate * self.max_audio_duration)]
362
+ return waveform
363
+
364
+ def load_latents(self, path):
365
+ latents = torch.load(path, weights_only=True, map_location="cpu")
366
+ return latents
367
+
368
+ def load_single_data(self, path):
369
+ if path is None:
370
+ return None
371
+ elif path.endswith(".pth"):
372
+ return self.load_latents(path)
373
+ else:
374
+ return self.load_audio(path)
375
+
376
+ def __call__(self, data):
377
+ if isinstance(data, str):
378
+ return self.load_single_data(data)
379
+ else:
380
+ audio = {}
381
+ for name, path in data.items():
382
+ audio[name] = self.load_single_data(path)
383
+ min_length = min([audio[name].shape[1] for name in audio if audio[name] is not None])
384
+ min_length = min_length // self.division_factor * self.division_factor
385
+ audio = {name: audio[name][:, :min_length] for name in audio}
386
+ return audio
@@ -208,6 +208,7 @@ class FlowMatchScheduler():
208
208
  for timestep in target_timesteps:
209
209
  timestep_id = torch.argmin((timesteps - timestep).abs())
210
210
  timesteps[timestep_id] = timestep
211
+ sigmas[timestep_id] = timestep / num_train_timesteps
211
212
  return sigmas, timesteps
212
213
 
213
214
  @staticmethod
@@ -30,6 +30,26 @@ def save_training_args(args):
30
30
  print(f"Warning: failed to save training arguments: {e}")
31
31
 
32
32
 
33
+ def exclude_quantized_params_from_ddp_sync(accelerator: Accelerator, model: DiffusionTrainingModule):
34
+ """DDP broadcasts every parameter when it is constructed, but a quantized weight backed by a
35
+ tensor subclass cannot be flattened into a broadcast bucket. Such weights are frozen and every
36
+ rank loads them from the same checkpoint, so let DDP skip them."""
37
+ try:
38
+ from torch.utils._python_dispatch import is_traceable_wrapper_subclass
39
+ quant_configs = [module.quantize_config for module in model.modules() if getattr(module, "quantize_config", None) is not None]
40
+ ignored = [
41
+ f"{name}.weight" for name, module in model.named_modules()
42
+ if any(quantize.is_quantized_linear(module) for quantize in quant_configs)
43
+ and not module.weight.requires_grad and is_traceable_wrapper_subclass(module.weight)
44
+ ]
45
+ if len(ignored) > 0:
46
+ model._ddp_params_and_buffers_to_ignore = ignored
47
+ if accelerator.is_main_process:
48
+ print(f"{len(ignored)} quantized weights are excluded from DDP state synchronization.")
49
+ except Exception as e:
50
+ print(f"Warning: failed to exclude quantized weights from DDP state synchronization: {e}")
51
+
52
+
33
53
  def launch_training_task(
34
54
  accelerator: Accelerator,
35
55
  dataset: torch.utils.data.Dataset,
@@ -72,6 +92,7 @@ def launch_training_task(
72
92
  offload_manager = OffloadTrainingManager(model, accelerator.device, enable_optimizer_cpu_offload, cpu_offload_split_threshold)
73
93
  else:
74
94
  model.to(device=accelerator.device)
95
+ exclude_quantized_params_from_ddp_sync(accelerator, model)
75
96
  model, optimizer, dataloader, scheduler = accelerator.prepare(model, optimizer, dataloader, scheduler)
76
97
 
77
98
  initialize_deepspeed_gradient_checkpointing(accelerator)
@@ -117,6 +138,7 @@ def launch_data_process_task(
117
138
  model.pipe.device = accelerator.device
118
139
  else:
119
140
  model.to(device=accelerator.device)
141
+ exclude_quantized_params_from_ddp_sync(accelerator, model)
120
142
  model, dataloader = accelerator.prepare(model, dataloader)
121
143
 
122
144
  for data_id, data in enumerate(tqdm(dataloader)):
@@ -31,7 +31,7 @@ def check_template_model_format(model):
31
31
  raise NotImplementedError("`**kwargs` is not included in `forward`.")
32
32
 
33
33
 
34
- def load_template_model(path, torch_dtype=torch.bfloat16, device="cuda", verbose=1):
34
+ def load_template_model(path, torch_dtype=torch.bfloat16, device="cuda", verbose=1, state_dict=None):
35
35
  spec = importlib.util.spec_from_file_location("template_model", os.path.join(path, "model.py"))
36
36
  module = importlib.util.module_from_spec(spec)
37
37
  spec.loader.exec_module(module)
@@ -44,6 +44,7 @@ def load_template_model(path, torch_dtype=torch.bfloat16, device="cuda", verbose
44
44
  path=os.path.join(path, getattr(module, 'TEMPLATE_MODEL_PATH')),
45
45
  torch_dtype=torch_dtype,
46
46
  device=device,
47
+ state_dict=state_dict,
47
48
  )
48
49
  else:
49
50
  # Without `TEMPLATE_MODEL_PATH`, a randomly initialized model or a non-model module will be loaded.
@@ -97,7 +98,7 @@ class TemplatePipeline(torch.nn.Module):
97
98
  for model_config in model_configs:
98
99
  TemplatePipeline.check_vram_config(model_config)
99
100
  model_config.download_if_necessary()
100
- model = load_template_model(model_config.path, torch_dtype=torch_dtype, device=device)
101
+ model = load_template_model(model_config.path, torch_dtype=torch_dtype, device=device, state_dict=model_config.state_dict)
101
102
  models.append(model)
102
103
  self.models = torch.nn.ModuleList(models)
103
104
 
@@ -164,7 +165,7 @@ class TemplatePipeline(torch.nn.Module):
164
165
  if self.lazy_loading:
165
166
  model_config = self.model_configs[model_id]
166
167
  model_config.download_if_necessary()
167
- model = load_template_model(model_config.path, torch_dtype=self.torch_dtype, device=self.device)
168
+ model = load_template_model(model_config.path, torch_dtype=self.torch_dtype, device=self.device, state_dict=model_config.state_dict)
168
169
  else:
169
170
  model = self.models[model_id]
170
171
  return model
@@ -585,6 +585,7 @@ class AceStepConditionEncoder(nn.Module):
585
585
  timbre_hidden_dim: int = 64,
586
586
  num_lyric_encoder_hidden_layers: int = 8,
587
587
  num_timbre_encoder_hidden_layers: int = 4,
588
+ placeholder_shape=None,
588
589
  **kwargs,
589
590
  ):
590
591
  super().__init__()
@@ -648,6 +649,8 @@ class AceStepConditionEncoder(nn.Module):
648
649
  timbre_hidden_dim=timbre_hidden_dim,
649
650
  num_timbre_encoder_hidden_layers=num_timbre_encoder_hidden_layers,
650
651
  )
652
+ if placeholder_shape is not None:
653
+ self.placeholder_audio = torch.nn.Parameter(torch.zeros(placeholder_shape))
651
654
 
652
655
  def forward(
653
656
  self,
@@ -658,6 +661,9 @@ class AceStepConditionEncoder(nn.Module):
658
661
  reference_latents: Optional[torch.Tensor] = None,
659
662
  refer_audio_order_mask: Optional[torch.LongTensor] = None,
660
663
  ):
664
+ if reference_latents is None:
665
+ reference_latents = self.placeholder_audio[:, :750, :].to(device=text_hidden_states.device, dtype=text_hidden_states.dtype)
666
+ refer_audio_order_mask = torch.tensor([0], device=text_hidden_states.device, dtype=torch.long)
661
667
  text_hidden_states = self.text_projector(text_hidden_states)
662
668
  lyric_encoder_outputs = self.lyric_encoder(
663
669
  inputs_embeds=lyric_hidden_states,
@@ -196,13 +196,13 @@ class OobleckDiagonalGaussianDistribution(object):
196
196
 
197
197
  def sample(self, generator: torch.Generator | None = None) -> torch.Tensor:
198
198
  # make sure sample is on the same device as the parameters and has same dtype
199
- sample = torch.randn(
200
- self.mean.shape,
201
- generator=generator,
202
- device=self.parameters.device,
203
- dtype=self.parameters.dtype,
204
- )
205
- x = self.mean + self.std * sample
199
+ # sample = torch.randn(
200
+ # self.mean.shape,
201
+ # generator=generator,
202
+ # device=self.parameters.device,
203
+ # dtype=self.parameters.dtype,
204
+ # )
205
+ x = self.mean
206
206
  return x
207
207
 
208
208
  def kl(self, other: "OobleckDiagonalGaussianDistribution" = None) -> torch.Tensor:
@@ -400,7 +400,9 @@ class HTDemucs(nn.Module):
400
400
  out = out * (ref.std() + 1e-8) + ref.mean()
401
401
  out = out / max(1.01 * out.abs().max(), 1)
402
402
  out = out.clamp_(-1, 1).cpu()
403
- out = out[self.sources.index(track)]
403
+ if not isinstance(track, list):
404
+ track = [track]
405
+ out = sum([out[self.sources.index(t)] for t in track], 0)
404
406
  return out
405
407
 
406
408
  def center_trim(tensor, length):
@@ -0,0 +1,237 @@
1
+ import math, torch
2
+ from ..core import gradient_checkpoint_forward
3
+ from ..core.attention.attention import attention_forward
4
+ from einops import rearrange
5
+ from transformers.models.qwen3.modeling_qwen3 import Qwen3RotaryEmbedding
6
+
7
+
8
+ class TimestepEmbedding(torch.nn.Module):
9
+ def __init__(self, in_channels, time_embed_dim, scale=1):
10
+ super().__init__()
11
+ self.linear_1 = torch.nn.Linear(in_channels, time_embed_dim, bias=True)
12
+ self.act1 = torch.nn.SiLU()
13
+ self.linear_2 = torch.nn.Linear(time_embed_dim, time_embed_dim, bias=True)
14
+ self.in_channels = in_channels
15
+ self.act2 = torch.nn.SiLU()
16
+ self.time_proj = torch.nn.Linear(time_embed_dim, time_embed_dim * 6)
17
+ self.scale = scale
18
+
19
+ def timestep_embedding(self, t, dim, max_period=10000):
20
+ t = t * self.scale
21
+ half = dim // 2
22
+ freqs = torch.exp(
23
+ -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
24
+ ).to(device=t.device)
25
+ args = t[:, None].float() * freqs[None]
26
+ embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
27
+ if dim % 2:
28
+ embedding = torch.cat([embedding, torch.zeros_like(embedding[:, :1])], dim=-1)
29
+ return embedding
30
+
31
+ def forward(self, t):
32
+ t_freq = self.timestep_embedding(t, self.in_channels)
33
+ temb = self.linear_1(t_freq.to(t.dtype))
34
+ temb = self.act1(temb)
35
+ temb = self.linear_2(temb)
36
+ timestep_proj = self.time_proj(self.act2(temb)).unflatten(1, (6, -1))
37
+ return temb, timestep_proj
38
+
39
+
40
+ class DiffSynthMusicTimestepEmbedding(torch.nn.Module):
41
+ def __init__(self, in_channels, time_embed_dim):
42
+ super().__init__()
43
+ self.time_embed = TimestepEmbedding(in_channels, time_embed_dim)
44
+ self.time_embed_r = TimestepEmbedding(in_channels, time_embed_dim)
45
+
46
+ def forward(self, timestep):
47
+ timestep_r = timestep
48
+ temb_t, timestep_proj_t = self.time_embed(timestep)
49
+ temb_r, timestep_proj_r = self.time_embed_r(timestep - timestep_r)
50
+ temb = temb_t + temb_r
51
+ timestep_proj = timestep_proj_t + timestep_proj_r
52
+ return temb, timestep_proj
53
+
54
+
55
+ class DiffSynthMusicAttention(torch.nn.Module):
56
+ def __init__(self, dim, num_heads_q, num_heads_kv, head_dim):
57
+ super().__init__()
58
+ self.head_dim = head_dim
59
+ self.q_proj = torch.nn.Linear(dim, num_heads_q * self.head_dim, bias=False)
60
+ self.k_proj = torch.nn.Linear(dim, num_heads_kv * self.head_dim, bias=False)
61
+ self.v_proj = torch.nn.Linear(dim, num_heads_kv * self.head_dim, bias=False)
62
+ self.o_proj = torch.nn.Linear(num_heads_q * self.head_dim, dim, bias=False)
63
+ self.q_norm = torch.nn.RMSNorm(self.head_dim, eps=1e-6)
64
+ self.k_norm = torch.nn.RMSNorm(self.head_dim, eps=1e-6)
65
+
66
+ def rotate_half(self, x):
67
+ x1 = x[..., : x.shape[-1] // 2]
68
+ x2 = x[..., x.shape[-1] // 2 :]
69
+ return torch.cat((-x2, x1), dim=-1)
70
+
71
+ def apply_rotary_pos_emb(self, q, k, cos, sin, unsqueeze_dim=2):
72
+ cos = cos.unsqueeze(unsqueeze_dim)
73
+ sin = sin.unsqueeze(unsqueeze_dim)
74
+ q_embed = (q * cos) + (self.rotate_half(q) * sin)
75
+ k_embed = (k * cos) + (self.rotate_half(k) * sin)
76
+ return q_embed, k_embed
77
+
78
+ def forward(self, x, y=None, window_size=None, pos_emb=None, return_kv=False, kv_cache=None) -> torch.Tensor:
79
+ q = self.q_proj(x)
80
+ q = rearrange(q, "b s (n d) -> b s n d", d=self.head_dim)
81
+ q = self.q_norm(q)
82
+
83
+ if y is None: y = x
84
+ k, v = self.k_proj(y), self.v_proj(y)
85
+ k, v = rearrange(k, "b s (n d) -> b s n d", d=self.head_dim), rearrange(v, "b s (n d) -> b s n d", d=self.head_dim)
86
+ k = self.k_norm(k)
87
+
88
+ if pos_emb is not None: q, k = self.apply_rotary_pos_emb(q, k, *pos_emb)
89
+ if kv_cache is not None:
90
+ k = torch.concat([k, kv_cache[0]], dim=1)
91
+ v = torch.concat([v, kv_cache[1]], dim=1)
92
+ attn_output = attention_forward(
93
+ q, k, v,
94
+ q_pattern="b s n d", k_pattern="b s n d", v_pattern="b s n d", out_pattern="b s (n d)",
95
+ window_size=window_size,
96
+ )
97
+ attn_output = self.o_proj(attn_output)
98
+ if return_kv:
99
+ return attn_output, (k, v)
100
+ else:
101
+ return attn_output
102
+
103
+
104
+ class MLP(torch.nn.Module):
105
+ def __init__(self, dim, dim_hidden):
106
+ super().__init__()
107
+ self.gate_proj = torch.nn.Linear(dim, dim_hidden, bias=False)
108
+ self.up_proj = torch.nn.Linear(dim, dim_hidden, bias=False)
109
+ self.down_proj = torch.nn.Linear(dim_hidden, dim, bias=False)
110
+ self.act_fn = torch.nn.SiLU()
111
+
112
+ def forward(self, x):
113
+ return self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
114
+
115
+
116
+ class DiffSynthMusicDiTLayer(torch.nn.Module):
117
+ def __init__(self, dim=2560, num_heads_q=32, num_heads_kv=8, head_dim=128, dim_mlp=9728, window_size=None):
118
+ super().__init__()
119
+ self.self_attn_norm = torch.nn.RMSNorm(dim, eps=1e-6)
120
+ self.self_attn = DiffSynthMusicAttention(dim=dim, num_heads_q=num_heads_q, num_heads_kv=num_heads_kv, head_dim=head_dim)
121
+ self.cross_attn_norm = torch.nn.RMSNorm(dim, eps=1e-6)
122
+ self.cross_attn = DiffSynthMusicAttention(dim=dim, num_heads_q=num_heads_q, num_heads_kv=num_heads_kv, head_dim=head_dim)
123
+ self.mlp_norm = torch.nn.RMSNorm(dim, eps=1e-6)
124
+ self.mlp = MLP(dim, dim_mlp)
125
+ self.scale_shift_table = torch.nn.Parameter(torch.randn(1, 6, dim) / dim**0.5)
126
+ self.window_size = window_size
127
+
128
+ def forward(self, x, y, pos_emb, temb, return_kv=False, kv_cache=None) -> torch.Tensor:
129
+ shift_msa, scale_msa, gate_msa, c_shift_msa, c_scale_msa, c_gate_msa = (self.scale_shift_table.to(dtype=x.dtype, device=x.device) + temb).chunk(6, dim=1)
130
+ x_hidden = self.self_attn_norm(x) * (1 + scale_msa) + shift_msa
131
+ x_hidden = self.self_attn(x=x_hidden, pos_emb=pos_emb, window_size=self.window_size, kv_cache=kv_cache, return_kv=return_kv)
132
+ if return_kv: x_hidden, kv = x_hidden
133
+ x = x + x_hidden * gate_msa
134
+ x_hidden = self.cross_attn_norm(x)
135
+ x_hidden = self.cross_attn(x=x_hidden, y=y)
136
+ x = x + x_hidden
137
+ x_hidden = self.mlp_norm(x) * (1 + c_scale_msa) + c_shift_msa
138
+ x_hidden = self.mlp(x_hidden)
139
+ x = x + x_hidden * c_gate_msa
140
+ if return_kv:
141
+ return x, kv
142
+ else:
143
+ return x
144
+
145
+
146
+ class DiffSynthMusicChannelProj(torch.nn.Module):
147
+ def __init__(self, in_channels, out_channels, patch_size, bias=False, transposed=False):
148
+ super().__init__()
149
+ if transposed:
150
+ self.conv = torch.nn.ConvTranspose1d(in_channels=in_channels, out_channels=out_channels, kernel_size=patch_size, stride=patch_size, bias=bias)
151
+ else:
152
+ self.conv = torch.nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=patch_size, stride=patch_size, bias=bias)
153
+
154
+ def forward(self, x):
155
+ x = x.transpose(1, 2)
156
+ x = self.conv(x)
157
+ x = x.transpose(1, 2)
158
+ return x
159
+
160
+
161
+ class DiffSynthMusicDiTModel(torch.nn.Module):
162
+ def __init__(self, dim=2560, dim_mlp=9728, dim_condition=2048, num_blocks=32, num_heads_q=32, num_heads_kv=8, head_dim=128, window_size=128, patch_size=2):
163
+ super().__init__()
164
+ self.rotary_emb = Qwen3RotaryEmbedding(type('RopeConfig', (), {'head_dim': head_dim, 'max_position_embeddings': 32768, 'rope_theta': 1000000, 'rope_parameters': {'rope_type': 'default', 'rope_theta': 1000000}})())
165
+ self.x_emb = DiffSynthMusicChannelProj(in_channels=64*3, out_channels=dim, patch_size=patch_size, bias=True)
166
+ self.timestep_emb = DiffSynthMusicTimestepEmbedding(in_channels=256, time_embed_dim=dim)
167
+ self.condition_emb = torch.nn.Linear(dim_condition, dim, bias=True)
168
+ self.layers = torch.nn.ModuleList([
169
+ DiffSynthMusicDiTLayer(dim=dim, num_heads_q=num_heads_q, num_heads_kv=num_heads_kv, dim_mlp=dim_mlp, window_size=window_size if block_id % 2 == 0 else None)
170
+ for block_id in range(num_blocks)
171
+ ])
172
+ self.norm_out = torch.nn.RMSNorm(dim, eps=1e-6)
173
+ self.proj_out = DiffSynthMusicChannelProj(in_channels=dim, out_channels=64, patch_size=patch_size, bias=True, transposed=True)
174
+ self.scale_shift_table = torch.nn.Parameter(torch.randn(1, 2, dim) / dim**0.5)
175
+ self.placeholder_audio = torch.nn.Parameter(torch.zeros((1, 15000, 64)))
176
+
177
+ def forward_kv_cache(
178
+ self,
179
+ x: torch.Tensor,
180
+ y: torch.Tensor,
181
+ use_gradient_checkpointing: bool = False,
182
+ use_gradient_checkpointing_offload: bool = False,
183
+ **kwargs,
184
+ ):
185
+ x = torch.concat([self.placeholder_audio[:, :x.shape[1]], torch.ones_like(x), x], dim=-1)
186
+ x = self.x_emb(x)
187
+ y = self.condition_emb(y)
188
+ timestep = torch.zeros((1,), dtype=x.dtype, device=x.device)
189
+ final_timestep_emb, timestep_emb = self.timestep_emb(timestep)
190
+ pos_emb = self.rotary_emb(x, torch.arange(0, x.shape[1], device=x.device).unsqueeze(0))
191
+
192
+ kv_cache = {}
193
+ for block_id, block in enumerate(self.layers):
194
+ return_kv = block.window_size is None
195
+ x = gradient_checkpoint_forward(
196
+ block,
197
+ use_gradient_checkpointing,
198
+ use_gradient_checkpointing_offload,
199
+ x, y, pos_emb, timestep_emb,
200
+ return_kv=return_kv,
201
+ kv_cache=None,
202
+ )
203
+ if return_kv:
204
+ x, kv = x
205
+ kv_cache[f"{block_id}"] = kv
206
+
207
+ return kv_cache
208
+
209
+ def forward(
210
+ self,
211
+ x: torch.Tensor,
212
+ y: torch.Tensor,
213
+ timestep: torch.Tensor,
214
+ kv_cache = None,
215
+ use_gradient_checkpointing: bool = False,
216
+ use_gradient_checkpointing_offload: bool = False,
217
+ **kwargs,
218
+ ):
219
+ x = torch.concat([self.placeholder_audio[:, :x.shape[1]], torch.ones_like(x), x], dim=-1)
220
+ x = self.x_emb(x)
221
+ y = self.condition_emb(y)
222
+ final_timestep_emb, timestep_emb = self.timestep_emb(timestep)
223
+ pos_emb = self.rotary_emb(x, torch.arange(0, x.shape[1], device=x.device).unsqueeze(0))
224
+
225
+ for block_id, block in enumerate(self.layers):
226
+ x = gradient_checkpoint_forward(
227
+ block,
228
+ use_gradient_checkpointing,
229
+ use_gradient_checkpointing_offload,
230
+ x, y, pos_emb, timestep_emb,
231
+ return_kv=False,
232
+ kv_cache=None if kv_cache is None else kv_cache.get(f"{block_id}"),
233
+ )
234
+
235
+ shift, scale = (self.scale_shift_table.to(dtype=x.dtype, device=x.device) + final_timestep_emb.unsqueeze(1)).chunk(2, dim=1)
236
+ x = self.proj_out(self.norm_out(x) * (1 + scale) + shift)
237
+ return x