Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert to use skip_keys
  • Loading branch information
DN6 committed Dec 5, 2025
commit c888aac570dfb7e2430b835a7481ad15e84df8b4
4 changes: 2 additions & 2 deletions src/diffusers/hooks/group_offloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def apply_group_offloading(
exclude_kwargs (`List[str]`, *optional*):
List of kwarg keys that should not be processed by send_to_device. This is useful for mutable state like
caching lists that need to maintain their object identity across forward passes. If not provided, will be
inferred from the module's `_group_offload_exclude_kwargs` attribute if it exists.
inferred from the module's `_skip_keys` attribute if it exists.

Example:
```python
Expand Down Expand Up @@ -581,7 +581,7 @@ def apply_group_offloading(
block_modules = getattr(module, "_group_offload_block_modules", None)

if exclude_kwargs is None:
exclude_kwargs = getattr(module, "_group_offload_exclude_kwargs", None)
exclude_kwargs = getattr(module, "_skip_keys", None)

config = GroupOffloadingConfig(
onload_device=onload_device,
Expand Down
8 changes: 3 additions & 5 deletions src/diffusers/models/autoencoders/autoencoder_kl_wan.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,11 +963,9 @@ class AutoencoderKLWan(ModelMixin, AutoencoderMixin, ConfigMixin, FromOriginalMo

_supports_gradient_checkpointing = False
_group_offload_block_modules = ["quant_conv", "post_quant_conv", "encoder", "decoder"]

# kwargs to ignore when send_to_device moves inputs/outputs between devices
# these are shared mutable states that are modified in-place and
# should not be subjected to copy operations
_group_offload_exclude_kwargs = ["feat_cache", "feat_idx"]
# keys toignore when AlignDeviceHook moves inputs/outputs between devices
# these are shared mutable state modified in-place
_skip_keys = ["feat_cache", "feat_idx"]

@register_to_config
def __init__(
Expand Down