Commit Graph

4242 Commits

Author SHA1 Message Date
drhead 33646098f5 Add extra performance features for EMAModel, torch._foreach operations and better support for non-blocking CPU offloading (#7685)
* Add support for _foreach operations and non-blocking to EMAModel

* default foreach to false

* add non-blocking EMA offloading to SD1.5 T2I example script

* fix whitespace

* move foreach to cli argument

* linting

* Update README.md re: EMA weight training

* correct args.foreach_ema

* add tests for foreach ema

* code quality

* add foreach to from_pretrained

* default foreach false

* fix linting

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: drhead <a@a.a>
2024-12-23 13:02:13 +05:30
Haofan Wang b4cdb1222d Update pipeline_stable_diffusion_3_controlnet.py (#8660)
Co-authored-by: YiYi Xu <yixu310@gmail,com>
2024-12-23 13:02:13 +05:30
Sayak Paul c90e70dde1 [LoRA] refactor lora conversion utility. (#8295)
* refactor lora conversion utility.

* remove error raises.

* add onetrainer support too.
2024-12-23 13:02:13 +05:30
Álvaro Somoza 48d590de20 [SD3 LoRA] Fix list index out of range (#8584)
* fix

* add check

* key present is checked before

* test case draft

* aply suggestions

* changed testing repo, back to old class

* forgot docstring

---------

Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul 22ebb0ab89 [LoRA] get rid of the legacy lora remnants and make our codebase lighter (#8623)
* get rid of the legacy lora remnants and make our codebase lighter

* fix depcrecated lora argument

* fix

* empty commit to trigger ci

* remove print

* empty
2024-12-23 13:02:13 +05:30
YiYi Xu af474e5d44 a few fix for shard checkpoints (#8656)
fix

Co-authored-by: yiyixuxu <yixu310@gmail,com>
2024-12-23 13:02:13 +05:30
Steaunk 6da31e4e56 Fix Typo in StableDiffusion3 (#8642)
* fix typo in __call__ of pipeline_stable_diffusion_3.py

* fix typo in __call__ of pipeline_stable_diffusion_3_img2img.py

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
satani99 492900099c Update train_dreambooth_lora_sd3.py (#8600)
* Update train_dreambooth_lora_sd3.py

* Update train_dreambooth_lora_sd3.py

* Update train_dreambooth_sd3.py

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul 58913cdc94 [LoRA SD3] add support for lora fusion in sd3 (#8616)
* add support for lora fusion in sd3

* add test to ensure fused lora and effective lora produce same outpouts
2024-12-23 13:02:13 +05:30
Sayak Paul 2c6abb2635 [Flax tests] reduce tolerance for a flax test (#8640)
reduce tolerance for a flax test
2024-12-23 13:02:13 +05:30
YiYi Xu 3b539834f1 fix from_single_file for checkpoints with t5 (#8631)
fix single file
2024-12-23 13:02:13 +05:30
Sayak Paul af2763cf1a Change the default weighting_scheme in the SD3 scripts (#8639)
* change to logit_normal as the weighting scheme

* sensible default mote
2024-12-23 13:02:13 +05:30
王奇勋 86da4dcf8e Support SD3 ControlNet and Multi-ControlNet. (#8566)
* sd3 controlnet



---------

Co-authored-by: haofanwang <haofanwang.ai@gmail.com>
2024-12-23 13:02:13 +05:30
Nan b2f8a01116 [SD3] Fix mis-matched shape when num_images_per_prompt > 1 using without T5 (text_encoder_3=None) (#8558)
* fix shape mismatch when num_images_per_prompt > 1 and text_encoder_3=None

* style

* fix copies

---------

Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: yiyixuxu <yixu310@gmail,com>
2024-12-23 13:02:13 +05:30
Carolinabanana 4a39745728 Fix gradient checkpointing issue for Stable Diffusion 3 (#8542)
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: YiYi Xu <yixu310@gmail.com>
2024-12-23 13:02:13 +05:30
Yongsen Mao 73f302aeb7 add sd1.5 compatibility to controlnet-xs and fix unused_parameters error during training (#8606)
* add sd1.5 compatibility to controlnet-xs

* set use_linear_projection by base_block

* refine code style
2024-12-23 13:02:13 +05:30
kkj15dk cf272f7987 self.upsample = Upsample1D (#8580)
Making self.upsample actually be Upsample1D
2024-12-23 13:02:13 +05:30
Vasco Ramos 410eb1ad86 [SD3 Docs] Corrected title about loading model with T5 "without" -> "with" (#8602)
[SD3 Docs] Corrected title about loading model with T5

Corrected the documentation title to "Loading the single file checkpoint with T5" Previously, it incorrectly stated "Loading the single file checkpoint without T5" which contradicted the code snippet showing how to load the SD3 checkpoint with the T5 model
2024-12-23 13:02:13 +05:30
Gæros a1c5fdd62e [LoRA] text encoder: read the ranks for all the attn modules (#8324)
* [LoRA] text encoder: read the ranks for all the attn modules

 * In addition to out_proj, read the ranks of adapters for q_proj, k_proj, and  v_proj

 * Allow missing adapters (UNet already supports this)

* ruff format loaders.lora

* [LoRA] add tests for partial text encoders LoRAs

* [LoRA] update test_simple_inference_with_partial_text_lora to be deterministic

* [LoRA] comment justifying test_simple_inference_with_partial_text_lora

* style

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Andrew Hong 63e1fcdf8d Remove underlines between badges (#8484)
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul db74292bb3 [Core] Add shift_factor to SD3 tiny autoencoder (#8618)
* shift factor argument to tiny

* remove shift factor rejigging from the sd3 docs
2024-12-23 13:02:13 +05:30
Álvaro Somoza f6e4f29816 [SD3 Inference] T5 Token limit (#8506)
* max_sequence_length for the T5

* updated img2img

* apply suggestions

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: YiYi Xu <yixu310@gmail.com>
2024-12-23 13:02:13 +05:30
Marc Sun eaf258b461 Fix sharding when no device_map is passed (#8531)
* Fix sharding when no device_map is passed

* style

* add tests

* align

* add docstring

* format

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
MaoXianXin c8deda5834 A backslash is missing from the run command (#8471) 2024-12-23 13:02:13 +05:30
Dhruv Nair ea1b9276e8 [Single File Loading] Handle unexpected keys in CLIP models when accelerate isn't installed. (#8462)
* update

* update

* update

* update

* update

---------

Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Álvaro Somoza fcbb2ffac9 [SD3] TAESD3 docs (#8607)
* tased3 docs

* apply suggestion

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul 6ad6c79fc7 [LoRA] training fix the position of param casting when loading them (#8460)
fix the position of param casting when loading them
2024-12-23 13:02:13 +05:30
Sayak Paul 2fad608d8e [SD3 training] refactor the density and weighting utilities. (#8591)
refactor the density and weighting utilities.
2024-12-23 13:02:13 +05:30
Bagheera acfcfd3003 SD3: update default training timestep / loss weighting distribution to logit_normal (#8592)
Co-authored-by: bghira <bghira@users.github.com>
Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
2024-12-23 13:02:13 +05:30
Álvaro Somoza 25b4975285 [SD3 Training] T5 token limit (#8564)
* initial commit

* default back to 77

* better text

* text correction

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
AmosDinh 925e2343d7 Syntax error in readme example "pipe" -> "pipeline" (#8601)
Update controlnet.md

Syntax error pipe -> pipeline
2024-12-23 13:02:13 +05:30
Dhruv Nair a9572e55f3 Temporarily pin Numpy in the CI (#8603)
temp pin numpy
2024-12-23 13:02:13 +05:30
YiYi Xu 2ed103560b Image processor latent (#8513)
* fix

* up

---------

Co-authored-by: yiyixuxu <yixu310@gmail,com>
2024-12-23 13:02:13 +05:30
spacepxl 7cb40ee5ab Fix the deletion of SD3 text encoders for Dreambooth/LoRA training if the text encoders are not being trained (#8536)
* Update train_dreambooth_sd3.py to fix TE garbage collection

* Update train_dreambooth_lora_sd3.py to fix TE garbage collection

---------

Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Rafie Walker 2891f6f116 Implement SD3 loss weighting (#8528)
* Add lognorm and cosmap weighting

* Implement mode sampling

* Update examples/dreambooth/train_dreambooth_lora_sd3.py

* Update examples/dreambooth/train_dreambooth_lora_sd3.py

* Update examples/dreambooth/train_dreambooth_sd3.py

* Update examples/dreambooth/train_dreambooth_sd3.py

* Update examples/dreambooth/train_dreambooth_sd3.py

* Update examples/dreambooth/train_dreambooth_lora_sd3.py

* Update examples/dreambooth/train_dreambooth_sd3.py

* Update examples/dreambooth/train_dreambooth_sd3.py

* Update examples/dreambooth/train_dreambooth_lora_sd3.py

* keep timestamp sampling fully on cpu

---------

Co-authored-by: Kashif Rasul <kashif.rasul@gmail.com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul 1242672994 pin accelerate to 0.31.0 (#8563)
* pin accelerate to 0.31.0

* update dep table

* empty
2024-12-23 13:02:13 +05:30
Jonathan Rahn 5a1acc82b0 add sentencepiece to requirements.txt for SD3 dreambooth (#8538)
* add `sentencepiece` requirement for SD3

add `sentencepiece` requirement

* Empty-Commit

---------

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:13 +05:30
Sayak Paul ddbb30b823 pin transformers to the latest (#8522)
thanks!
2024-12-23 13:02:13 +05:30
Tolga Cangöz a81a6d3eed Refactor StableDiffusion3Img2ImgPipeline to remove redundant code (#8533) 2024-12-23 13:02:13 +05:30
Sayak Paul bcf0f7667f post release 0.29.0 (#8492)
post release
2024-12-23 13:02:13 +05:30
Haofan Wang 5d4603a52c Update requirements_sd3.txt (#8521) 2024-12-23 13:02:13 +05:30
YiYi Xu a18dcb5ccc remove the deprecated prepare_mask_and_masked_image function (#8512)
remove prepare mask fn

Co-authored-by: yiyixuxu <yixu310@gmail,com>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2024-12-23 13:02:12 +05:30
Dhruv Nair fa640cc7d7 Expand Single File support in SD3 Pipeline (#8517)
* update

* update
2024-12-23 13:02:12 +05:30
Lucain ff679c5bf7 Fix PATH_IN_REPO on new release in mirror_community_pipeline.yaml (#8519)
Fix PATH_IN_REPO in mirror workflow
2024-12-23 13:02:12 +05:30
ちくわぶ 1a7629e5ca Fix duplicate variable assignments in SD3's JointAttnProcessor (#8516)
* Fix duplicate variable assignments.

* Fix duplicate variable assignments.
2024-12-23 13:02:12 +05:30
Beinsezii bca796fc09 Add Hunyuan AutoPipe mapping (#8505) 2024-12-23 13:02:12 +05:30
kkj15dk 830208c5c1 Fix spelling in scheduling_flow_match_euler_discrete.py (#8497)
Update scheduling_flow_match_euler_discrete.py

Spelling:
Foward -> Forward

Co-authored-by: YiYi Xu <yixu310@gmail.com>
2024-12-23 13:02:12 +05:30
Beinsezii 45fcce63e1 Add SD3 AutoPipeline mappings (#8489) 2024-12-23 13:02:12 +05:30
Radamés Ajna 19b14dc11b Fix small typo (#8498) 2024-12-23 13:02:12 +05:30
Sayak Paul 2d66c3278e fix warning log for Transformer SD3 (#8496)
fix warning log
2024-12-23 13:02:12 +05:30