Merge modular diffusers with main (#11893) · huggingface/diffusers@de7cdf6 · GitHub
Skip to content

Commit de7cdf6

Browse files
a-r-r-o-wDN6
andauthored
Merge modular diffusers with main (#11893)
* [CI] Fix big GPU test marker (#11786) * update * update * First Block Cache (#11180) * update * modify flux single blocks to make compatible with cache techniques (without too much model-specific intrusion code) * remove debug logs * update * cache context for different batches of data * fix hs residual bug for single return outputs; support ltx * fix controlnet flux * support flux, ltx i2v, ltx condition * update * update * Update docs/source/en/api/cache.md * Update src/diffusers/hooks/hooks.py Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com> * address review comments pt. 1 * address review comments pt. 2 * cache context refacotr; address review pt. 3 * address review comments * metadata registration with decorators instead of centralized * support cogvideox * support mochi * fix * remove unused function * remove central registry based on review * update --------- Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com> * fix --------- Co-authored-by: Dhruv Nair <dhruv.nair@gmail.com>
1 parent 73c5fe8 commit de7cdf6

42 files changed

Lines changed: 687 additions & 268 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/nightly_tests.yml‎

Lines changed: 1 addition & 1 deletion

‎docs/source/en/api/cache.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ Cache methods speedup diffusion transformers by storing and reusing intermediate
2828
[[autodoc]] FasterCacheConfig
2929

3030
[[autodoc]] apply_faster_cache
31+
32+
### FirstBlockCacheConfig
33+
34+
[[autodoc]] FirstBlockCacheConfig
35+
36+
[[autodoc]] apply_first_block_cache

‎src/diffusers/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@
147147
_import_structure["hooks"].extend(
148148
[
149149
"FasterCacheConfig",
150+
"FirstBlockCacheConfig",
150151
"HookRegistry",
151152
"LayerSkipConfig",
152153
"PyramidAttentionBroadcastConfig",
153154
"SmoothedEnergyGuidanceConfig",
154155
"apply_faster_cache",
156+
"apply_first_block_cache",
155157
"apply_layer_skip",
156158
"apply_pyramid_attention_broadcast",
157159
]
@@ -793,11 +795,13 @@
793795
)
794796
from .hooks import (
795797
FasterCacheConfig,
798+
FirstBlockCacheConfig,
796799
HookRegistry,
797800
LayerSkipConfig,
798801
PyramidAttentionBroadcastConfig,
799802
SmoothedEnergyGuidanceConfig,
800803
apply_faster_cache,
804+
apply_first_block_cache,
801805
apply_layer_skip,
802806
apply_pyramid_attention_broadcast,
803807
)

‎src/diffusers/hooks/__init__.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
# Copyright 2024 The HuggingFace Team. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from ..utils import is_torch_available
216

317

418
if is_torch_available():
519
from .faster_cache import FasterCacheConfig, apply_faster_cache
20+
from .first_block_cache import FirstBlockCacheConfig, apply_first_block_cache
621
from .group_offloading import apply_group_offloading
722
from .hooks import HookRegistry, ModelHook
823
from .layer_skip import LayerSkipConfig, apply_layer_skip

‎src/diffusers/hooks/_helpers.py‎

Lines changed: 67 additions & 74 deletions

0 commit comments

Comments
 (0)