1. 10 Jul, 2025 1 commit
  2. 22 Apr, 2025 1 commit
    • Linoy Tsaban's avatar
      [LoRA] add LoRA support to HiDream and fine-tuning script (#11281) · e30d3bf5
      Linoy Tsaban authored
      
      
      * initial commit
      
      * initial commit
      
      * initial commit
      
      * initial commit
      
      * initial commit
      
      * initial commit
      
      * Update examples/dreambooth/train_dreambooth_lora_hidream.py
      Co-authored-by: default avatarBagheera <59658056+bghira@users.noreply.github.com>
      
      * move prompt embeds, pooled embeds outside
      
      * Update examples/dreambooth/train_dreambooth_lora_hidream.py
      Co-authored-by: default avatarhlky <hlky@hlky.ac>
      
      * Update examples/dreambooth/train_dreambooth_lora_hidream.py
      Co-authored-by: default avatarhlky <hlky@hlky.ac>
      
      * fix import
      
      * fix import and tokenizer 4, text encoder 4 loading
      
      * te
      
      * prompt embeds
      
      * fix naming
      
      * shapes
      
      * initial commit to add HiDreamImageLoraLoaderMixin
      
      * fix init
      
      * add tests
      
      * loader
      
      * fix model input
      
      * add code example to readme
      
      * fix default max length of text encoders
      
      * prints
      
      * nullify training cond in unpatchify for temp fix to incompatible shaping of transformer output during training
      
      * smol fix
      
      * unpatchify
      
      * unpatchify
      
      * fix validation
      
      * flip pred and loss
      
      * fix shift!!!
      
      * revert unpatchify changes (for now)
      
      * smol fix
      
      * Apply style fixes
      
      * workaround moe training
      
      * workaround moe training
      
      * remove prints
      
      * to reduce some memory, keep vae in `weight_dtype` same as we have for flux (as it's the same vae)
      https://github.com/huggingface/diffusers/blob/bbd0c161b55ba2234304f1e6325832dd69c60565/examples/dreambooth/train_dreambooth_lora_flux.py#L1207
      
      
      
      * refactor to align with HiDream refactor
      
      * refactor to align with HiDream refactor
      
      * refactor to align with HiDream refactor
      
      * add support for cpu offloading of text encoders
      
      * Apply style fixes
      
      * adjust lr and rank for train example
      
      * fix copies
      
      * Apply style fixes
      
      * update README
      
      * update README
      
      * update README
      
      * fix license
      
      * keep prompt2,3,4 as None in validation
      
      * remove reverse ode comment
      
      * Update examples/dreambooth/train_dreambooth_lora_hidream.py
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * Update examples/dreambooth/train_dreambooth_lora_hidream.py
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * vae offload change
      
      * fix text encoder offloading
      
      * Apply style fixes
      
      * cleaner to_kwargs
      
      * fix module name in copied from
      
      * add requirements
      
      * fix offloading
      
      * fix offloading
      
      * fix offloading
      
      * update transformers version in reqs
      
      * try AutoTokenizer
      
      * try AutoTokenizer
      
      * Apply style fixes
      
      * empty commit
      
      * Delete tests/lora/test_lora_layers_hidream.py
      
      * change tokenizer_4 to load with AutoTokenizer as well
      
      * make text_encoder_four and tokenizer_four configurable
      
      * save model card
      
      * save model card
      
      * revert T5
      
      * fix test
      
      * remove non diffusers lumina2 conversion
      
      ---------
      Co-authored-by: default avatarBagheera <59658056+bghira@users.noreply.github.com>
      Co-authored-by: default avatarhlky <hlky@hlky.ac>
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      Co-authored-by: default avatargithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
      e30d3bf5
  3. 15 Apr, 2025 1 commit
    • Hameer Abbasi's avatar
      [LoRA] Add LoRA support to AuraFlow (#10216) · 9352a5ca
      Hameer Abbasi authored
      
      
      * Add AuraFlowLoraLoaderMixin
      
      * Add comments, remove qkv fusion
      
      * Add Tests
      
      * Add AuraFlowLoraLoaderMixin to documentation
      
      * Add Suggested changes
      
      * Change attention_kwargs->joint_attention_kwargs
      
      * Rebasing derp.
      
      * fix
      
      * fix
      
      * Quality fixes.
      
      * make style
      
      * `make fix-copies`
      
      * `ruff check --fix`
      
      * Attept 1 to fix tests.
      
      * Attept 2 to fix tests.
      
      * Attept 3 to fix tests.
      
      * Address review comments.
      
      * Rebasing derp.
      
      * Get more tests passing by copying from Flux. Address review comments.
      
      * `joint_attention_kwargs`->`attention_kwargs`
      
      * Add `lora_scale` property for te LoRAs.
      
      * Make test better.
      
      * Remove useless property.
      
      * Skip TE-only tests for AuraFlow.
      
      * Support LoRA for non-CLIP TEs.
      
      * Restore LoRA tests.
      
      * Undo adding LoRA support for non-CLIP TEs.
      
      * Undo support for TE in AuraFlow LoRA.
      
      * `make fix-copies`
      
      * Sync with upstream changes.
      
      * Remove unneeded stuff.
      
      * Mirror `Lumina2`.
      
      * Skip for MPS.
      
      * Address review comments.
      
      * Remove duplicated code.
      
      * Remove unnecessary code.
      
      * Remove repeated docs.
      
      * Propagate attention.
      
      * Fix TE target modules.
      
      * MPS fix for LoRA tests.
      
      * Unrelated TE LoRA tests fix.
      
      * Fix AuraFlow LoRA tests by applying to the right denoiser layers.
      Co-authored-by: default avatarAstraliteHeart <81396681+AstraliteHeart@users.noreply.github.com>
      
      * Apply style fixes
      
      * empty commit
      
      * Fix the repo consistency issues.
      
      * Remove unrelated changes.
      
      * Style.
      
      * Fix `test_lora_fuse_nan`.
      
      * fix quality issues.
      
      * `pytest.xfail` -> `ValueError`.
      
      * Add back `skip_mps`.
      
      * Apply style fixes
      
      * `make fix-copies`
      
      ---------
      Co-authored-by: default avatarWarlord-K <warlordk28@gmail.com>
      Co-authored-by: default avatarhlky <hlky@hlky.ac>
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      Co-authored-by: default avatarAstraliteHeart <81396681+AstraliteHeart@users.noreply.github.com>
      Co-authored-by: default avatargithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
      9352a5ca
  4. 10 Mar, 2025 1 commit
  5. 04 Mar, 2025 1 commit
    • Aryan's avatar
      [LoRA] Support Wan (#10943) · 3ee899fa
      Aryan authored
      * update
      
      * refactor image-to-video pipeline
      
      * update
      
      * fix copied from
      
      * use FP32LayerNorm
      3ee899fa
  6. 20 Feb, 2025 1 commit
  7. 21 Dec, 2024 1 commit
    • hlky's avatar
      Support Flux IP Adapter (#10261) · be207099
      hlky authored
      
      
      * Flux IP-Adapter
      
      * test cfg
      
      * make style
      
      * temp remove copied from
      
      * fix test
      
      * fix test
      
      * v2
      
      * fix
      
      * make style
      
      * temp remove copied from
      
      * Apply suggestions from code review
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      * Move encoder_hid_proj to inside FluxTransformer2DModel
      
      * merge
      
      * separate encode_prompt, add copied from, image_encoder offload
      
      * make
      
      * fix test
      
      * fix
      
      * Update src/diffusers/pipelines/flux/pipeline_flux.py
      
      * test_flux_prompt_embeds change not needed
      
      * true_cfg -> true_cfg_scale
      
      * fix merge conflict
      
      * test_flux_ip_adapter_inference
      
      * add fast test
      
      * FluxIPAdapterMixin not test mixin
      
      * Update pipeline_flux.py
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      ---------
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      be207099
  8. 20 Dec, 2024 1 commit
  9. 19 Dec, 2024 1 commit
  10. 18 Dec, 2024 1 commit
    • Sayak Paul's avatar
      [LoRA] feat: lora support for SANA. (#10234) · 9408aa2d
      Sayak Paul authored
      
      
      * feat: lora support for SANA.
      
      * make fix-copies
      
      * rename test class.
      
      * attention_kwargs -> cross_attention_kwargs.
      
      * Revert "attention_kwargs -> cross_attention_kwargs."
      
      This reverts commit 23433bf9bccc12e0f2f55df26bae58a894e8b43b.
      
      * exhaust 119 max line limit
      
      * sana lora fine-tuning script.
      
      * readme
      
      * add a note about the supported models.
      
      * Apply suggestions from code review
      Co-authored-by: default avatarAryan <aryan@huggingface.co>
      
      * style
      
      * docs for attention_kwargs.
      
      * remove lora_scale from pag pipeline.
      
      * copy fix
      
      ---------
      Co-authored-by: default avatarAryan <aryan@huggingface.co>
      9408aa2d
  11. 17 Dec, 2024 1 commit
  12. 20 Nov, 2024 1 commit
  13. 19 Sep, 2024 1 commit
    • Aryan's avatar
      [training] CogVideoX Lora (#9302) · 2b443a5d
      Aryan authored
      
      
      * cogvideox lora training draft
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * make fix-copies
      
      * update
      
      * update
      
      * apply suggestions from review
      
      * apply suggestions from reveiw
      
      * fix typo
      
      * Update examples/cogvideo/train_cogvideox_lora.py
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      * fix lora alpha
      
      * use correct lora scaling for final test pipeline
      
      * Update examples/cogvideo/train_cogvideox_lora.py
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      * apply suggestions from review; prodigy optimizer
      
      YiYi Xu <yixu310@gmail.com>
      
      * add tests
      
      * make style
      
      * add README
      
      * update
      
      * update
      
      * make style
      
      * fix
      
      * update
      
      * add test skeleton
      
      * revert lora utils changes
      
      * add cleaner modifications to lora testing utils
      
      * update lora tests
      
      * deepspeed stuff
      
      * add requirements.txt
      
      * deepspeed refactor
      
      * add lora stuff to img2vid pipeline to fix tests
      
      * fight tests
      
      * add co-authors
      Co-Authored-By: default avatarFu-Yun Wang <1697256461@qq.com>
      Co-Authored-By: default avatarzR <2448370773@qq.com>
      
      * fight lora runner tests
      
      * import Dummy optim and scheduler only wheh required
      
      * update docs
      
      * add coauthors
      Co-Authored-By: default avatarFu-Yun Wang <1697256461@qq.com>
      
      * remove option to train text encoder
      Co-Authored-By: default avatarbghira <bghira@users.github.com>
      
      * update tests
      
      * fight more tests
      
      * update
      
      * fix vid2vid
      
      * fix typo
      
      * remove lora tests; todo in follow-up PR
      
      * undo img2vid changes
      
      * remove text encoder related changes in lora loader mixin
      
      * Revert "remove text encoder related changes in lora loader mixin"
      
      This reverts commit f8a8444487db27859be812866db4e8cec7f25691.
      
      * update
      
      * round 1 of fighting tests
      
      * round 2 of fighting tests
      
      * fix copied from comment
      
      * fix typo in lora test
      
      * update styling
      Co-Authored-By: default avatarYiYi Xu <yixu310@gmail.com>
      
      ---------
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      Co-authored-by: default avatarzR <2448370773@qq.com>
      Co-authored-by: default avatarFu-Yun Wang <1697256461@qq.com>
      Co-authored-by: default avatarbghira <bghira@users.github.com>
      2b443a5d
  14. 05 Aug, 2024 1 commit
    • Sayak Paul's avatar
      [FLUX] support LoRA (#9057) · fc6a91e3
      Sayak Paul authored
      * feat: lora support for Flux.
      
      add tests
      
      fix imports
      
      major fixes.
      
      * fix
      
      fixes
      
      final fixes?
      
      * fix
      
      * remove is_peft_available.
      fc6a91e3
  15. 26 Jul, 2024 1 commit
    • Sayak Paul's avatar
      [Chore] add `LoraLoaderMixin` to the inits (#8981) · d87fe95f
      Sayak Paul authored
      
      
      * introduce  to promote reusability.
      
      * up
      
      * add more tests
      
      * up
      
      * remove comments.
      
      * fix fuse_nan test
      
      * clarify the scope of fuse_lora and unfuse_lora
      
      * remove space
      
      * rewrite fuse_lora a bit.
      
      * feedback
      
      * copy over load_lora_into_text_encoder.
      
      * address dhruv's feedback.
      
      * fix-copies
      
      * fix issubclass.
      
      * num_fused_loras
      
      * fix
      
      * fix
      
      * remove mapping
      
      * up
      
      * fix
      
      * style
      
      * fix-copies
      
      * change to SD3TransformerLoRALoadersMixin
      
      * Apply suggestions from code review
      Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
      
      * up
      
      * handle wuerstchen
      
      * up
      
      * move lora to lora_pipeline.py
      
      * up
      
      * fix-copies
      
      * fix documentation.
      
      * comment set_adapters().
      
      * fix-copies
      
      * fix set_adapters() at the model level.
      
      * fix?
      
      * fix
      
      * loraloadermixin.
      
      ---------
      Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
      d87fe95f
  16. 25 Jul, 2024 2 commits
    • YiYi Xu's avatar
      Revert "[LoRA] introduce LoraBaseMixin to promote reusability." (#8976) · 62863bb1
      YiYi Xu authored
      Revert "[LoRA] introduce LoraBaseMixin to promote reusability. (#8774)"
      
      This reverts commit 527430d0.
      62863bb1
    • Sayak Paul's avatar
      [LoRA] introduce LoraBaseMixin to promote reusability. (#8774) · 527430d0
      Sayak Paul authored
      
      
      * introduce  to promote reusability.
      
      * up
      
      * add more tests
      
      * up
      
      * remove comments.
      
      * fix fuse_nan test
      
      * clarify the scope of fuse_lora and unfuse_lora
      
      * remove space
      
      * rewrite fuse_lora a bit.
      
      * feedback
      
      * copy over load_lora_into_text_encoder.
      
      * address dhruv's feedback.
      
      * fix-copies
      
      * fix issubclass.
      
      * num_fused_loras
      
      * fix
      
      * fix
      
      * remove mapping
      
      * up
      
      * fix
      
      * style
      
      * fix-copies
      
      * change to SD3TransformerLoRALoadersMixin
      
      * Apply suggestions from code review
      Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
      
      * up
      
      * handle wuerstchen
      
      * up
      
      * move lora to lora_pipeline.py
      
      * up
      
      * fix-copies
      
      * fix documentation.
      
      * comment set_adapters().
      
      * fix-copies
      
      * fix set_adapters() at the model level.
      
      * fix?
      
      * fix
      
      ---------
      Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
      527430d0
  17. 03 Jul, 2024 2 commits
  18. 12 Jun, 2024 1 commit
  19. 09 May, 2024 1 commit
    • Dhruv Nair's avatar
      [Refactor] Better align `from_single_file` logic with `from_pretrained` (#7496) · cb0f3b49
      Dhruv Nair authored
      
      
      * refactor unet single file loading a bit.
      
      * retrieve the unet from create_diffusers_unet_model_from_ldm
      
      * update
      
      * update
      
      * updae
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * tests
      
      * update
      
      * update
      
      * update
      
      * Update docs/source/en/api/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * Update docs/source/en/api/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * Update docs/source/en/api/loaders/single_file.md
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      * Update src/diffusers/loaders/single_file.py
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      
      * Update docs/source/en/api/loaders/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * Update docs/source/en/api/loaders/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * Update docs/source/en/api/loaders/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * Update docs/source/en/api/loaders/single_file.md
      Co-authored-by: default avatarSayak Paul <spsayakpaul@gmail.com>
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      ---------
      Co-authored-by: default avatarsayakpaul <spsayakpaul@gmail.com>
      Co-authored-by: default avatarYiYi Xu <yixu310@gmail.com>
      cb0f3b49
  20. 23 Jan, 2024 1 commit
    • Dhruv Nair's avatar
      [Refactor] Update from single file (#6428) · fee93c81
      Dhruv Nair authored
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update'
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * up
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * up
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update'
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * update
      
      * clean
      
      * update
      
      * update
      
      * clean up
      
      * clean up
      
      * update
      
      * clean
      
      * clean
      
      * update
      
      * updaet
      
      * clean up
      
      * fix docs
      
      * update
      
      * update
      
      * Revert "update"
      
      This reverts commit dbfb8f1ea9c61a2b4e02f926245be2b3d387e577.
      
      * update
      
      * update
      
      * update
      
      * update
      
      * fix controlnet
      
      * fix scheduler
      
      * fix controlnet tests
      fee93c81
  21. 05 Jan, 2024 1 commit
    • Sayak Paul's avatar
      [Core] introduce `PeftAdapterMixin` module. (#6416) · 585f9413
      Sayak Paul authored
      * introduce integrations module.
      
      * remove duplicate methods.
      
      * better imports.
      
      * move to loaders.py
      
      * remove peftadaptermixin from modelmixin.
      
      * add: peftadaptermixin selectively.
      
      * add: entry to _toctree
      
      * Empty-Commit
      585f9413
  22. 21 Nov, 2023 2 commits
  23. 14 Nov, 2023 1 commit
    • Sayak Paul's avatar
      [Refactor] refactor `loaders.py` to make it cleaner and leaner. (#5771) · ded93f79
      Sayak Paul authored
      
      
      * refactor loaders.py to make it cleaner and leaner.
      
      * refactor loaders init
      
      * inits.
      
      * textual inversion to the init.
      
      * inits.
      
      * remove certain modules from the main init.
      
      * AttnProcsLayers
      
      * fix imports
      
      * avoid circular import.
      
      * fix circular import pt 2.
      
      * address PR comments
      
      * imports
      
      * fix: imports.
      
      * remove from main init for avoiding circular deps.
      
      * remove spurious deps.
      
      * fix-copies.
      
      * fix imports.
      
      * more debug
      
      * more debug
      
      * Apply suggestions from code review
      
      * Apply suggestions from code review
      
      ---------
      Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
      ded93f79