Skip to content

Commit

Permalink
Merge pull request #8 from v0xie/hotfix
Browse files Browse the repository at this point in the history
Hotfix: revert _forward restore
  • Loading branch information
v0xie authored Dec 28, 2023
2 parents 0b0568e + 924d7fb commit 124355d
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions agentsd/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,6 @@ def apply_patch(
if isinstance_str(module, "BasicTransformerBlock"):
module._old_class_= [module.__class__]
_old_forward = None
if hasattr(module, "_forward"):
_old_forward = [module._forward]
make_tome_block_fn = make_diffusers_tome_block if is_diffusers else make_tome_block
module.__class__ = make_tome_block_fn(module.__class__, _old_forward)
module._tome_info = diffusion_model._tome_info
Expand Down Expand Up @@ -414,9 +412,6 @@ def remove_patch(model: torch.nn.Module):
module._tome_info["hooks"].clear()

if module.__class__.__name__ == "ToMeBlock":
if hasattr(module, "_old_forward"):
if module._old_forward is not None:
module._forward = module._old_forward[0]
if hasattr(module, "_old__class__"):
module.__class__ = module._old__class__[0]
else:
Expand Down

0 comments on commit 124355d

Please sign in to comment.