From b6086bdf876838ff582188d693fea54606581281 Mon Sep 17 00:00:00 2001 From: Chengsong Zhang Date: Fri, 20 Oct 2023 20:35:19 -0500 Subject: [PATCH] remove commented code --- scripts/animatediff_mm.py | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/scripts/animatediff_mm.py b/scripts/animatediff_mm.py index 6f61ea02..fb44eebd 100644 --- a/scripts/animatediff_mm.py +++ b/scripts/animatediff_mm.py @@ -4,15 +4,11 @@ import torch from einops import rearrange -# from ldm.modules.attention import SpatialTransformer -# from ldm.modules.diffusionmodules.openaimodel import (TimestepBlock, -# TimestepEmbedSequential) from ldm.modules.diffusionmodules.util import GroupNorm32 from modules import hashes, shared, sd_models from modules.devices import cpu, device, torch_gc from motion_module import MotionWrapper -# from motion_module import VanillaTemporalModule from scripts.animatediff_logger import logger_animatediff as logger @@ -25,7 +21,6 @@ def __init__(self): self.prev_alpha_cumprod = None self.prev_alpha_cumprod_prev = None self.gn32_original_forward = None - # self.tes_original_forward = None def set_script_dir(self, script_dir): @@ -77,19 +72,7 @@ def inject(self, sd_model, model_name="mm_sd_v15.ckpt"): self._load(model_name) self.gn32_original_forward = GroupNorm32.forward gn32_original_forward = self.gn32_original_forward - # self.tes_original_forward = TimestepEmbedSequential.forward - - # def mm_tes_forward(self, x, emb, context=None): - # for layer in self: - # if isinstance(layer, TimestepBlock): - # x = layer(x, emb) - # elif isinstance(layer, (SpatialTransformer, VanillaTemporalModule)): - # x = layer(x, context) - # else: - # x = layer(x) - # return x - - # TimestepEmbedSequential.forward = mm_tes_forward + if self.mm.using_v2: logger.info(f"Injecting motion module {model_name} into SD1.5 UNet middle block.") unet.middle_block.insert(-1, self.mm.mid_block.motion_modules[0]) @@ -146,7 +129,6 @@ def restore(self, sd_model): else: logger.info(f"Restoring GroupNorm32 forward function.") GroupNorm32.forward = self.gn32_original_forward - # TimestepEmbedSequential.forward = self.tes_original_forward logger.info(f"Removal finished.") if shared.cmd_opts.lowvram: self.unload()