diffusers/scripts
Sayak Paul 5ffb73d4ae
let's go Flux2 🚀 (#12711)
* add vae

* Initial commit for Flux 2 Transformer implementation

* add pipeline part

* small edits to the pipeline and conversion

* update conversion script

* fix

* up up

* finish pipeline

* Remove Flux IP Adapter logic for now

* Remove deprecated 3D id logic

* Remove ControlNet logic for now

* Add link to ViT-22B paper as reference for parallel transformer blocks such as the Flux 2 single stream block

* update pipeline

* Don't use biases for input projs and output AdaNorm

* up

* Remove bias for double stream block text QKV projections

* Add script to convert Flux 2 transformer to diffusers

* make style and make quality

* fix a few things.

* allow sft files to go.

* fix image processor

* fix batch

* style a bit

* Fix some bugs in Flux 2 transformer implementation

* Fix dummy input preparation and fix some test bugs

* fix dtype casting in timestep guidance module.

* resolve conflicts.,

* remove ip adapter stuff.

* Fix Flux 2 transformer consistency test

* Fix bug in Flux2TransformerBlock (double stream block)

* Get remaining Flux 2 transformer tests passing

* make style; make quality; make fix-copies

* remove stuff.

* fix type annotaton.

* remove unneeded stuff from tests

* tests

* up

* up

* add sf support

* Remove unused IP Adapter and ControlNet logic from transformer (#9)

* copied from

* Apply suggestions from code review

Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: apolinário <joaopaulo.passos@gmail.com>

* up

* up

* up

* up

* up

* Refactor Flux2Attention into separate classes for double stream and single stream attention

* Add _supports_qkv_fusion to AttentionModuleMixin to allow subclasses to disable QKV fusion

* Have Flux2ParallelSelfAttention inherit from AttentionModuleMixin with _supports_qkv_fusion=False

* Log debug message when calling fuse_projections on a AttentionModuleMixin subclass that does not support QKV fusion

* Address review comments

* Update src/diffusers/pipelines/flux2/pipeline_flux2.py

Co-authored-by: YiYi Xu <yixu310@gmail.com>

* up

* Remove maybe_allow_in_graph decorators for Flux 2 transformer blocks (#12)

* up

* support ostris loras. (#13)

* up

* update schdule

* up

* up (#17)

* add training scripts (#16)

* add training scripts

Co-authored-by: Linoy Tsaban <linoytsaban@gmail.com>

* model cpu offload in validation.

* add flux.2 readme

* add img2img and tests

* cpu offload in log validation

* Apply suggestions from code review

* fix

* up

* fixes

* remove i2i training tests for now.

---------

Co-authored-by: Linoy Tsaban <linoytsaban@gmail.com>
Co-authored-by: linoytsaban <linoy@huggingface.co>

* up

---------

Co-authored-by: yiyixuxu <yixu310@gmail.com>
Co-authored-by: Daniel Gu <dgu8957@gmail.com>
Co-authored-by: yiyi@huggingface.co <yiyi@ip-10-53-87-203.ec2.internal>
Co-authored-by: dg845 <58458699+dg845@users.noreply.github.com>
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
Co-authored-by: apolinário <joaopaulo.passos@gmail.com>
Co-authored-by: yiyi@huggingface.co <yiyi@ip-26-0-160-103.ec2.internal>
Co-authored-by: Linoy Tsaban <linoytsaban@gmail.com>
Co-authored-by: linoytsaban <linoy@huggingface.co>
2025-11-25 21:49:04 +05:30
..
__init__.py Fix conversion script 2022-07-15 17:00:41 +00:00
change_naming_configs_and_checkpoints.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
conversion_ldm_uncond.py [OmegaConf] replace it with yaml (#6488) 2024-01-15 20:02:10 +05:30
convert_amused.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_animatediff_motion_lora_to_diffusers.py [core] AnimateDiff SparseCtrl (#8897) 2024-07-26 17:46:05 +05:30
convert_animatediff_motion_module_to_diffusers.py [Pipeline] AnimateDiff SDXL (#6721) 2024-05-08 21:27:14 +05:30
convert_animatediff_sparsectrl_to_diffusers.py [core] AnimateDiff SparseCtrl (#8897) 2024-07-26 17:46:05 +05:30
convert_asymmetric_vqgan_to_diffusers.py Asymmetric vqgan (#3956) 2023-07-20 17:51:06 +02:00
convert_aura_flow_to_diffusers.py [Core] Add AuraFlow (#8796) 2024-07-11 08:50:19 -10:00
convert_blipdiffusion_to_diffusers.py Fix style (#10478) 2025-01-07 11:06:36 +05:30
convert_cogvideox_to_diffusers.py CogVideoX 1.5 (#9877) 2024-11-19 00:56:34 +05:30
convert_cogview3_to_diffusers.py [Fix] Syntax error (#10068) 2024-12-02 11:28:00 +05:30
convert_cogview4_to_diffusers_megatron.py CogView4 Control Block (#10809) 2025-03-15 07:15:56 -10:00
convert_cogview4_to_diffusers.py CogView4 Control Block (#10809) 2025-03-15 07:15:56 -10:00
convert_consistency_decoder.py docs: cleanup of runway model (#12503) 2025-10-17 14:10:50 -07:00
convert_consistency_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_cosmos_to_diffusers.py [single file] Cosmos (#11801) 2025-07-01 18:02:58 +05:30
convert_dance_diffusion_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_dcae_to_diffusers.py [DC-AE] Add the official Deep Compression Autoencoder code(32x,64x,128x compression ratio); (#9708) 2024-12-07 01:01:51 +05:30
convert_ddpm_original_checkpoint_to_diffusers.py Ruff: apply same rules as in transformers (#2827) 2023-03-27 16:18:57 +02:00
convert_diffusers_sdxl_lora_to_webui.py changed positional parameters to named parameters like in docs (#6905) 2024-02-08 21:39:03 +05:30
convert_diffusers_to_original_sdxl.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_diffusers_to_original_stable_diffusion.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_dit_to_diffusers.py Replace flake8 with ruff and update black (#2279) 2023-02-07 23:46:23 +01:00
convert_flux2_to_diffusers.py let's go Flux2 🚀 (#12711) 2025-11-25 21:49:04 +05:30
convert_flux_to_diffusers.py Fix typos in docs and comments (#11416) 2025-04-30 20:30:53 -10:00
convert_flux_xlabs_ipadapter_to_diffusers.py Support Flux IP Adapter (#10261) 2024-12-21 17:49:58 +00:00
convert_gligen_to_diffusers.py Remove torch_dtype in to() to end deprecation (#6886) 2024-02-08 09:38:57 +05:30
convert_hunyuan_image_to_diffusers.py HunyuanImage21 (#12333) 2025-10-23 22:31:12 -10:00
convert_hunyuan_video_to_diffusers.py New HunyuanVideo-I2V (#11066) 2025-03-24 21:18:40 +05:30
convert_hunyuandit_controlnet_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_hunyuandit_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_i2vgen_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_if.py Update access of configuration attributes (#7343) 2024-03-18 08:53:29 -10:00
convert_k_upscaler_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_kakao_brain_unclip_to_diffusers.py [Core] move transformer scripts to transformers modules (#6747) 2024-01-29 22:28:28 +05:30
convert_kandinsky3_unet.py [@cene555][Kandinsky 3.0] Add Kandinsky 3.0 (#5913) 2023-11-24 17:46:00 +01:00
convert_kandinsky_to_diffusers.py [Core] move transformer scripts to transformers modules (#6747) 2024-01-29 22:28:28 +05:30
convert_ldm_original_checkpoint_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_lora_safetensor_to_diffusers.py [LoRA test suite] refactor the test suite and cleanse it (#7316) 2024-03-20 17:13:52 +05:30
convert_ltx_to_diffusers.py ltx0.9.8 (without IC lora, autoregressive sampling) (#12493) 2025-10-15 07:41:17 -10:00
convert_lumina_to_diffusers.py Rename Lumina(2)Text2ImgPipeline -> Lumina(2)Pipeline (#10827) 2025-03-13 09:24:21 -10:00
convert_mochi_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_models_diffuser_to_diffusers.py Ruff: apply same rules as in transformers (#2827) 2023-03-27 16:18:57 +02:00
convert_ms_text_to_video_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_music_spectrogram_to_diffusers.py #7535 Update FloatTensor type hints to Tensor (#7883) 2024-05-10 09:53:31 -10:00
convert_ncsnpp_original_checkpoint_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_omnigen_to_diffusers.py Add OmniGen (#10148) 2025-02-12 02:16:38 +05:30
convert_original_audioldm2_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_original_audioldm_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_original_controlnet_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_original_musicldm_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_original_stable_diffusion_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_original_t2i_adapter.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_pixart_alpha_to_diffusers.py Fix PixArt 256px inference (#6789) 2024-03-03 10:31:21 +05:30
convert_pixart_sigma_to_diffusers.py PixArt-Sigma Implementation (#7654) 2024-04-23 22:33:08 -10:00
convert_prx_to_diffusers.py Prx (#12525) 2025-10-21 17:09:22 -07:00
convert_sana_controlnet_to_diffusers.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_sana_to_diffusers.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_sana_video_to_diffusers.py SANA-Video Image to Video pipeline SanaImageToVideoPipeline support (#12634) 2025-11-17 00:23:34 -08:00
convert_sd3_controlnet_to_diffusers.py Sd35 controlnet (#10020) 2024-11-27 10:44:48 -10:00
convert_sd3_to_diffusers.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_shap_e_to_diffusers.py Fix typos in docs and comments (#11416) 2025-04-30 20:30:53 -10:00
convert_skyreelsv2_to_diffusers.py Add SkyReels V2: Infinite-Length Film Generative Model (#11518) 2025-07-16 08:24:41 -10:00
convert_stable_audio.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_stable_cascade_lite.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_stable_cascade.py fix: correct import path for load_model_dict_into_meta in conversion scripts (#12616) 2025-11-10 14:47:18 +05:30
convert_stable_diffusion_checkpoint_to_onnx.py Update more licenses to 2025 (#11746) 2025-06-19 07:46:01 +05:30
convert_stable_diffusion_controlnet_to_onnx.py Convert Stable Diffusion ControlNet to TensorRT (#4465) 2023-08-11 08:12:26 +05:30
convert_stable_diffusion_controlnet_to_tensorrt.py Convert Stable Diffusion ControlNet to TensorRT (#4465) 2023-08-11 08:12:26 +05:30
convert_svd_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_tiny_autoencoder_to_diffusers.py Remove code snippets containing is_safetensors_available() (#4521) 2023-08-11 11:05:22 +05:30
convert_unclip_txt2img_to_image_variation.py Replace flake8 with ruff and update black (#2279) 2023-02-07 23:46:23 +01:00
convert_unidiffuser_to_diffusers.py [WIP] Refactor UniDiffuser Pipeline and Tests (#4948) 2023-10-02 18:24:55 +02:00
convert_vae_diff_to_onnx.py make style 2023-03-06 10:40:18 +00:00
convert_vae_pt_to_diffusers.py [BUG] Fix convert_vae_pt_to_diffusers bug (#11078) 2025-04-10 06:59:45 +01:00
convert_versatile_diffusion_to_diffusers.py [chore] change licensing to 2025 from 2024. (#10615) 2025-01-20 16:57:27 -10:00
convert_vq_diffusion_to_diffusers.py Update Ruff to latest Version (#10919) 2025-04-09 16:51:34 +05:30
convert_wan_to_diffusers.py [WIP]Add Wan2.2 Animate Pipeline (Continuation of #12442 by tolgacangoz) (#12526) 2025-11-12 16:52:31 -10:00
convert_wuerstchen.py Fix typos in docs and comments (#11416) 2025-04-30 20:30:53 -10:00
convert_zero123_to_diffusers.py Remove dead code and fix f-string issue (#7720) 2024-05-08 13:15:28 -10:00
extract_lora_from_model.py [chore] add a script to extract loras from full fine-tuned models (#10631) 2025-01-24 11:50:36 +05:30
generate_logits.py Use model_info.id instead of model_info.modelId (#8912) 2024-07-20 20:01:21 +05:30