1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00
Commit Graph

427 Commits

Author SHA1 Message Date
Patrick von Platen
10d856a94c Let's make sure that dreambooth always uploads to the Hub (#3272)
* Update Dreambooth README

* Adapt all docs as well

* automatically write model card

* fix

* make style
2023-05-05 07:23:51 -07:00
timegate
ffe6e92577 Add multiple conditions to StableDiffusionControlNetInpaintPipeline (#3125)
* try multi controlnet inpaint

* multi controlnet inpaint

* multi controlnet inpaint
2023-05-05 07:23:51 -07:00
Joqsan
716c255ab5 [Community Pipelines] EDICT pipeline implementation (#3153)
* EDICT pipeline initial commit

- Starting point taking from https://github.com/Joqsan/edict-diffusion

* refactor __init__() method

* minor refactoring

* refactor scheduler code

- remove scheduler and move its methods to the EDICTPipeline class

* make CFG optional
- refactor encode_prompt().
- include optional generator for sampling with vae.
- minor variable renaming

* add EDICT pipeline description to README.md

* replace preprocess() with VaeImageProcessor

* run make style and make quality commands

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:23:51 -07:00
Sayak Paul
72a84677cb [LoRA] quality of life improvements in the loading semantics and docs (#3180)
* 👽 qol improvements for LoRA.

* better function name?

* fix: LoRA weight loading with the new format.

* address Patrick's comments.

* Apply suggestions from code review

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>

* change wording around encouraging the use of load_lora_weights().

* fix: function name.

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:23:51 -07:00
Patrick von Platen
79706a7db8 Revert "Revert "[Community Pipelines] Update lpw_stable_diffusion pipeline"" (#3265)
Revert "Revert "[Community Pipelines] Update lpw_stable_diffusion pipeline" (#3201)"

This reverts commit 91a2a80eb2.
2023-05-05 07:23:51 -07:00
Pedro Cuenca
97cf3866db Remove required from tracker_project_name (#3260)
Remove required from tracker_project_name.

As observed by https://github.com/off99555 in https://github.com/huggingface/diffusers/issues/2695#issuecomment-1470755050, it already has a default value.
2023-05-05 07:23:50 -07:00
Pedro Cuenca
a640f1ba96 Write model card in controlnet training script (#3229)
Write model card in controlnet training script.
2023-05-05 07:23:50 -07:00
Patrick von Platen
163c33b5ff Post release for 0.16.0 (#3244)
* Post release

* fix more
2023-05-05 07:23:50 -07:00
Patrick von Platen
4cc60b53d8 Release: v0.16.0 2023-05-05 07:23:50 -07:00
Lucca Zenóbio
4e03663091 fix mixed precision training on train_dreambooth_inpaint_lora (#3138)
cast to weight dtype
2023-05-05 07:22:14 -07:00
Will Berman
de05ea0f50 Revert "[Community Pipelines] Update lpw_stable_diffusion pipeline" (#3201)
Revert "[Community Pipelines] Update lpw_stable_diffusion pipeline (#3197)"

This reverts commit 9965cb50ea.
2023-05-05 07:22:14 -07:00
SkyTNT
a69502f844 [Community Pipelines] Update lpw_stable_diffusion pipeline (#3197)
* Update lpw_stable_diffusion.py

* fix cpu offload
2023-05-05 07:22:14 -07:00
Chengrui Wang
49c9b4ce5f Fix bug in train_dreambooth_lora (#3183)
* Update train_dreambooth_lora.py

fix bug

* Update train_dreambooth_lora.py
2023-05-05 07:22:14 -07:00
Patrick von Platen
cf3576364a Multi Vector Textual Inversion (#3144)
* Multi Vector

* Improve

* fix multi token

* improve test

* make style

* Update examples/test_examples.py

* Apply suggestions from code review

Co-authored-by: Suraj Patil <surajp815@gmail.com>

* update

* Finish

* Apply suggestions from code review

---------

Co-authored-by: Suraj Patil <surajp815@gmail.com>
2023-05-05 07:22:14 -07:00
asfiyab-nvidia
dac4d4a5c2 Fix TensorRT community pipeline device set function (#3157)
pass silence_dtype_warnings as kwarg

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:22:14 -07:00
Sayak Paul
206b9b69d1 [DreamBooth] add text encoder LoRA support in the DreamBooth training script (#3130)
* add: LoRA text encoder support for DreamBooth example.

* fix initialization.

* fix: modification call.

* add: entry in the readme.

* use dog dataset from hub.

* fix: params to clip.

* add entry to the LoRA doc.

* add: tests for lora.

* remove unnecessary list comprehension./
2023-05-05 07:22:14 -07:00
XinyuYe-Intel
abd21daa45 Added distillation for quantization example on textual inversion. (#2760)
* Added distillation for quantization example on textual inversion.

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>

* refined readme and code style.

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>

* Update text2images.py

* refined code of model load and added compatibility check.

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>

* fixed code style.

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>

* fix C403 [*] Unnecessary `list` comprehension (rewrite as a `set` comprehension)

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>

---------

Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com>
2023-05-05 07:22:14 -07:00
nupurkmr9
3417b1f51c adding custom diffusion training to diffusers examples (#3031)
* diffusers==0.14.0 update

* custom diffusion update

* custom diffusion update

* custom diffusion update

* custom diffusion update

* custom diffusion update

* custom diffusion update

* custom diffusion

* custom diffusion

* custom diffusion

* custom diffusion

* custom diffusion

* apply formatting and get rid of bare except.

* refactor readme and other minor changes.

* misc refactor.

* fix: repo_id issue and loaders logging bug.

* fix: save_model_card.

* fix: save_model_card.

* fix: save_model_card.

* add: doc entry.

* refactor doc,.

* custom diffusion

* custom diffusion

* custom diffusion

* apply style.

* remove tralining whitespace.

* fix: toctree entry.

* remove unnecessary print.

* custom diffusion

* custom diffusion

* custom diffusion test

* custom diffusion xformer update

* custom diffusion xformer update

* custom diffusion xformer update

---------

Co-authored-by: Nupur Kumari <nupurkumari@Nupurs-MacBook-Pro.local>
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Nupur Kumari <nupurkumari@nupurs-mbp.wifi.local.cmu.edu>
2023-05-05 07:22:14 -07:00
Will Berman
b320c6b53e controlnet training resize inputs to multiple of 8 (#3135)
controlnet training center crop input images to multiple of 8

The pipeline code resizes inputs to multiples of 8.
Not doing this resizing in the training script is causing
the encoded image to have different height/width dimensions
than the encoded conditioning image (which uses a separate
encoder that's part of the controlnet model).

We resize and center crop the inputs to make sure they're the
same size (as well as all other images in the batch). We also
check that the initial resolution is a multiple of 8.
2023-05-05 07:22:14 -07:00
asfiyab-nvidia
fc3760d4a3 Add TensorRT SD/txt2img Community Pipeline to diffusers along with TensorRT utils (#2974)
* Add SD/txt2img Community Pipeline to diffusers along with TensorRT utils

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>

* update installation command

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>

* update tensorrt installation

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>

* changes
1. Update setting of cache directory
2. Address comments: merge utils and pipeline code.
3. Address comments: Add section in README

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>

* apply make style

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>

---------

Signed-off-by: Asfiya Baig <asfiyab@nvidia.com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:22:14 -07:00
Patrick von Platen
00a5e55b50 Correct textual inversion readme (#3145)
* Update README.md

* Apply suggestions from code review
2023-05-05 07:22:13 -07:00
Patrick von Platen
7ae597f747 make style 2023-05-05 07:22:13 -07:00
Cristian Garcia
7a39b0f7e0 Optimize log_validation in train_controlnet_flax (#3110)
extract pipeline from log_validation
2023-05-05 07:22:13 -07:00
Sayak Paul
16ddd8b818 feat: verfication of multi-gpu support for select examples. (#3126)
* feat: verfication of multi-gpu support for select examples.

* add: multi-gpu training sections to the relvant doc pages.
2023-05-05 07:22:13 -07:00
Patrick von Platen
6f12a36056 Fix config deprecation (#3129)
* Better deprecation message

* Better deprecation message

* Better doc string

* Fixes

* fix more

* fix more

* Improve __getattr__

* correct more

* fix more

* fix

* Improve more

* more improvements

* fix more

* Apply suggestions from code review

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>

* make style

* Fix all rest & add tests & remove old deprecation fns

---------

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2023-05-05 07:22:13 -07:00
YiYi Xu
fa6a6b470d remvoe one line as requested by gc team (#3077)
remvoe one line
2023-05-05 07:22:13 -07:00
Andreas Steiner
7a1d10009c Adds profiling flags, computes train metrics average. (#3053)
* WIP controlnet training

- bugfix --streaming
- bugfix running report_to!='wandb'
- adds memory profile before validation

* Adds final logging statement.

* Sets train epochs to 11.

Looking at a longer ~16ep run, we see only good validation images
after ~11ep:

https://wandb.ai/andsteing/controlnet_fill50k/runs/3j2hx6n8

* Removes --logging_dir (it's not used).

* Adds --profile flags.

* Updates --output_dir=runs/fill-circle-{timestamp}.

* Compute mean of `train_metrics`.

Previously `train_metrics[-1]` was logged, resulting in very bumpy train
metrics.

* Improves logging a bit.

- adds l2_grads gradient norm logging
- adds steps_per_sec
- sets walltime as x coordinate of train/step
- logs controlnet_params config

* Adds --ccache (doesn't really help though).

* minor fix in controlnet flax example (#2986)

* fix the error when push_to_hub but not log validation

* contronet_from_pt & controlnet_revision

* add intermediate checkpointing to the guide

* Bugfix --profile_steps

* Sets `RACKER_PROJECT_NAME='controlnet_fill50k'`.

* Logs fractional epoch.

* Adds relative `walltime` metric.

* Adds `StepTraceAnnotation` and uses `global_step` insetad of `step`.

* Applied `black`.

* Streamlines commands in README a bit.

* Removes `--ccache`.

This makes only a very small difference (~1 min) with this model size, so removing
the option introduced in cdb3cc.

* Re-ran `black`.

* Update examples/controlnet/README.md

Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>

* Converts spaces to tab.

* Removes repeated args.

* Skips first step (compilation) in profiling

* Updates README with profiling instructions.

* Unifies tabs/spaces in README.

* Re-ran style & quality.

---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
2023-05-05 07:22:13 -07:00
Patrick von Platen
af0c3a7d5e [Post release] v0.16.0dev (#3072) 2023-05-05 07:22:13 -07:00
Patrick von Platen
945f3001b1 Release: v0.15.0 2023-05-05 07:22:13 -07:00
Sayak Paul
3826f99791 Fix InstructPix2Pix training in multi-GPU mode (#2978)
* fix: norm group test for UNet3D.

* fix: unet rejig.

* fix: unwrapping when running validation inputs.

* unwrapping the unet too.

* fix: device.

* better unwrapping.

* unwrapping before ema.

* unwrapping.
2023-05-05 07:22:13 -07:00
Sayak Paul
3f3ab51b39 [Examples] Fix type-casting issue in the ControlNet training script (#2994)
* fix: norm group test for UNet3D.

* fix: type-casting issue in controlnet training.
2023-05-05 07:22:13 -07:00
Chanchana Sornsoontorn
b80790f95a Fix typo and format BasicTransformerBlock attributes (#2953)
* ⚙️chore(train_controlnet) fix typo in logger message

* ⚙️chore(models) refactor modules order; make them the same as calling order

When printing the BasicTransformerBlock to stdout, I think it's crucial that the attributes order are shown in proper order. And also previously the "3. Feed Forward" comment was not making sense. It should have been close to self.ff but it's instead next to self.norm3

* correct many tests

* remove bogus file

* make style

* correct more tests

* finish tests

* fix one more

* make style

* make unclip deterministic

* ⚙️chore(models/attention) reorganize comments in BasicTransformerBlock class

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:22:12 -07:00
Will Berman
53c0c6d372 accelerate min version for ProjectConfiguration import (#3042) 2023-05-05 07:22:12 -07:00
Will Berman
2bc0a15818 config fixes (#3060) 2023-05-05 07:22:12 -07:00
Patrick von Platen
1336668f0e make style 2023-05-05 07:22:12 -07:00
J N Hearns
1ee04a5e60 Fix imports for composable_stable_diffusion pipeline (#3002)
* Update composable_stable_diffusion.py

Fix imports

* Formatting

* Formatting

* Formatting
2023-05-05 07:22:12 -07:00
Patrick von Platen
473d4d3961 Fix config prints and save, load of pipelines (#2849)
* [Config] Fix config prints and save, load

* Only use potential nn.Modules for dtype and device

* Correct vae image processor

* make sure in_channels is not accessed directly

* make sure in channels is only accessed via config

* Make sure schedulers only access config attributes

* Make sure to access config in SAG

* Fix vae processor and make style

* add tests

* uP

* make style

* Fix more naming issues

* Final fix with vae config

* change more
2023-05-05 07:22:12 -07:00
Rogério Júnior
2751633e44 Small typo correction in comments (#3012) 2023-05-05 07:22:12 -07:00
luanjintai
3de609dd66 find another one accelerate parameter error 2023-05-05 07:22:12 -07:00
luanjintai
03866af5f9 fix wrong parameter name for accelerate 2023-05-05 07:22:12 -07:00
YiYi Xu
7ee2817ae2 add Min-SNR loss to Controlnet flax train script (#3016)
* add wandb team and min-snr loss

* make style

* apply feedbacks
2023-05-05 07:22:12 -07:00
Patrick von Platen
5326243241 Update one_step_unet.py
Fix dummy community pipeline
2023-05-05 07:22:12 -07:00
YiYi Xu
2f6b212c78 minor fix in controlnet flax example (#2986)
* fix the error when push_to_hub but not log validation

* contronet_from_pt & controlnet_revision

* add intermediate checkpointing to the guide
2023-05-05 07:22:12 -07:00
Sayak Paul
a7da9c1a8f [Examples] Add support for Min-SNR weighting strategy for better convergence (#2899)
* improve stable unclip doc.

* feat: support for applying min-snr weighting for faster convergence.

* add: support for validation logging with wandb

* make  not a required arg.

* fix: arg name.

* fix: cli args.

* fix: tracker config.

* fix: loss calculation.

* fix: validation logging.

* fix: unwrap call.

* fix: validation logging.

* fix: internval.

* fix: checkpointing push to hub.

* fix: c8a2856c6d\#commitcomment-106913193

* fix: norm group test for UNet3D.

* address PR comments.

* remove unneeded code.

* add: entry in the readme and docs.

* Apply suggestions from code review

Co-authored-by: Suraj Patil <surajp815@gmail.com>

---------

Co-authored-by: Suraj Patil <surajp815@gmail.com>
2023-05-05 07:22:12 -07:00
Kadir Nar
912b8391b0 The variable name has been updated. (#2970) 2023-05-05 07:22:12 -07:00
YiYi Xu
fe03d5bce4 update flax controlnet training script (#2951)
* load_from_disk + checkpointing_steps

* apply feedback
2023-05-05 07:22:11 -07:00
YiYi Xu
a6f2d7224e allow use custom local dataset for controlnet training scripts (#2928)
use custom local datset

Co-authored-by: yiyixuxu <yixu310@gmail,com>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:22:11 -07:00
Lucain
1d3758f0a4 Use upload_folder in training scripts (#2934)
use upload folder in training scripts

Co-authored-by: testbot <lucainp@hf.co>
2023-05-05 07:22:11 -07:00
Patrick von Platen
72278553a3 make style 2023-05-05 07:22:11 -07:00
Ernie Chu
aee06e7cbb Ensure validation image RGB not RGBA (#2945)
* ensure validation image RGB not RGBA

* ensure validation image RGB not RGBA

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2023-05-05 07:22:11 -07:00