Fabio Rigano
44aa9e566d
fix AnimateDiff creation with a unet loaded with IP Adapter ( #7791 )
...
* Fix loading from_pipe
* Fix style
---------
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-05-13 08:15:01 -10:00
Γlvaro Somoza
fdb05f54ef
Official callbacks ( #7761 )
2024-05-12 17:10:29 -10:00
Sayak Paul
5bb38586a9
[Core] fix offload behaviour when device_map is enabled. ( #7919 )
...
fix offload behaviour when device_map is enabled.
2024-05-12 13:29:43 +02:00
momo
e4f8dca9a0
add custom sigmas and timesteps for StableDiffusionXLControlNet pipeline ( #7913 )
...
add custom sigmas and timesteps
2024-05-11 23:33:19 -10:00
Mark Van Aken
be4afa0bb4
#7535 Update FloatTensor type hints to Tensor ( #7883 )
...
* find & replace all FloatTensors to Tensor
* apply formatting
* Update torch.FloatTensor to torch.Tensor in the remaining files
* formatting
* Fix the rest of the places where FloatTensor is used as well as in documentation
* formatting
* Update new file from FloatTensor to Tensor
2024-05-10 09:53:31 -10:00
Sayak Paul
04f4bd54ea
[Core] introduce videoprocessor. ( #7776 )
...
* introduce videoprocessor.
* fix quality
* address yiyi's feedback
* fix preprocess_video call.
* video_processor -> image_processor
* fix
* fix more.
* quality
* image_processor -> video_processor
* support List[List[PIL.Image.Image]]
* change to video_processor.
* documentation
* Apply suggestions from code review
* changes
* remove print.
* refactor video processor (part # 7776) (#7861 )
* update
* update remove deprecate
* Update src/diffusers/video_processor.py
* update
* Apply suggestions from code review
* deprecate list of 5d for video and list of 4d for image + apply other feedbacks
* up
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
* add doc.
* tensor2vid -> postprocess_video.
* refactor preprocess with preprocess_video
* set default values.
* empty commit
* more refactoring of prepare_latents in animatediff vid2vid
* checking documentation
* remove documentation for now.
* fix animatediff sdxl
* fix test failure [part of video processor PR] (#7905 )
up
* remove preceed_with_frames.
* doc
* fix
* fix
* remove video input as a single-frame video.
---------
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-05-10 21:02:36 +02:00
YiYi Xu
b934215d4c
[scheduler] support custom timesteps and sigmas ( #7817 )
...
* support custom sigmas and timesteps, dpm euler
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
Co-authored-by: Benjamin Bossan <BenjaminBossan@users.noreply.github.com >
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com >
2024-05-09 11:07:43 -10:00
YiYi Xu
5ed3abd371
fix _optional_components in StableCascadeCombinedPipeline ( #7894 )
...
* fix
* up
2024-05-09 06:32:55 -10:00
Sayak Paul
305f2b4498
[Tests] fix things after #7013 ( #7899 )
...
* debugging
* save the resulting image
* check if order reversing works.
* checking values.
* up
* okay
* checking
* fix
* remove print
2024-05-09 16:05:35 +02:00
Dhruv Nair
cb0f3b49cb
[Refactor] Better align from_single_file logic with from_pretrained ( #7496 )
...
* 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: Sayak Paul <spsayakpaul@gmail.com >
* Update docs/source/en/api/single_file.md
Co-authored-by: Sayak 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: YiYi Xu <yixu310@gmail.com >
* Update src/diffusers/loaders/single_file.py
Co-authored-by: YiYi Xu <yixu310@gmail.com >
* Update docs/source/en/api/loaders/single_file.md
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
* Update docs/source/en/api/loaders/single_file.md
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
* Update docs/source/en/api/loaders/single_file.md
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
* Update docs/source/en/api/loaders/single_file.md
Co-authored-by: Sayak 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: sayakpaul <spsayakpaul@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-05-09 19:00:19 +05:30
Tolga CangΓΆz
caf9e985df
Fix several imports ( #7712 )
...
Fix imports
2024-05-09 07:34:44 +02:00
Tolga CangΓΆz
c1c42698c9
Remove dead code and fix f-string issue ( #7720 )
...
* Remove dead code
* PylancereportGeneralTypeIssues: Strings nested within an f-string cannot use the same quote character as the f-string prior to Python 3.12.
* Remove dead code
2024-05-08 13:15:28 -10:00
Pierre Dulac
75aab34675
Allow users to save SDXL LoRA weights for only one text encoder ( #7607 )
...
SDXL LoRA weights for text encoders should be decoupled on save
The method checks if at least one of unet, text_encoder and
text_encoder_2 lora weights are passed, which was not reflected in the
implentation.
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-05-08 10:41:58 -10:00
Aryan
818f760732
[Pipeline] AnimateDiff SDXL ( #6721 )
...
* update conversion script to handle motion adapter sdxl checkpoint
* add animatediff xl
* handle addition_embed_type
* fix output
* update
* add imports
* make fix-copies
* add decode latents
* update docstrings
* add animatediff sdxl to docs
* remove unnecessary lines
* update example
* add test
* revert conv_in conv_out kernel param
* remove unused param addition_embed_type_num_heads
* latest IPAdapter impl
* make fix-copies
* fix return
* add IPAdapterTesterMixin to tests
* fix return
* revert based on suggestion
* add freeinit
* fix test_to_dtype test
* use StableDiffusionMixin instead of different helper methods
* fix progress bar iterations
* apply suggestions from review
* hardcode flip_sin_to_cos and freq_shift
* make fix-copies
* fix ip adapter implementation
* fix last failing test
* make style
* Update docs/source/en/api/pipelines/animatediff.md
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
* remove todo
* fix doc-builder errors
---------
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-05-08 21:27:14 +05:30
Philip Pham
f29b93488d
Check shape and remove deprecated APIs in scheduling_ddpm_flax.py ( #7703 )
...
`model_output.shape` may only have rank 1.
There are warnings related to use of random keys.
```
tests/schedulers/test_scheduler_flax.py: 13 warnings
/Users/phillypham/diffusers/src/diffusers/schedulers/scheduling_ddpm_flax.py:268: FutureWarning: normal accepts a single key, but was given a key array of shape (1, 2) != (). Use jax.vmap for batching. In a future JAX version, this will be an error.
noise = jax.random.normal(split_key, shape=model_output.shape, dtype=self.dtype)
tests/schedulers/test_scheduler_flax.py::FlaxDDPMSchedulerTest::test_betas
/Users/phillypham/virtualenv/diffusers/lib/python3.9/site-packages/jax/_src/random.py:731: FutureWarning: uniform accepts a single key, but was given a key array of shape (1,) != (). Use jax.vmap for batching. In a future JAX version, this will be an error.
u = uniform(key, shape, dtype, lo, hi) # type: ignore[arg-type]
```
2024-05-08 13:57:19 +02:00
Tolga CangΓΆz
d50baf0c63
Fix image upcasting ( #7858 )
...
Fix image's upcasting before `vae.encode()` when using `fp16`
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-05-07 16:45:02 -10:00
Γlvaro Somoza
23e091564f
Fix for "no lora weight found module" with some loras ( #7875 )
...
* return layer weight if not found
* better system and test
* key example and typo
2024-05-07 13:54:57 +02:00
HelloWorldBeginner
58237364b1
Add Ascend NPU support for SDXL fine-tuning and fix the model saving bug when using DeepSpeed. ( #7816 )
...
* Add Ascend NPU support for SDXL fine-tuning and fix the model saving bug when using DeepSpeed.
* fix check code quality
* Decouple the NPU flash attention and make it an independent module.
* add doc and unit tests for npu flash attention.
---------
Co-authored-by: mhh001 <mahonghao1@huawei.com >
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-05-03 08:14:34 -10:00
Lucain
6a479588db
Respect resume_download deprecation ( #7843 )
...
* Deprecate resume_download
* align docstring with transformers
* style
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-05-03 08:42:57 +02:00
yunseong Cho
c1b2a89e34
Fix key error for dictionary with randomized order in convert_ldm_unet_checkpoint ( #7680 )
...
fix key error for different order
Co-authored-by: yunseong <yunseong.cho@superlabs.us >
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-05-02 10:29:55 +05:30
YiYi Xu
5915c2985d
[ip-adapter] fix ip-adapter for StableDiffusionInstructPix2PixPipeline ( #7820 )
...
update prepare_ip_adapter_ for pix2pix
2024-05-01 06:27:43 -10:00
YiYi Xu
21a7ff12a7
update the logic of is_sequential_cpu_offload ( #7788 )
...
* up
* add comment to the tests + fix dit
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-05-01 06:25:57 -10:00
Tolga CangΓΆz
b8ccb46259
Fix CPU offload in docstring ( #7827 )
...
Fix cpu offload
2024-04-30 10:53:27 -07:00
Sayak Paul
3fd31eef51
[Core] introduce _no_split_modules to ModelMixin ( #6396 )
...
* introduce _no_split_modules.
* unnecessary spaces.
* remove unnecessary kwargs and style
* fix: accelerate imports.
* change to _determine_device_map
* add the blocks that have residual connections.
* add: CrossAttnUpBlock2D
* add: testin
* style
* line-spaces
* quality
* add disk offload test without safetensors.
* checking disk offloading percentages.
* change model split
* add: utility for checking multi-gpu requirement.
* model parallelism test
* splits.
* splits.
* splits
* splits.
* splits.
* splits.
* offload folder to test_disk_offload_with_safetensors
* add _no_split_modules
* fix-copies
2024-04-30 08:46:51 +05:30
Clint Adams
f53352f750
Set main_input_name in StableDiffusionSafetyChecker to "clip_input" ( #7500 )
...
FlaxStableDiffusionSafetyChecker sets main_input_name to "clip_input".
This makes StableDiffusionSafetyChecker consistent.
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-04-29 11:39:59 -10:00
RuiningLi
83ae24ce2d
Added get_velocity function to EulerDiscreteScheduler. ( #7733 )
...
* Added get_velocity function to EulerDiscreteScheduler.
* Fix white space on blank lines
* Added copied from statement
* back to the original.
---------
Co-authored-by: Ruining Li <ruining@robots.ox.ac.uk >
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-29 10:32:13 -10:00
jschoormans
8af793b2d4
Adding TextualInversionLoaderMixin for the controlnet_inpaint_sd_xl pipeline ( #7288 )
...
* added TextualInversionMixIn to controlnet_inpaint_sd_xl pipeline
---------
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-04-29 09:00:53 -10:00
Yushu
a38dd79512
[Pipeline] Fix error of SVD pipeline when num_videos_per_prompt > 1 ( #7786 )
...
swap the order for do_classifier_free_guidance concat with repeat
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-04-29 16:24:16 +05:30
Nilesh
235d34cf56
Check for latents, before calling prepare_latents - sdxlImg2Img ( #7582 )
...
* Check for latents, before calling prepare_latents - sdxlImg2Img
* Added latents check for all the img2img pipeline
* Fixed silly mistake while checking latents as None
2024-04-28 14:53:29 -10:00
Sayak Paul
56bd7e67c2
[Scheduler] introduce sigma schedule. ( #7649 )
...
* introduce sigma schedule.
Co-authored-by: Suraj Patil <surajp815@gmail.com >
* address yiyi
* update docstrings.
* implement the schedule for EDMDPMSolverMultistepScheduler
---------
Co-authored-by: Suraj Patil <surajp815@gmail.com >
2024-04-27 07:40:35 +05:30
39th president of the United States, probably
9d16daaf64
Add DREAM training ( #6381 )
...
A new function compute_dream_and_update_latents has been added to the
training utilities that allows you to do DREAM rectified training in line
with the paper https://arxiv.org/abs/2312.00210 . The method can be used
with an extra argument in the train_text_to_image.py script.
Co-authored-by: Jimmy <39@πΊπΈ .com>
2024-04-27 07:19:15 +05:30
Beinsezii
0d2d424fbe
Add PixArtSigmaPipeline to AutoPipeline mapping ( #7783 )
2024-04-26 09:10:20 -10:00
Steven Liu
e24e54fdfa
[docs] Fix AutoPipeline docstring ( #7779 )
...
fix
Co-authored-by: YiYi Xu <yixu310@gmail.com >
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-26 10:09:36 -07:00
btlorch
ebc99a77aa
Convert RGB to BGR for the SDXL watermark encoder ( #7013 )
...
* Convert channel order to BGR for the watermark encoder. Convert the watermarked BGR images back to RGB. Fixes #6292
* Revert channel order before stacking images to overcome limitations that negative strides are currently not supported
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-25 14:44:53 -10:00
Sayak Paul
142f353e1c
Fix lora device test ( #7738 )
...
* fix lora device test
* fix more.
* fix more/
* quality
* empty
---------
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-04-25 18:05:27 +05:30
Sayak Paul
e963621649
[PixArt] fix small nits in pixart sigma ( #7767 )
...
fix small nits in pixart sigma
2024-04-25 06:37:35 +05:30
Junsong Chen
39215aa30e
PixArt-Sigma Implementation ( #7654 )
...
* support PixArt-DMD
---------
Co-authored-by: jschen <chenjunsong4@h-partners.com >
Co-authored-by: badayvedat <badayvedat@gmail.com >
Co-authored-by: Vedat Baday <54285744+badayvedat@users.noreply.github.com >
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
Co-authored-by: yiyixuxu <yixu310@gmail,com>
2024-04-23 22:33:08 -10:00
Sai-Suraj-27
fc9fecc217
fix: Fixed a wrong decorator by modifying it to @classmethod ( #7653 )
...
* Fixed wrong decorator by modifying it to @classmethod.
* Updated the method and it's argument.
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-22 14:41:35 -10:00
Fabio Rigano
065f251766
Restore AttnProcessor2_0 in unload_ip_adapter ( #7727 )
...
* Restore AttnProcessor2_0 in unload_ip_adapter
* Fix style
* Update test
---------
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-04-22 13:59:03 -10:00
Jenyuan-Huang
21c747fa0f
Support InstantStyle ( #7668 )
...
* enable control ip-adapter per-transformer block on-the-fly
---------
Co-authored-by: sayakpaul <spsayakpaul@gmail.com >
Co-authored-by: ResearcherXman <xhs.research@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-04-22 13:20:19 -10:00
Phil Butler
09129842e7
Remove redundant lines ( #7396 )
...
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
Co-authored-by: YiYi Xu <yixu310@gmail.com >
2024-04-22 09:32:16 -10:00
Sai-Suraj-27
db969cc16d
fix: Fixed type annotations for compatability with python 3.8 ( #7648 )
...
* Fixed type annotations for compatability with python 3.8
* Add required imports.
2024-04-18 19:34:09 -10:00
Dhruv Nair
3cfe187dc7
Cleanup ControlnetXS ( #7701 )
...
* update
* update
2024-04-18 19:32:00 -10:00
Dhruv Nair
90250d9e48
Cast height, width to int inside prepare latents ( #7691 )
...
update
2024-04-18 19:30:39 -10:00
YiYi Xu
e5674015f3
adding back test_conversion_when_using_device_map ( #7704 )
...
* style
* Fix device map nits (#7705 )
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-18 19:21:32 -10:00
Fabio Rigano
b5c8b555d7
Move IP Adapter Face ID to core ( #7186 )
...
* Switch to peft and multi proj layers
* Move Face ID loading and inference to core
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com >
2024-04-18 14:13:27 -10:00
Sayak Paul
9d50f7eec1
[Core] is_cosxl_edit arg in SDXL ip2p. ( #7650 )
...
* is_cosxl_edit arg in SDXL ip2p.
* Empty-Commit
Co-authored-by: Yiyi Xu <yixu310@gmail.com >
* doc
* remove redundant logic.
* reflect drhuv's comments.
---------
Co-authored-by: Yiyi Xu <yixu310@gmail.com >
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-04-16 22:15:55 +05:30
UmerHA
fda1531d8a
Fixing implementation of ControlNet-XS ( #6772 )
...
* CheckIn - created DownSubBlocks
* Added extra channels, implemented subblock fwd
* Fixed connection sizes
* checkin
* Removed iter, next in forward
* Models for SD21 & SDXL run through
* Added back pipelines, cleared up connections
* Cleaned up connection creation
* added debug logs
* updated logs
* logs: added input loading
* Update umer_debug_logger.py
* log: Loading hint
* Update umer_debug_logger.py
* added logs
* Changed debug logging
* debug: added more logs
* Fixed num_norm_groups
* Debug: Logging all of SDXL input
* Update umer_debug_logger.py
* debug: updated logs
* checkim
* Readded tests
* Removed debug logs
* Fixed Slow Tests
* Added value ckecks | Updated model_cpu_offload_seq
* accelerate-offloading works ; fast tests work
* Made unet & addon explicit in controlnet
* Updated slow tests
* Added dtype/device to ControlNetXS
* Filled in test model paths
* Added image_encoder/feature_extractor to XL pipe
* Fixed fast tests
* Added comments and docstrings
* Fixed copies
* Added docs ; Updates slow tests
* Moved changes to UNetMidBlock2DCrossAttn
* tiny cleanups
* Removed stray prints
* Removed ip adapters + freeU
- Removed ip adapters + freeU as they don't make sense for ControlNet-XS
- Fixed imports of UNet components
* Fixed test_save_load_float16
* Make style, quality, fix-copies
* Changed loading/saving API for ControlNetXS
- Changed loading/saving API for ControlNetXS
- other small fixes
* Removed ControlNet-XS from research examples
* Make style, quality, fix-copies
* Small fixes
- deleted ControlNetXSModel.init_original
- added time_embedding_mix to StableDiffusionControlNetXSPipeline .from_pretrained / StableDiffusionXLControlNetXSPipeline.from_pretrained
- fixed copy hints
* checkin May 11 '23
* CheckIn Mar 12 '24
* Fixed tests for SD
* Added tests for UNetControlNetXSModel
* Fixed SDXL tests
* cleanup
* Delete Pipfile
* CheckIn Mar 20
Started replacing sub blocks by `ControlNetXSCrossAttnDownBlock2D` and `ControlNetXSCrossAttnUplock2D`
* check-in Mar 23
* checkin 24 Mar
* Created init for UNetCnxs and CnxsAddon
* CheckIn
* Made from_modules, from_unet and no_control work
* make style,quality,fix-copies & small changes
* Fixed freezing
* Added gradient ckpt'ing; fixed tests
* Fix slow tests(+compile) ; clear naming confusion
* Don't create UNet in init ; removed class_emb
* Incorporated review feedback
- Deleted get_base_pipeline / get_controlnet_addon for pipes
- Pipes inherit from StableDiffusionXLPipeline
- Made module dicts for cnxs-addon's down/mid/up classes
- Added support for qkv fusion and freeU
* Make style, quality, fix-copies
* Implemented review feedback
* Removed compatibility check for vae/ctrl embedding
* make style, quality, fix-copies
* Delete Pipfile
* Integrated review feedback
- Importing ControlNetConditioningEmbedding now
- get_down/mid/up_block_addon now outside class
- renamed `do_control` to `apply_control`
* Reduced size of test tensors
For this, added `norm_num_groups` as parameter everywhere
* Renamed cnxs-`Addon` to cnxs-`Adapter`
- `ControlNetXSAddon` -> `ControlNetXSAdapter`
- `ControlNetXSAddonDownBlockComponents` -> `DownBlockControlNetXSAdapter`, and similarly for mid/up
- `get_mid_block_addon` -> `get_mid_block_adapter`, and similarly for mid/up
* Fixed save_pretrained/from_pretrained bug
* Removed redundant code
---------
Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com >
2024-04-16 21:56:20 +05:30
Benjamin Bossan
2523390c26
FIX Setting device for DoRA parameters ( #7655 )
...
Fix a bug that causes the the call to set_lora_device to ignore the DoRA
parameters.
2024-04-12 13:55:46 +02:00
Sai-Suraj-27
279de3c3ff
fix: Replaced deprecated logger.warn with logger.warning ( #7643 )
...
Fixed deprecated logger.warn with logger.warning.
2024-04-11 09:43:01 -10:00