Commit Graph

1081 Commits

Author SHA1 Message Date
Suraj Patil 435433cefd
Update clip_guided_stable_diffusion.py 2022-10-06 18:38:09 +02:00
anton-l 970e30606c Revert "[v0.4.0] Temporarily remove Flax modules from the public API (#755)"
This reverts commit 2e209c30cf.
2022-10-06 18:35:40 +02:00
anton-l c15cda03ca Bump to v0.4.1.dev0 2022-10-06 18:34:59 +02:00
anton-l 0fe59b679e Merge remote-tracking branch 'origin/main' 2022-10-06 18:22:08 +02:00
anton-l 3b1d2ca1eb Release: v0.4.0 2022-10-06 18:21:57 +02:00
Suraj Patil 4581f147a6
Update clip_guided_stable_diffusion.py 2022-10-06 18:12:54 +02:00
Anton Lozhkov 2e209c30cf
[v0.4.0] Temporarily remove Flax modules from the public API (#755)
Temporarily remove Flax modules from the public API
2022-10-06 18:10:36 +02:00
Patrick von Platen 9c9462f388 Python 3.7 doesn't like keys() + keys() 2022-10-06 17:43:40 +02:00
Patrick von Platen 6613a8c7ff make CI happy 2022-10-06 17:16:01 +02:00
Patrick von Platen d9c449ea30
Custome Pipelines (#744)
* [Custom Pipelines]

* uP

* make style

* finish

* finish

* remove ipdb

* upload

* fix

* finish docs

* Apply suggestions from code review

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Co-authored-by: apolinario <joaopaulo.passos@gmail.com>

* finish

* final uploads

* remove unnecessary test

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Co-authored-by: apolinario <joaopaulo.passos@gmail.com>
2022-10-06 16:54:02 +02:00
Suraj Patil f3128c8788
Actually fix the grad ckpt test (#734)
* use_deterministic_algorithms  for grad ckpt test

* remove eval

* Apply suggestions from code review

* Update tests/test_models_unet.py
2022-10-06 16:04:00 +02:00
Anton Lozhkov 088396824d
Better steps deprecation for LMS (#753)
* Better steps deprecation for LMS

* upd
2022-10-06 15:51:25 +02:00
Anton Lozhkov 6c64741933
Raise an error when moving an fp16 pipeline to CPU (#749)
* Raise an error when moving an fp16 pipeline to CPU

* Raise an error when moving an fp16 pipeline to CPU

* style

* Update src/diffusers/pipeline_utils.py

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

* Update src/diffusers/pipeline_utils.py

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

* Improve the message

* cuda

* Update tests/test_pipelines.py

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
Co-authored-by: Suraj Patil <surajp815@gmail.com>
2022-10-06 15:51:03 +02:00
Suraj Patil 3383f77441
update the clip guided PR according to the new API (#751) 2022-10-06 15:43:48 +02:00
Anton Lozhkov df9c070174
Add back-compatibility to LMS timesteps (#750)
* Add back-compatibility to LMS timesteps

* style
2022-10-06 14:43:55 +02:00
Suraj Patil c119dc4c04
allow multiple generations per prompt (#741)
* compute text embeds per prompt

* don't repeat uncond prompts

* repeat separatly

* update image2image

* fix repeat uncond embeds

* adapt inpaint pipeline

* ifx uncond tokens in img2img

* add tests and fix ucond embeds in im2img and inpaint pipe
2022-10-06 14:01:45 +02:00
Suraj Patil 367a671a06
remove use_auth_token from for TI test (#747)
remove auth token from for TI test
2022-10-06 11:13:24 +02:00
Patrick von Platen 916754ea5e make style 2022-10-06 00:51:11 +02:00
Patrick von Platen 4deb16e830
[Docs] Advertise fp16 instead of autocast (#740)
up
2022-10-05 22:20:53 +02:00
Pedro Cuenca 5493524b71
Replace messages that have empty backquotes (#738)
Replace message with empty backquotes.

This was part of #733, I was too slow to review :)
2022-10-05 20:16:30 +02:00
Suraj Patil 19e559d5e9
remove use_auth_token from remaining places (#737)
remove use_auth_token
2022-10-05 17:40:49 +02:00
Patrick von Platen 78744b6a8f
No more use_auth_token=True (#733)
* up

* uP

* uP

* make style

* Apply suggestions from code review

* up

* finish
2022-10-05 17:16:15 +02:00
Nicolas Patry 3dcc75cbd4
Removing `autocast` for `35-25% speedup`. (`autocast` considered harmful). (#511)
* Removing `autocast` for `35-25% speedup`.

* iQuality

* Adding a slow test.

* Fixing mps noise generation.

* Raising error on wrong device, instead of just casting on behalf of user.

* Quality.

* fix merge

Co-authored-by: Nouamane Tazi <nouamane98@gmail.com>
2022-10-05 15:33:13 +02:00
Anton Lozhkov 6b09f370c4
[Scheduler design] The pragmatic approach (#719)
* init

* improve add_noise

* [debug start] run slow test

* [debug end]

* quick revert

* Add docstrings and warnings + API tests

* Make the warning less spammy
2022-10-05 14:41:19 +02:00
Kashif Rasul 726aba089d
[Pytorch] pytorch only timesteps (#724)
* pytorch timesteps

* style

* get rid of if-else

* fix test

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-10-05 12:55:51 +02:00
Yuta Hayashibe 60c9634a5e
Avoid negative strides for tensors (#717)
* Avoid negative strides for tensors

* Changed not to make torch.tensor

* Removed a needless copy
2022-10-05 12:45:01 +02:00
Kane Wallmann b9eea06e9f
Include CLIPTextModel parameters in conversion (#695) 2022-10-05 12:22:07 +02:00
Pierre LeMoine 08d4fb6e9f
[dreambooth] Using already created `Path` in dataset (#681)
using already created `Path` in dataset
2022-10-05 12:14:30 +02:00
Patrick von Platen a8a3a20d36
[Tests] Add accelerate to testing (#729)
* fix accelerate for testing

* fix copies

* uP
2022-10-05 11:35:02 +02:00
NIKHIL A V 7265dd8cc8
renamed x to meaningful variable in resnet.py (#677)
* renamed single letter variables

* renamed x to meaningful variable in resnet.py

Hello @patil-suraj can you verify it
Thanks

* Reformatted using black

* renamed x to meaningful variable in resnet.py

Hello @patil-suraj can you verify it
Thanks

* reformatted the files

* modified unboundlocalerror in line 374

* removed referenced before error

* renamed single variable x -> hidden_state, p-> pad_value

Co-authored-by: Nikhil A V <nikhilav@Nikhils-MacBook-Pro.local>
Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Suraj Patil <surajp815@gmail.com>
2022-10-04 23:52:24 +02:00
Suraj Patil 14b9754923
[train_unconditional] fix applying clip_grad_norm_ (#721)
fix clip_grad_norm_
2022-10-04 19:04:05 +02:00
Pedro Cuenca 6b221920d7
Remove comments no longer appropriate (#716)
Remove comments no longer appropriate.

There were casting operations before, they are now gone.
2022-10-04 17:00:09 +02:00
Pedro Cuenca 215bb40882
Fix import if PyTorch is not installed (#715)
* Fix import if PyTorch is not installed.

* Style (blank line)
2022-10-04 16:59:49 +02:00
Yuta Hayashibe 5ac1f61cde
Add an argument "negative_prompt" (#549)
* Add an argument "negative_prompt"

* Fix argument order

* Fix to use TypeError instead of ValueError

* Removed needless batch_size multiplying

* Fix to multiply by batch_size

* Add truncation=True for long negative prompt

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_onnx.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py

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

* Update src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_onnx.py

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

* Fix styles

* Renamed ucond_tokens to uncond_tokens

* Added description about "negative_prompt"

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-10-04 16:55:38 +02:00
Yuta Hayashibe 7e92c5bc73
Fix typos (#718)
* Fix typos

* Update examples/dreambooth/train_dreambooth.py

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

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2022-10-04 15:22:14 +02:00
Pi Esposito 4d1cce2fd0
add accelerate to load models with smaller memory footprint (#361)
* add accelerate to load models with smaller memory footprint

* remove low_cpu_mem_usage as it is reduntant

* move accelerate init weights context to modelling utils

* add test to ensure results are the same when loading with accelerate

* add tests to ensure ram usage gets lower when using accelerate

* move accelerate logic to single snippet under modelling utils and remove it from configuration utils

* format code using to pass quality check

* fix imports with isor

* add accelerate to test extra deps

* only import accelerate if device_map is set to auto

* move accelerate availability check to diffusers import utils

* format code

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-10-04 15:21:40 +02:00
Tanishq Abraham 09859a3cd0
Update schedulers README.md (#694)
* Update links in schedulers README.md

* Update src/diffusers/schedulers/README.md

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

Co-authored-by: Pedro Cuenca <pedro@huggingface.co>
2022-10-04 15:06:21 +02:00
Kashif Rasul f1b9ee7ed9
[Docs] fix docstring for issue #709 (#710)
fix docstring

fixes #709
2022-10-04 15:06:11 +02:00
Josh Achiam 4ff4d4db12
Checkpoint conversion script from Diffusers => Stable Diffusion (CompVis) (#701)
* Conversion script

* ran black

* ran isort

* remove unused import

* map location so everything gets loaded onto CPU before conversion

* ran black again

* Update setup.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
2022-10-04 13:33:38 +02:00
Patrick von Platen f1484b81b0
[Utils] Add deprecate function and move testing_utils under utils (#659)
* [Utils] Add deprecate function

* up

* up

* uP

* up

* up

* up

* up

* uP

* up

* fix

* up

* move to deprecation utils file

* fix

* fix

* fix more
2022-10-03 23:44:24 +02:00
Anton Lozhkov 1070e1a38a
[CI] Speed up slow tests (#708)
* [CI] Localize the HF cache

* pip cache

* de-env

* refactor matrix

* fix fast cache

* less onnx steps

* revert

* revert pip cache

* revert pip cache

* remove debugging trigger
2022-10-03 22:16:23 +02:00
Patrick von Platen b35bac4d3b
[Support PyTorch 1.8] Remove inference mode (#707) 2022-10-03 22:14:58 +02:00
Pedro Cuenca 688031c592
Fix import with Flax but without PyTorch (#688)
* Don't use `load_state_dict` if torch is not installed.

* Define `SchedulerOutput` to use torch or flax arrays.

* Don't import LMSDiscreteScheduler without torch.

* Create distinct FlaxSchedulerOutput.

* Additional changes required for FlaxSchedulerMixin

* Do not import torch pipelines in Flax.

* Revert "Define `SchedulerOutput` to use torch or flax arrays."

This reverts commit f653140134b74d9ffec46d970eb46925fe3a409d.

* Prefix Flax scheduler outputs for consistency.

* make style

* FlaxSchedulerOutput is now a dataclass.

* Don't use f-string without placeholders.

* Add blank line.

* Style (docstrings)
2022-10-03 16:23:45 +02:00
Krishna Penukonda 7d0ba5921b
Fix type annotations on StableDiffusionPipeline.__call__ (#682)
Fixed type annotations on StableDiffusionPipeline::__call__
2022-10-03 15:38:24 +02:00
Pedro Cuenca 249b36cc38
Flax: add shape argument to `set_timesteps` (#690)
* Flax: add shape argument to set_timesteps

* style
2022-10-03 15:07:09 +02:00
Patrick von Platen 500ca5a907
Forgot to add the OG! 2022-10-03 13:15:07 +02:00
Suraj Patil 14f4af8f5b
[dreambooth] fix applying clip_grad_norm_ (#686)
fix applying clip grad norm
2022-10-03 10:54:01 +02:00
James R T 2558977bc7
Add callback parameters for Stable Diffusion pipelines (#521)
* Add callback parameters for Stable Diffusion pipelines

Signed-off-by: James R T <jamestiotio@gmail.com>

* Lint code with `black --preview`

Signed-off-by: James R T <jamestiotio@gmail.com>

* Refactor callback implementation for Stable Diffusion pipelines

* Fix missing imports

Signed-off-by: James R T <jamestiotio@gmail.com>

* Fix documentation format

Signed-off-by: James R T <jamestiotio@gmail.com>

* Add kwargs parameter to standardize with other pipelines

Signed-off-by: James R T <jamestiotio@gmail.com>

* Modify Stable Diffusion pipeline callback parameters

Signed-off-by: James R T <jamestiotio@gmail.com>

* Remove useless imports

Signed-off-by: James R T <jamestiotio@gmail.com>

* Change types for timestep and onnx latents

* Fix docstring style

* Return decode_latents and run_safety_checker back into __call__

* Remove unused imports

* Add intermediate state tests for Stable Diffusion pipelines

Signed-off-by: James R T <jamestiotio@gmail.com>

* Fix intermediate state tests for Stable Diffusion pipelines

Signed-off-by: James R T <jamestiotio@gmail.com>

Signed-off-by: James R T <jamestiotio@gmail.com>
2022-10-02 19:56:36 +02:00
Omar Sanseviero 5156acc476
Fix BibText citation (#693)
* Fix BibText citation

* Update README.md
2022-10-01 10:15:32 +02:00
Nouamane Tazi b2cfc7a04c
Fix slow tests (#689)
* revert using baddbmm in attention
- to fix `test_stable_diffusion_memory_chunking` test

* styling
2022-09-30 18:45:02 +02:00