diffsynth 2.0.14__tar.gz → 2.0.16__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.0.14 → diffsynth-2.0.16}/PKG-INFO +1 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/README.md +56 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/configs/model_configs.py +39 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/configs/vram_management_module_maps.py +12 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/data/operators.py +34 -4
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/ddim_scheduler.py +6 -4
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/flow_match.py +19 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/runner.py +18 -1
- diffsynth-2.0.16/diffsynth/models/krea2_dit.py +419 -0
- diffsynth-2.0.16/diffsynth/models/krea2_text_encoder.py +79 -0
- diffsynth-2.0.16/diffsynth/pipelines/krea2.py +280 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/stable_diffusion_xl.py +2 -0
- diffsynth-2.0.16/diffsynth/utils/lora/krea2.py +131 -0
- diffsynth-2.0.16/diffsynth/utils/lora/sdxl.py +780 -0
- diffsynth-2.0.16/diffsynth/utils/state_dict_converters/krea2_dit.py +92 -0
- diffsynth-2.0.16/diffsynth/utils/state_dict_converters/krea2_text_encoder.py +19 -0
- diffsynth-2.0.16/diffsynth/utils/state_dict_converters/sdxl.py +1690 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth.egg-info/PKG-INFO +1 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth.egg-info/SOURCES.txt +8 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/pyproject.toml +1 -1
- {diffsynth-2.0.14 → diffsynth-2.0.16}/LICENSE +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/configs/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/attention/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/attention/attention.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/data/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/data/unified_dataset.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/device/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/device/npu_compatible_device.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/gradient/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/gradient/gradient_checkpoint.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/loader/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/loader/config.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/loader/file.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/loader/model.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/npu_patch/npu_fused_operator.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/offload_training/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/offload_training/manager.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/offload_training/memory_buffer.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/offload_training/offloader.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/vram/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/vram/disk_map.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/vram/initialization.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/core/vram/layers.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/base_pipeline.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/logger.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/loss.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/parsers.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/template.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/diffusion/training_module.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/aesthetic.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/base.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/bioclip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/clip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/fid.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/hpsv2.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/hpsv3.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/image_reward.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/lpips.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/pickscore.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/qwen_image_bench.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/unified_reward_2.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/metrics/unified_reward_edit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_conditioner.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_residual_fsq.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_tokenizer.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ace_step_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/aesthetic.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/anima_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/bioclip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/clip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/demucs.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/dinov3_image_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ernie_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ernie_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/fid.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux2_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux2_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux2_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_controlnet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_infiniteyou.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_ipadapter.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_lora_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_lora_patcher.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_text_encoder_clip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_text_encoder_t5.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/flux_value_control.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/general_modules.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/hidream_common.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/hidream_o1_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/hpsv2.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/hpsv3.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ideogram4_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ideogram4_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ideogram4_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/image_reward.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/joyai_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/joyai_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/longcat_video_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/lpips.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_audio_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_common.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_upsampler.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/ltx2_video_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/model_loader.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/mova_audio_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/mova_audio_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/mova_dual_tower_bridge.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/nexus_gen.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/nexus_gen_ar_model.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/nexus_gen_projector.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/pickscore.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_bench.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_controlnet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_image2lora.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/qwen_image_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/sd_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/siglip2_image_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/stable_diffusion_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/stable_diffusion_unet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/stable_diffusion_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/stable_diffusion_xl_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/stable_diffusion_xl_unet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/step1x_connector.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/step1x_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/unified_reward_2.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/unified_reward_edit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_animate_adapter.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_camera_controller.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_dit_s2v.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_image_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_mot.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_motion_controller.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_vace.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wan_video_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wantodance.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/wav2vec.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/z_image_controlnet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/z_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/z_image_image2lora.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/models/z_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/ace_step.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/anima_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/ernie_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/flux2_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/flux_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/hidream_o1_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/ideogram4.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/joyai_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/ltx2_audio_video.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/mova_audio_video.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/qwen_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/stable_diffusion.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/wan_video.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/pipelines/z_image.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/controlnet/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/controlnet/annotator.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/controlnet/controlnet_input.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/data/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/data/audio.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/data/audio_video.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/data/media_io_ltx2.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/demucs/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/dequantizer/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/lora/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/lora/flux.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/lora/general.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/lora/merge.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/lora/reset_rank.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/ses/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/ses/ses.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ace_step_conditioner.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ace_step_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ace_step_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ace_step_tokenizer.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/anima_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/dino_v3.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ernie_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux2_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_controlnet.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_infiniteyou.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_ipadapter.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_text_encoder_clip.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_text_encoder_t5.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/flux_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/image_metrics.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/joyai_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ltx2_audio_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ltx2_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ltx2_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/ltx2_video_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/nexus_gen.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/nexus_gen_projector.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/qwen_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/stable_diffusion_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/stable_diffusion_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/stable_diffusion_xl_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/step1x_connector.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_animate_adapter.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_image_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_mot.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_vace.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wan_video_vae.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/wans2v_audio_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/z_image_dit.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/state_dict_converters/z_image_text_encoder.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/xfuser/__init__.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/utils/xfuser/xdit_context_parallel.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth/version.py +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth.egg-info/dependency_links.txt +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth.egg-info/requires.txt +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/diffsynth.egg-info/top_level.txt +0 -0
- {diffsynth-2.0.14 → diffsynth-2.0.16}/setup.cfg +0 -0
|
@@ -34,7 +34,9 @@ We believe that a well-developed open-source code framework can lower the thresh
|
|
|
34
34
|
|
|
35
35
|
> 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.
|
|
36
36
|
|
|
37
|
-
- **June
|
|
37
|
+
- **June 24, 2026** Krea-2 is now open-source, and we have provided full support. For more details, please refer to the [documentation](/docs/en/Model_Details/Krea-2.md) and [example code](/examples/krea2/).
|
|
38
|
+
|
|
39
|
+
- **June 16, 2026**: We have added a new Template model for ACE-Step: [vocals2music](https://www.modelscope.cn/models/DiffSynth-Studio/acestep15xlsft-vocals2music). For more details, please refer to the [documentation](/docs/en/Model_Details/ACE-Step.md) and [example code](/examples/ace_step/).
|
|
38
40
|
|
|
39
41
|
- **June 15, 2026** We have open-sourced Image-to-LoRA V2, compressing the hours-long training process for image style LoRAs into a single model inference step, thereby exploring a new paradigm for LoRA model training. The [technical report](https://arxiv.org/abs/2606.13809) has been released. This release includes three models:
|
|
40
42
|
* [DiffSynth-Studio/ZImage-i2L-v2](https://modelscope.cn/models/DiffSynth-Studio/ZImage-i2L-v2): Adapted for the Z-Image model
|
|
@@ -1042,6 +1044,59 @@ Example code for Ideogram 4 is available at: [/examples/ideogram4/](/examples/id
|
|
|
1042
1044
|
|
|
1043
1045
|
</details>
|
|
1044
1046
|
|
|
1047
|
+
#### Krea-2: [/docs/en/Model_Details/Krea-2.md](/docs/en/Model_Details/Krea-2.md)
|
|
1048
|
+
|
|
1049
|
+
<details>
|
|
1050
|
+
|
|
1051
|
+
<summary>Quick Start</summary>
|
|
1052
|
+
|
|
1053
|
+
Running the following code will quickly load the [krea/Krea-2-Raw](https://www.modelscope.cn/models/krea/Krea-2-Raw) model and perform inference. VRAM management is enabled, and the framework will automatically control the loading of model parameters based on available VRAM. The model can run with a minimum of 24GB VRAM.
|
|
1054
|
+
|
|
1055
|
+
```python
|
|
1056
|
+
from diffsynth.pipelines.krea2 import Krea2Pipeline, ModelConfig
|
|
1057
|
+
import torch
|
|
1058
|
+
|
|
1059
|
+
vram_config = {
|
|
1060
|
+
"offload_dtype": "disk",
|
|
1061
|
+
"offload_device": "disk",
|
|
1062
|
+
"onload_dtype": torch.float8_e4m3fn,
|
|
1063
|
+
"onload_device": "cpu",
|
|
1064
|
+
"preparing_dtype": torch.float8_e4m3fn,
|
|
1065
|
+
"preparing_device": "cuda",
|
|
1066
|
+
"computation_dtype": torch.bfloat16,
|
|
1067
|
+
"computation_device": "cuda",
|
|
1068
|
+
}
|
|
1069
|
+
pipe = Krea2Pipeline.from_pretrained(
|
|
1070
|
+
torch_dtype=torch.bfloat16,
|
|
1071
|
+
device="cuda",
|
|
1072
|
+
model_configs=[
|
|
1073
|
+
ModelConfig(model_id="krea/Krea-2-Raw", origin_file_pattern="raw.safetensors", **vram_config),
|
|
1074
|
+
ModelConfig(model_id="Qwen/Qwen3-VL-4B-Instruct", origin_file_pattern="*.safetensors", **vram_config),
|
|
1075
|
+
ModelConfig(model_id="Qwen/Qwen-Image", origin_file_pattern="vae/diffusion_pytorch_model.safetensors", **vram_config),
|
|
1076
|
+
],
|
|
1077
|
+
tokenizer_config=ModelConfig(model_id="Qwen/Qwen3-VL-4B-Instruct", origin_file_pattern=""),
|
|
1078
|
+
vram_limit=torch.cuda.mem_get_info("cuda")[1] / (1024 ** 3) - 1,
|
|
1079
|
+
)
|
|
1080
|
+
prompt = "A cat standing on a stone."
|
|
1081
|
+
image = pipe(prompt, seed=0, num_inference_steps=52, cfg_scale=4.5)
|
|
1082
|
+
image.save("image.jpg")
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
</details>
|
|
1086
|
+
|
|
1087
|
+
<details>
|
|
1088
|
+
|
|
1089
|
+
<summary>Examples</summary>
|
|
1090
|
+
|
|
1091
|
+
Example code for Krea-2 is available at: [/examples/krea2/](/examples/krea2/)
|
|
1092
|
+
|
|
1093
|
+
| Model ID | Inference | Low VRAM Inference | Full Training | Full Training Validation | LoRA Training | LoRA Training Validation |
|
|
1094
|
+
|-|-|-|-|-|-|-|
|
|
1095
|
+
|[krea/Krea-2-Raw](https://www.modelscope.cn/models/krea/Krea-2-Raw)|[code](/examples/krea2/model_inference/Krea-2-Raw.py)|[code](/examples/krea2/model_inference_low_vram/Krea-2-Raw.py)|[code](/examples/krea2/model_training/full/Krea-2-Raw.sh)|[code](/examples/krea2/model_training/validate_full/Krea-2-Raw.py)|[code](/examples/krea2/model_training/lora/Krea-2-Raw.sh)|[code](/examples/krea2/model_training/validate_lora/Krea-2-Raw.py)|
|
|
1096
|
+
|[krea/Krea-2-Turbo](https://www.modelscope.cn/models/krea/Krea-2-Turbo)|[code](/examples/krea2/model_inference/Krea-2-Turbo.py)|[code](/examples/krea2/model_inference_low_vram/Krea-2-Turbo.py)|[code](/examples/krea2/model_training/full/Krea-2-Turbo.sh)|[code](/examples/krea2/model_training/validate_full/Krea-2-Turbo.py)|[code](/examples/krea2/model_training/lora/Krea-2-Turbo.sh)|[code](/examples/krea2/model_training/validate_lora/Krea-2-Turbo.py)|
|
|
1097
|
+
|
|
1098
|
+
</details>
|
|
1099
|
+
|
|
1045
1100
|
### Video Synthesis
|
|
1046
1101
|
|
|
1047
1102
|
https://github.com/user-attachments/assets/1d66ae74-3b02-40a9-acc3-ea95fc039314
|
|
@@ -917,6 +917,14 @@ stable_diffusion_xl_series = [
|
|
|
917
917
|
"state_dict_converter": "diffsynth.utils.state_dict_converters.stable_diffusion_vae.SDVAEStateDictConverter",
|
|
918
918
|
"extra_kwargs": {"scaling_factor": 0.13025, "sample_size": 1024, "force_upcast": True},
|
|
919
919
|
},
|
|
920
|
+
{
|
|
921
|
+
# Example: ModelConfig(model_id="stabilityai/stable-diffusion-xl-base-1.0", origin_file_pattern="sd_xl_base_1.0.safetensors")
|
|
922
|
+
"model_hash": "4cf64a799d04260df438c6f33c9a047e",
|
|
923
|
+
"model_name": "stable_diffusion_xl_unet",
|
|
924
|
+
"model_class": "diffsynth.models.stable_diffusion_xl_unet.SDXLUNet2DConditionModel",
|
|
925
|
+
"extra_kwargs": {"attention_head_dim": [5, 10, 20], "transformer_layers_per_block": [1, 2, 10], "use_linear_projection": True, "addition_embed_type": "text_time", "addition_time_embed_dim": 256, "projection_class_embeddings_input_dim": 2816},
|
|
926
|
+
"state_dict_converter": "diffsynth.utils.state_dict_converters.sdxl.SDXLUNetStateDictConverter_Original2Diffusers",
|
|
927
|
+
}
|
|
920
928
|
]
|
|
921
929
|
|
|
922
930
|
stable_diffusion_series = [
|
|
@@ -1163,8 +1171,38 @@ ideogram4_series = [
|
|
|
1163
1171
|
},
|
|
1164
1172
|
]
|
|
1165
1173
|
|
|
1174
|
+
krea2_series = [
|
|
1175
|
+
{
|
|
1176
|
+
# Example: ModelConfig(model_id="AI-ModelScope/Krea-2", origin_file_pattern="raw.safetensors"),
|
|
1177
|
+
"model_hash": "4be51f0ecc9b9dfc9825abb3f7a0b4ae",
|
|
1178
|
+
"model_name": "krea2_dit",
|
|
1179
|
+
"model_class": "diffsynth.models.krea2_dit.SingleStreamDiT",
|
|
1180
|
+
"state_dict_converter": "diffsynth.utils.state_dict_converters.krea2_dit.Krea2DiTStateDictConverter",
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
# Example: ModelConfig(model_id="krea/Krea-2-Raw", origin_file_pattern="raw.safetensors")
|
|
1184
|
+
"model_hash": "2a05e69084a6d608516ee47c8ad03334",
|
|
1185
|
+
"model_name": "krea2_dit",
|
|
1186
|
+
"model_class": "diffsynth.models.krea2_dit.SingleStreamDiT",
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
# Example: ModelConfig(model_id="krea/Krea-2-Raw", origin_file_pattern="transformer/*.safetensors")
|
|
1190
|
+
"model_hash": "cddb3118d9f8250bf7b08c331c5c55aa",
|
|
1191
|
+
"model_name": "krea2_dit",
|
|
1192
|
+
"model_class": "diffsynth.models.krea2_dit.SingleStreamDiT",
|
|
1193
|
+
"state_dict_converter": "diffsynth.utils.state_dict_converters.krea2_dit.Krea2DiTStateDictConverter_Diffusers",
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
# Example: ModelConfig(model_id="Qwen/Qwen3-VL-4B-Instruct", origin_file_pattern="*.safetensors")
|
|
1197
|
+
"model_hash": "b8750c24f732c87797f551196c4cef78",
|
|
1198
|
+
"model_name": "krea2_text_encoder",
|
|
1199
|
+
"model_class": "diffsynth.models.krea2_text_encoder.Krea2TextEncoder",
|
|
1200
|
+
"state_dict_converter": "diffsynth.utils.state_dict_converters.krea2_text_encoder.Krea2TextEncoderStateDictConverter",
|
|
1201
|
+
},
|
|
1202
|
+
]
|
|
1203
|
+
|
|
1166
1204
|
MODEL_CONFIGS = (
|
|
1167
1205
|
stable_diffusion_xl_series + stable_diffusion_series + qwen_image_series + wan_series + flux_series + flux2_series + ernie_image_series
|
|
1168
1206
|
+ z_image_series + ltx2_series + anima_series + mova_series + joyai_image_series + ace_step_series + hidream_o1_image_series
|
|
1169
|
-
+ image_metrics_series + ideogram4_series
|
|
1207
|
+
+ image_metrics_series + ideogram4_series + krea2_series
|
|
1170
1208
|
)
|
|
@@ -393,6 +393,18 @@ VRAM_MANAGEMENT_MODULE_MAPS = {
|
|
|
393
393
|
"transformers.models.qwen3_vl.modeling_qwen3_vl.Qwen3VLTextRotaryEmbedding": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
394
394
|
"transformers.models.qwen3_vl.modeling_qwen3_vl.Qwen3VLTextRMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
395
395
|
},
|
|
396
|
+
"diffsynth.models.krea2_dit.SingleStreamDiT": {
|
|
397
|
+
"diffsynth.models.krea2_dit.RMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
398
|
+
"torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
|
|
399
|
+
"diffsynth.models.krea2_dit.DoubleSharedModulation": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
400
|
+
"diffsynth.models.krea2_dit.SimpleModulation": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
401
|
+
},
|
|
402
|
+
"diffsynth.models.krea2_text_encoder.Krea2TextEncoder": {
|
|
403
|
+
"torch.nn.Linear": "diffsynth.core.vram.layers.AutoWrappedLinear",
|
|
404
|
+
"torch.nn.Embedding": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
405
|
+
"transformers.models.qwen3_vl.modeling_qwen3_vl.Qwen3VLTextRotaryEmbedding": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
406
|
+
"transformers.models.qwen3_vl.modeling_qwen3_vl.Qwen3VLTextRMSNorm": "diffsynth.core.vram.layers.AutoWrappedModule",
|
|
407
|
+
},
|
|
396
408
|
}
|
|
397
409
|
|
|
398
410
|
def QwenImageTextEncoder_Module_Map_Updater():
|
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
import math, warnings
|
|
1
|
+
import math, warnings, time
|
|
2
2
|
import torch, torchvision, imageio, os
|
|
3
3
|
import imageio.v3 as iio
|
|
4
|
+
import urllib.request
|
|
5
|
+
from io import BytesIO
|
|
4
6
|
from PIL import Image
|
|
5
7
|
from einops import repeat
|
|
6
8
|
|
|
7
9
|
|
|
10
|
+
def _is_url(path):
|
|
11
|
+
return isinstance(path, str) and path.startswith(("http://", "https://"))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _load_image_from_url(url, timeout=30, max_retries=3):
|
|
15
|
+
request = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 (compatible; DiffSynth-Studio)"})
|
|
16
|
+
last_error = None
|
|
17
|
+
for attempt in range(max_retries):
|
|
18
|
+
try:
|
|
19
|
+
with urllib.request.urlopen(request, timeout=timeout) as response:
|
|
20
|
+
image = Image.open(BytesIO(response.read()))
|
|
21
|
+
image.load()
|
|
22
|
+
return image
|
|
23
|
+
except Exception as e:
|
|
24
|
+
last_error = e
|
|
25
|
+
if attempt < max_retries - 1:
|
|
26
|
+
time.sleep(2 ** attempt)
|
|
27
|
+
raise RuntimeError(f"Failed to load image from URL '{url}' after {max_retries} attempts: {last_error}") from last_error
|
|
28
|
+
|
|
29
|
+
|
|
8
30
|
class DataProcessingPipeline:
|
|
9
31
|
def __init__(self, operators=None):
|
|
10
32
|
self.operators: list[DataProcessingOperator] = [] if operators is None else operators
|
|
@@ -55,12 +77,17 @@ class ToStr(DataProcessingOperator):
|
|
|
55
77
|
|
|
56
78
|
|
|
57
79
|
class LoadImage(DataProcessingOperator):
|
|
58
|
-
def __init__(self, convert_RGB=True, convert_RGBA=False):
|
|
80
|
+
def __init__(self, convert_RGB=True, convert_RGBA=False, url_timeout=30, url_max_retries=3):
|
|
59
81
|
self.convert_RGB = convert_RGB
|
|
60
82
|
self.convert_RGBA = convert_RGBA
|
|
61
|
-
|
|
83
|
+
self.url_timeout = url_timeout
|
|
84
|
+
self.url_max_retries = url_max_retries
|
|
85
|
+
|
|
62
86
|
def __call__(self, data: str):
|
|
63
|
-
|
|
87
|
+
if _is_url(data):
|
|
88
|
+
image = _load_image_from_url(data, timeout=self.url_timeout, max_retries=self.url_max_retries)
|
|
89
|
+
else:
|
|
90
|
+
image = Image.open(data)
|
|
64
91
|
if self.convert_RGB: image = image.convert("RGB")
|
|
65
92
|
if self.convert_RGBA: image = image.convert("RGBA")
|
|
66
93
|
return image
|
|
@@ -242,6 +269,9 @@ class ToAbsolutePath(DataProcessingOperator):
|
|
|
242
269
|
self.base_path = base_path
|
|
243
270
|
|
|
244
271
|
def __call__(self, data):
|
|
272
|
+
# A remote URL is already absolute; joining it with base_path would corrupt it.
|
|
273
|
+
if _is_url(data):
|
|
274
|
+
return data
|
|
245
275
|
return os.path.join(self.base_path, data)
|
|
246
276
|
|
|
247
277
|
|
|
@@ -87,8 +87,9 @@ class DDIMScheduler():
|
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
def add_noise(self, original_samples, noise, timestep):
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
timestep_id = max(min(int(timestep.flatten().tolist()[0]), len(self.alphas_cumprod)-1), 0)
|
|
91
|
+
sqrt_alpha_prod = math.sqrt(self.alphas_cumprod[timestep_id])
|
|
92
|
+
sqrt_one_minus_alpha_prod = math.sqrt(1 - self.alphas_cumprod[timestep_id])
|
|
92
93
|
noisy_samples = sqrt_alpha_prod * original_samples + sqrt_one_minus_alpha_prod * noise
|
|
93
94
|
return noisy_samples
|
|
94
95
|
|
|
@@ -97,8 +98,9 @@ class DDIMScheduler():
|
|
|
97
98
|
if self.prediction_type == "epsilon":
|
|
98
99
|
return noise
|
|
99
100
|
else:
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
timestep_id = max(min(int(timestep.flatten().tolist()[0]), len(self.alphas_cumprod)-1), 0)
|
|
102
|
+
sqrt_alpha_prod = math.sqrt(self.alphas_cumprod[timestep_id])
|
|
103
|
+
sqrt_one_minus_alpha_prod = math.sqrt(1 - self.alphas_cumprod[timestep_id])
|
|
102
104
|
target = sqrt_alpha_prod * noise - sqrt_one_minus_alpha_prod * sample
|
|
103
105
|
return target
|
|
104
106
|
|
|
@@ -4,7 +4,7 @@ from typing_extensions import Literal
|
|
|
4
4
|
|
|
5
5
|
class FlowMatchScheduler():
|
|
6
6
|
|
|
7
|
-
def __init__(self, template: Literal["FLUX.1", "Wan", "Qwen-Image", "FLUX.2", "Z-Image", "LTX-2", "Qwen-Image-Lightning", "ERNIE-Image", "ACE-Step", "Ideogram4"] = "FLUX.1"):
|
|
7
|
+
def __init__(self, template: Literal["FLUX.1", "Wan", "Qwen-Image", "FLUX.2", "Z-Image", "LTX-2", "Qwen-Image-Lightning", "ERNIE-Image", "ACE-Step", "Ideogram4", "Krea-2"] = "FLUX.1"):
|
|
8
8
|
self.set_timesteps_fn = {
|
|
9
9
|
"FLUX.1": FlowMatchScheduler.set_timesteps_flux,
|
|
10
10
|
"Wan": FlowMatchScheduler.set_timesteps_wan,
|
|
@@ -17,6 +17,7 @@ class FlowMatchScheduler():
|
|
|
17
17
|
"ACE-Step": FlowMatchScheduler.set_timesteps_ace_step,
|
|
18
18
|
"HiDream-O1-Image": FlowMatchScheduler.set_timesteps_hidream_o1_image,
|
|
19
19
|
"Ideogram4": FlowMatchScheduler.set_timesteps_ideogram4,
|
|
20
|
+
"Krea-2": FlowMatchScheduler.set_timesteps_krea2,
|
|
20
21
|
}.get(template, FlowMatchScheduler.set_timesteps_flux)
|
|
21
22
|
self.num_train_timesteps = 1000
|
|
22
23
|
|
|
@@ -233,6 +234,23 @@ class FlowMatchScheduler():
|
|
|
233
234
|
sigmas = (1 - sigmas)[:-1]
|
|
234
235
|
return sigmas, timesteps
|
|
235
236
|
|
|
237
|
+
@staticmethod
|
|
238
|
+
def set_timesteps_krea2(num_inference_steps=28, denoising_strength=1.0, dynamic_shift_len=None, y1=0.5, y2=1.15, mu=None):
|
|
239
|
+
x1 = 256
|
|
240
|
+
x2 = 6400
|
|
241
|
+
sigma = 1
|
|
242
|
+
ts = torch.linspace(denoising_strength, 0, num_inference_steps + 1)
|
|
243
|
+
if mu is None and dynamic_shift_len is None:
|
|
244
|
+
# Training
|
|
245
|
+
mu = 0.8
|
|
246
|
+
elif mu is None:
|
|
247
|
+
# Raw
|
|
248
|
+
slope = (y2 - y1) / (x2 - x1)
|
|
249
|
+
mu = slope * dynamic_shift_len + (y1 - slope * x1)
|
|
250
|
+
ts = math.exp(mu) / (math.exp(mu) + (1.0 / ts - 1.0) ** sigma)
|
|
251
|
+
sigmas, timesteps = ts[:-1], ts[:-1]
|
|
252
|
+
return sigmas, timesteps
|
|
253
|
+
|
|
236
254
|
@staticmethod
|
|
237
255
|
def set_timesteps_ltx2(num_inference_steps=100, denoising_strength=1.0, dynamic_shift_len=None, terminal=0.1, special_case=None):
|
|
238
256
|
num_train_timesteps = 1000
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import os, torch, importlib
|
|
1
|
+
import os, json, torch, importlib
|
|
2
2
|
from tqdm import tqdm
|
|
3
3
|
from accelerate import Accelerator
|
|
4
4
|
from .training_module import DiffusionTrainingModule
|
|
@@ -16,6 +16,20 @@ def get_optimizer_class(customized_optimizer=None):
|
|
|
16
16
|
return getattr(module, class_name)
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
def save_training_args(args):
|
|
20
|
+
output_path = getattr(args, "output_path", None) if args is not None else None
|
|
21
|
+
if output_path is None:
|
|
22
|
+
return
|
|
23
|
+
try:
|
|
24
|
+
os.makedirs(args.output_path, exist_ok=True)
|
|
25
|
+
save_path = os.path.join(args.output_path, "training_args.json")
|
|
26
|
+
with open(save_path, "w", encoding="utf-8") as f:
|
|
27
|
+
json.dump(vars(args), f, indent=4, ensure_ascii=False, default=str)
|
|
28
|
+
print(f"Training arguments saved to `{save_path}`.")
|
|
29
|
+
except Exception as e:
|
|
30
|
+
print(f"Warning: failed to save training arguments: {e}")
|
|
31
|
+
|
|
32
|
+
|
|
19
33
|
def launch_training_task(
|
|
20
34
|
accelerator: Accelerator,
|
|
21
35
|
dataset: torch.utils.data.Dataset,
|
|
@@ -44,6 +58,9 @@ def launch_training_task(
|
|
|
44
58
|
cpu_offload_split_threshold = args.cpu_offload_split_threshold
|
|
45
59
|
customized_optimizer = args.customized_optimizer
|
|
46
60
|
|
|
61
|
+
if accelerator.is_main_process:
|
|
62
|
+
save_training_args(args)
|
|
63
|
+
|
|
47
64
|
optimizer_class = get_optimizer_class(customized_optimizer)
|
|
48
65
|
optimizer = optimizer_class(model.trainable_modules(), lr=learning_rate, weight_decay=weight_decay)
|
|
49
66
|
scheduler = torch.optim.lr_scheduler.ConstantLR(optimizer)
|