From b7538664372b7869d23cd4745b0a2e2e8fddbdf6 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Sat, 27 Jul 2024 22:39:15 +0530 Subject: [PATCH 1/3] fix: animate diff lora stuff. --- src/diffusers/loaders/peft.py | 1 + src/diffusers/models/unets/unet_motion_model.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/diffusers/loaders/peft.py b/src/diffusers/loaders/peft.py index 5625f9755b19..bca983596b3f 100644 --- a/src/diffusers/loaders/peft.py +++ b/src/diffusers/loaders/peft.py @@ -31,6 +31,7 @@ _SET_ADAPTER_SCALE_FN_MAPPING = { "UNet2DConditionModel": _maybe_expand_lora_scales, "SD3Transformer2DModel": lambda model_cls, weights: weights, + "UNetMotionModel": lambda model_cls, weights: weights, } diff --git a/src/diffusers/models/unets/unet_motion_model.py b/src/diffusers/models/unets/unet_motion_model.py index 196f947d599b..c8ea0ecc3feb 100644 --- a/src/diffusers/models/unets/unet_motion_model.py +++ b/src/diffusers/models/unets/unet_motion_model.py @@ -19,7 +19,7 @@ import torch.utils.checkpoint from ...configuration_utils import ConfigMixin, FrozenDict, register_to_config -from ...loaders import FromOriginalModelMixin, UNet2DConditionLoadersMixin +from ...loaders import FromOriginalModelMixin, PeftAdapterMixin, UNet2DConditionLoadersMixin from ...utils import logging from ..attention_processor import ( ADDED_KV_ATTENTION_PROCESSORS, @@ -231,7 +231,7 @@ def forward(self, sample): pass -class UNetMotionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin): +class UNetMotionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin, PeftAdapterMixin): r""" A modified conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a sample shaped output. From 2cbcc24df84e7a7bbadb93f6f21a6004d2f1a155 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 29 Jul 2024 11:00:01 +0530 Subject: [PATCH 2/3] fix scaling function for UNetMotionModel --- src/diffusers/loaders/peft.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diffusers/loaders/peft.py b/src/diffusers/loaders/peft.py index bca983596b3f..fd6c639a7cdf 100644 --- a/src/diffusers/loaders/peft.py +++ b/src/diffusers/loaders/peft.py @@ -30,8 +30,8 @@ _SET_ADAPTER_SCALE_FN_MAPPING = { "UNet2DConditionModel": _maybe_expand_lora_scales, + "UNetMotionModel": _maybe_expand_lora_scales, "SD3Transformer2DModel": lambda model_cls, weights: weights, - "UNetMotionModel": lambda model_cls, weights: weights, } From ef785c4cd64e939af3af90f7bbe10da7a54c9623 Mon Sep 17 00:00:00 2001 From: sayakpaul Date: Mon, 29 Jul 2024 18:58:56 +0530 Subject: [PATCH 3/3] emoty