diffsynth 2.1.11__tar.gz → 2.2.0__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.
- {diffsynth-2.1.11 → diffsynth-2.2.0}/PKG-INFO +8 -1
- {diffsynth-2.1.11 → diffsynth-2.2.0}/README.md +7 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/configs/model_configs.py +11 -1
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/configs/vram_management_module_maps.py +8 -0
- diffsynth-2.2.0/diffsynth/core/attention/__init__.py +2 -0
- diffsynth-2.2.0/diffsynth/core/attention/attention.py +51 -0
- diffsynth-2.2.0/diffsynth/core/attention/common.py +27 -0
- diffsynth-2.2.0/diffsynth/core/attention/flash_attention.py +118 -0
- diffsynth-2.2.0/diffsynth/core/attention/flex_attention.py +28 -0
- diffsynth-2.2.0/diffsynth/core/attention/registry.py +48 -0
- diffsynth-2.2.0/diffsynth/core/attention/sage_attention.py +20 -0
- diffsynth-2.2.0/diffsynth/core/attention/torch_attention.py +82 -0
- diffsynth-2.2.0/diffsynth/core/attention/xformers_attention.py +22 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/data/operators.py +11 -5
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/data/unified_dataset.py +2 -1
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/gradient/gradient_checkpoint.py +5 -6
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/loader/config.py +2 -2
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/loader/model.py +12 -4
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/backends/__init__.py +2 -0
- diffsynth-2.2.0/diffsynth/core/quant/backends/deep_gemm.py +618 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/backends/entropack.py +40 -10
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/vram/layers.py +41 -4
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/flow_match.py +18 -1
- diffsynth-2.2.0/diffsynth/models/fibo_dit.py +412 -0
- diffsynth-2.2.0/diffsynth/models/flux2_vae.py +335 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_dit_vdn.py +1 -1
- diffsynth-2.2.0/diffsynth/pipelines/fibo.py +482 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/version.py +1 -1
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth.egg-info/PKG-INFO +8 -1
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth.egg-info/SOURCES.txt +10 -0
- diffsynth-2.1.11/diffsynth/core/attention/__init__.py +0 -1
- diffsynth-2.1.11/diffsynth/core/attention/attention.py +0 -255
- diffsynth-2.1.11/diffsynth/models/flux2_vae.py +0 -2327
- {diffsynth-2.1.11 → diffsynth-2.2.0}/LICENSE +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/configs/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/data/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/device/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/device/npu_compatible_device.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/gradient/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/loader/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/loader/file.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/npu_patch/npu_fused_operator.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/offload_training/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/offload_training/manager.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/offload_training/memory_buffer.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/offload_training/offloader.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/backends/bitsandbytes.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/backends/comfy_kitchen.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/backends/torchao.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/base.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/quant/config.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/vram/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/vram/disk_map.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/core/vram/initialization.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/base_pipeline.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/ddim_scheduler.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/dmd2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/logger.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/loss.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/parsers.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/runner.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/template.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/diffusion/training_module.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/aesthetic.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/base.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/bioclip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/clip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/fid.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/hpsv2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/hpsv3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/image_reward.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/lpips.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/pickscore.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/qwen_image_bench.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/unified_reward_2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/metrics/unified_reward_edit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_conditioner.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_residual_fsq.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_tokenizer.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ace_step_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/aesthetic.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/anima_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/bioclip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/boogu_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/clip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/demucs.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/diffsynth_music_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/dinov3_image_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ernie_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ernie_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/fid.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux3_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_infiniteyou.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_ipadapter.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_lora_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_lora_patcher.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_redux.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_text_encoder_clip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_text_encoder_t5.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/flux_value_control.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/general_modules.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/hidream_common.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/hidream_o1_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/hpsv2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/hpsv3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ideogram4_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ideogram4_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ideogram4_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/image_reward.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/joyai_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/krea2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/krea2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/lingbot_video_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/longcat_video_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/lpips.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx25_diffusion_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx25_duration_head.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx25_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_audio_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_common.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_upsampler.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/ltx2_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_audio_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_dit_comfy.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_dit_vdn_fp8.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_h3_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_music3_condition_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_music3_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_music3_rvq_depth_decoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_music3_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/minimax_music3_vocoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/model_loader.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/moss_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/moss_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/mova_audio_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/mova_audio_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/mova_dual_tower_bridge.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/nexus_gen.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/nexus_gen_ar_model.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/nexus_gen_projector.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/pickscore.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_21_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_21_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_21_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_21_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_bench.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_image2lora.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_image_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/qwen_video_edit_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/sd_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/sensenova_u1_common.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/sensenova_u1_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/siglip2_image_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/stable_diffusion_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/stable_diffusion_unet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/stable_diffusion_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/stable_diffusion_xl_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/stable_diffusion_xl_unet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/step1x_connector.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/step1x_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/unified_reward_2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/unified_reward_edit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_animate_2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_animate_adapter.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_camera_controller.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_dit_s2v.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_image_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_mot.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_motion_controller.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_vace.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wan_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wantodance.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/wav2vec.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/yue2_mot.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/yue2_tokenizer.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/yue2_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/z_image_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/z_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/z_image_image2lora.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/models/z_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/ace_step.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/anima_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/boogu_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/diffsynth_music.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/ernie_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/flux2_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/flux3_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/flux_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/hidream_o1_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/ideogram4.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/joyai_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/krea2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/lingbot_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/ltx2_audio_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/minimax_h3_audio_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/minimax_music3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/moss_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/mova_audio_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/qwen_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/qwen_image_21.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/qwen_video_edit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/sensenova_u1_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/stable_diffusion.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/stable_diffusion_xl.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/wan_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/yue2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/pipelines/z_image.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/controlnet/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/controlnet/annotator.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/controlnet/controlnet_input.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/data/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/data/audio.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/data/audio_video.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/data/media_io_ltx2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/data/minimax_h3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/demucs/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/dequantizer/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/flux.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/flux_timestep.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/general.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/krea2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/merge.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/minimax_h3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/reset_rank.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/lora/sdxl.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/music_tools/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/music_tools/click.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/music_tools/prosody.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/quant/serialization.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/ses/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/ses/ses.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ace_step_conditioner.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ace_step_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ace_step_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ace_step_tokenizer.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/anima_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/dino_v3.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ernie_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux3_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_infiniteyou.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_ipadapter.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_text_encoder_clip.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_text_encoder_t5.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/flux_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ideogram4_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/image_metrics.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/krea2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/krea2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/lingbot_video_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx25_diffusion_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx25_duration_head.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx25_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx2_audio_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx2_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx2_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/ltx2_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_audio_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_controlnet.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_dit_vdn.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_h3_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/minimax_music3_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/moss_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/nexus_gen.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/nexus_gen_projector.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/qwen_image_21_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/qwen_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/qwen_video_edit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/sdxl.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/sdxl_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/sdxl_text_encoder_2.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/sdxl_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/stable_diffusion_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/stable_diffusion_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/stable_diffusion_xl_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/step1x_connector.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_animate_adapter.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_image_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_mot.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_vace.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wan_video_vae.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/wans2v_audio_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/z_image_dit.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/state_dict_converters/z_image_text_encoder.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/tile/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/tile/tile_worker.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/xfuser/__init__.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth/utils/xfuser/xdit_context_parallel.py +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth.egg-info/dependency_links.txt +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth.egg-info/requires.txt +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/diffsynth.egg-info/top_level.txt +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/pyproject.toml +0 -0
- {diffsynth-2.1.11 → diffsynth-2.2.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffsynth
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Enjoy the magic of Diffusion models!
|
|
5
5
|
Author: ModelScope Team
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -114,6 +114,8 @@ See also:
|
|
|
114
114
|
|
|
115
115
|
> 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
116
|
|
|
117
|
+
- **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
|
+
|
|
117
119
|
- **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.
|
|
118
120
|
|
|
119
121
|
- **October 16, 2026** flux-3-image-klein open-sourced, welcome a new member to the image model family! Support includes text-to-image generation, multi-reference editing, layout control, low VRAM inference, and Base training capabilities. For details, please refer to the [documentation](/docs/en/Model_Details/FLUX.3.md) and [example code](/examples/flux3/). We quantized the model with [EntroPack](https://github.com/modelscope/entropack), providing pre-quantized models in 3-bit, 4-bit, and 6-bit versions at [DiffSynth-Studio/flux-3-image-klein-entropack](https://www.modelscope.cn/models/DiffSynth-Studio/flux-3-image-klein-entropack).
|
|
@@ -402,6 +404,8 @@ Quick start: experience popular and the latest models:
|
|
|
402
404
|
|
|
403
405
|
| Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
|
|
404
406
|
|-|-|-|-|-|-|-|-|
|
|
407
|
+
| 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
|
+
| 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) | - | - | - | - |
|
|
405
409
|
| 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) |
|
|
406
410
|
| Qwen-Image-2.1 | [Qwen/Qwen-Image-2.1-Turbo](https://www.modelscope.cn/models/Qwen/Qwen-Image-2.1-Turbo) | [code](/examples/qwen_image_21/model_inference/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_inference_low_vram/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_training/full/Qwen-Image-2.1-Turbo.sh) | [code](/examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_training/lora/Qwen-Image-2.1-Turbo.sh) | [code](/examples/qwen_image_21/model_training/validate_lora/Qwen-Image-2.1-Turbo.py) |
|
|
407
411
|
| 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) |
|
|
@@ -414,6 +418,7 @@ Quick start: experience popular and the latest models:
|
|
|
414
418
|
Model overview:
|
|
415
419
|
|
|
416
420
|
- Image generation
|
|
421
|
+
- Fibo 2.0: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Fibo.html), [Example code](/examples/fibo/)
|
|
417
422
|
- MOSS-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MOSS-Image.html), [Example code](/examples/moss_image/)
|
|
418
423
|
- FLUX.3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/FLUX.3.html), [Example code](/examples/flux3/)
|
|
419
424
|
- Qwen-Image-2.1: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Qwen-Image-2.1.html), [Example code](/examples/qwen_image_21/)
|
|
@@ -702,6 +707,8 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
|
|
|
702
707
|
|
|
703
708
|
| Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
|
|
704
709
|
|-|-|-|-|-|-|-|-|
|
|
710
|
+
| 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
|
+
| 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) | - | - | - | - |
|
|
705
712
|
| 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) |
|
|
706
713
|
| MOSS-Image | [openmoss/MOSS-Image-SFT](https://www.modelscope.cn/models/openmoss/MOSS-Image-SFT) | [code](/examples/moss_image/model_inference/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_training/full/MOSS-Image-SFT.sh) | [code](/examples/moss_image/model_training/validate_full/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_training/lora/MOSS-Image-SFT.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-SFT.py) |
|
|
707
714
|
| MOSS-Image | [DiffSynth-Studio/MOSS-Image-EntroPack](https://www.modelscope.cn/models/DiffSynth-Studio/MOSS-Image-EntroPack) | [code](/examples/moss_image/model_inference/MOSS-Image-EntroPack.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-EntroPack.py) | - | - | [code](/examples/moss_image/model_training/lora/MOSS-Image-entropack.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-entropack.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
|
+
- **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
|
+
|
|
44
46
|
- **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.
|
|
45
47
|
|
|
46
48
|
- **October 16, 2026** flux-3-image-klein open-sourced, welcome a new member to the image model family! Support includes text-to-image generation, multi-reference editing, layout control, low VRAM inference, and Base training capabilities. For details, please refer to the [documentation](/docs/en/Model_Details/FLUX.3.md) and [example code](/examples/flux3/). We quantized the model with [EntroPack](https://github.com/modelscope/entropack), providing pre-quantized models in 3-bit, 4-bit, and 6-bit versions at [DiffSynth-Studio/flux-3-image-klein-entropack](https://www.modelscope.cn/models/DiffSynth-Studio/flux-3-image-klein-entropack).
|
|
@@ -329,6 +331,8 @@ Quick start: experience popular and the latest models:
|
|
|
329
331
|
|
|
330
332
|
| Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
|
|
331
333
|
|-|-|-|-|-|-|-|-|
|
|
334
|
+
| 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
|
+
| 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) | - | - | - | - |
|
|
332
336
|
| 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) |
|
|
333
337
|
| Qwen-Image-2.1 | [Qwen/Qwen-Image-2.1-Turbo](https://www.modelscope.cn/models/Qwen/Qwen-Image-2.1-Turbo) | [code](/examples/qwen_image_21/model_inference/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_inference_low_vram/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_training/full/Qwen-Image-2.1-Turbo.sh) | [code](/examples/qwen_image_21/model_training/validate_full/Qwen-Image-2.1-Turbo.py) | [code](/examples/qwen_image_21/model_training/lora/Qwen-Image-2.1-Turbo.sh) | [code](/examples/qwen_image_21/model_training/validate_lora/Qwen-Image-2.1-Turbo.py) |
|
|
334
338
|
| 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) |
|
|
@@ -341,6 +345,7 @@ Quick start: experience popular and the latest models:
|
|
|
341
345
|
Model overview:
|
|
342
346
|
|
|
343
347
|
- Image generation
|
|
348
|
+
- Fibo 2.0: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Fibo.html), [Example code](/examples/fibo/)
|
|
344
349
|
- MOSS-Image: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/MOSS-Image.html), [Example code](/examples/moss_image/)
|
|
345
350
|
- FLUX.3: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/FLUX.3.html), [Example code](/examples/flux3/)
|
|
346
351
|
- Qwen-Image-2.1: [Documentation](https://diffsynth-studio-doc.readthedocs.io/en/latest/Model_Details/Qwen-Image-2.1.html), [Example code](/examples/qwen_image_21/)
|
|
@@ -629,6 +634,8 @@ https://github.com/Artiprocher/DiffSynth-Studio/assets/35051019/59fb2f7b-8de0-44
|
|
|
629
634
|
|
|
630
635
|
| Architecture | Model ID | Inference | Low VRAM Inference | Full Training | Validation After Full Training | LoRA Training | Validation After LoRA Training |
|
|
631
636
|
|-|-|-|-|-|-|-|-|
|
|
637
|
+
| 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
|
+
| 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) | - | - | - | - |
|
|
632
639
|
| 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) |
|
|
633
640
|
| MOSS-Image | [openmoss/MOSS-Image-SFT](https://www.modelscope.cn/models/openmoss/MOSS-Image-SFT) | [code](/examples/moss_image/model_inference/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_training/full/MOSS-Image-SFT.sh) | [code](/examples/moss_image/model_training/validate_full/MOSS-Image-SFT.py) | [code](/examples/moss_image/model_training/lora/MOSS-Image-SFT.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-SFT.py) |
|
|
634
641
|
| MOSS-Image | [DiffSynth-Studio/MOSS-Image-EntroPack](https://www.modelscope.cn/models/DiffSynth-Studio/MOSS-Image-EntroPack) | [code](/examples/moss_image/model_inference/MOSS-Image-EntroPack.py) | [code](/examples/moss_image/model_inference_low_vram/MOSS-Image-EntroPack.py) | - | - | [code](/examples/moss_image/model_training/lora/MOSS-Image-entropack.sh) | [code](/examples/moss_image/model_training/validate_lora/MOSS-Image-entropack.py) |
|
|
@@ -1843,9 +1843,19 @@ flux3_series = [
|
|
|
1843
1843
|
},
|
|
1844
1844
|
]
|
|
1845
1845
|
|
|
1846
|
+
fibo_series = [
|
|
1847
|
+
{
|
|
1848
|
+
# Example: ModelConfig(model_id="briaai/Fibo-2.0-dev", origin_file_pattern="transformer/*.safetensors")
|
|
1849
|
+
# Example: ModelConfig(model_id="briaai/Fibo-2.0-edit-turbo", origin_file_pattern="transformer/*.safetensors")
|
|
1850
|
+
"model_hash": "39f09f95705fd6d9b20670f1923d3c12",
|
|
1851
|
+
"model_name": "fibo_dit",
|
|
1852
|
+
"model_class": "diffsynth.models.fibo_dit.FiboDiT",
|
|
1853
|
+
},
|
|
1854
|
+
]
|
|
1855
|
+
|
|
1846
1856
|
MODEL_CONFIGS = (
|
|
1847
1857
|
stable_diffusion_xl_series + stable_diffusion_series + qwen_image_series + qwen_video_edit_series + wan_series + flux_series + flux2_series + ernie_image_series
|
|
1848
1858
|
+ z_image_series + ltx2_series + anima_series + mova_series + joyai_image_series + boogu_image_series + ace_step_series + hidream_o1_image_series
|
|
1849
1859
|
+ image_metrics_series + ideogram4_series + krea2_series + lingbot_video_series + minimax_h3_series + minimax_music3_series + sensenova_u1_series
|
|
1850
|
-
+ yue2_series + qwen_image_21_series + flux3_series + moss_image_series
|
|
1860
|
+
+ yue2_series + qwen_image_21_series + flux3_series + moss_image_series + fibo_series
|
|
1851
1861
|
)
|
|
@@ -256,6 +256,14 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
|
|
|
256
256
|
"torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
|
|
257
257
|
"torch.nn.Conv2d": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
258
258
|
"torch.nn.GroupNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
259
|
+
"diffsynth.models.flux2_vae.Flux2VAELatentNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
260
|
+
},
|
|
261
|
+
"diffsynth.models.fibo_dit.FiboDiT": {
|
|
262
|
+
"torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
|
|
263
|
+
"diffsynth.models.general_modules.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
264
|
+
"torch.nn.LayerNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
265
|
+
"diffsynth.models.fibo_dit.FiboPerceiverResampler": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
266
|
+
"diffsynth.models.fibo_dit.FiboTransformerBlock": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
259
267
|
},
|
|
260
268
|
"diffsynth.models.z_image_text_encoder.ZImageTextEncoder": {
|
|
261
269
|
"torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
|
|
@@ -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", "sage_attention", "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)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import math, warnings, time
|
|
2
|
-
import torch,
|
|
3
|
-
import imageio.v3 as iio
|
|
2
|
+
import torch, os
|
|
4
3
|
import urllib.request
|
|
5
4
|
from io import BytesIO
|
|
6
5
|
from PIL import Image
|
|
@@ -100,16 +99,20 @@ class ImageCropAndResize(DataProcessingOperator):
|
|
|
100
99
|
self.max_pixels = max_pixels
|
|
101
100
|
self.height_division_factor = height_division_factor
|
|
102
101
|
self.width_division_factor = width_division_factor
|
|
102
|
+
import torchvision
|
|
103
|
+
self.resize = torchvision.transforms.functional.resize
|
|
104
|
+
self.center_crop = torchvision.transforms.functional.center_crop
|
|
105
|
+
self.interpolation_mode = torchvision.transforms.InterpolationMode.BILINEAR
|
|
103
106
|
|
|
104
107
|
def crop_and_resize(self, image, target_height, target_width):
|
|
105
108
|
width, height = image.size
|
|
106
109
|
scale = max(target_width / width, target_height / height)
|
|
107
|
-
image =
|
|
110
|
+
image = self.resize(
|
|
108
111
|
image,
|
|
109
112
|
(round(height*scale), round(width*scale)),
|
|
110
|
-
interpolation=
|
|
113
|
+
interpolation=self.interpolation_mode
|
|
111
114
|
)
|
|
112
|
-
image =
|
|
115
|
+
image = self.center_crop(image, (target_height, target_width))
|
|
113
116
|
return image
|
|
114
117
|
|
|
115
118
|
def get_height_width(self, image):
|
|
@@ -143,6 +146,7 @@ class FrameSamplerByRateMixin:
|
|
|
143
146
|
self.fix_frame_rate = fix_frame_rate
|
|
144
147
|
|
|
145
148
|
def get_reader(self, data: str):
|
|
149
|
+
import imageio
|
|
146
150
|
return imageio.get_reader(data)
|
|
147
151
|
|
|
148
152
|
def get_available_num_frames(self, reader):
|
|
@@ -213,6 +217,7 @@ class LoadGIF(DataProcessingOperator):
|
|
|
213
217
|
|
|
214
218
|
def get_num_frames(self, path):
|
|
215
219
|
num_frames = self.num_frames
|
|
220
|
+
import imageio.v3 as iio
|
|
216
221
|
images = iio.imread(path, mode="RGB")
|
|
217
222
|
if len(images) < num_frames:
|
|
218
223
|
num_frames = len(images)
|
|
@@ -223,6 +228,7 @@ class LoadGIF(DataProcessingOperator):
|
|
|
223
228
|
def __call__(self, data: str):
|
|
224
229
|
num_frames = self.get_num_frames(data)
|
|
225
230
|
frames = []
|
|
231
|
+
import imageio.v3 as iio
|
|
226
232
|
images = iio.imread(data, mode="RGB")
|
|
227
233
|
for img in images:
|
|
228
234
|
frame = Image.fromarray(img)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .operators import *
|
|
2
|
-
import torch, json,
|
|
2
|
+
import torch, json, os
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class UnifiedDataset(torch.utils.data.Dataset):
|
|
@@ -84,6 +84,7 @@ class UnifiedDataset(torch.utils.data.Dataset):
|
|
|
84
84
|
metadata.append(json.loads(line.strip()))
|
|
85
85
|
self.data = metadata
|
|
86
86
|
else:
|
|
87
|
+
import pandas
|
|
87
88
|
metadata = pandas.read_csv(metadata_path)
|
|
88
89
|
self.data = [metadata.iloc[i].to_dict() for i in range(len(metadata))]
|
|
89
90
|
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import torch
|
|
2
|
+
import sys
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_HAS_DEEPSPEED = True
|
|
7
|
-
except ModuleNotFoundError:
|
|
8
|
-
_HAS_DEEPSPEED = False
|
|
5
|
+
def get_deepspeed():
|
|
6
|
+
return sys.modules.get("deepspeed")
|
|
9
7
|
|
|
10
8
|
|
|
11
9
|
def create_custom_forward(module):
|
|
@@ -36,7 +34,8 @@ def gradient_checkpoint_forward(
|
|
|
36
34
|
*args,
|
|
37
35
|
**kwargs,
|
|
38
36
|
):
|
|
39
|
-
if use_gradient_checkpointing
|
|
37
|
+
deepspeed = get_deepspeed() if use_gradient_checkpointing else None
|
|
38
|
+
if use_gradient_checkpointing and deepspeed is not None and deepspeed.checkpointing.is_configured():
|
|
40
39
|
kwarg_keys = tuple(kwargs)
|
|
41
40
|
all_args = args + tuple(kwargs.values())
|
|
42
41
|
if not judge_args_requires_grad(*all_args):
|